Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Text file with tags and a calculation

Topics about the Beta trials up to Build 3043, the last build by Cumulus's founder Steve Loft. It was by this time way out of Beta but Steve wanted to keep it that way until he made a decision on his and Cumulus's future.

Moderator: mcrossley

Locked
User avatar
pete_c
Posts: 228
Joined: Wed 12 Oct 2011 11:22 pm
Weather Station: Davis Vue-Pro2 - Fine Offset
Operating System: W2003-XPSP3-Linux
Location: Time Traveler

Text file with tags and a calculation

Post by pete_c »

Can I build a simple status tag txt file with a calculation on it.

Looking here to just add a percentage of Davis Vantage Pro 2 reception to the txt file.

IE:

Current file is: ( just call it radio dot text)

Total Packets Received: <#DavisTotalPacketsReceived> • Total Packets Missed: <#DavisTotalPacketsMissed> • CRC Errors: <#DavisNumCRCerrors> • ReSynchs: <#DavisNumberOfResynchs> • MaxInARow: <#DavisMaxInARow> • Battery: <#txbattery>

I want to calculate percentage using this forumula. Just putting it in the text file doesn't do any calculation and just shows the values from the webtags.

(((<#DavisTotalPacketsReceived>/(<#DavisTotalPacketsReceived>+<#DavisTotalPacketsMissed>))*100)

I am guessing that I am not doing this right or I cannot do this?

Any suggestions?
- Pete
Automator
User avatar
mcrossley
Posts: 12756
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Text file with tags and a calculation

Post by mcrossley »

You will need to do the calculation in either a JavaScript file in the clients browser or in a PHP script file on your web server.

I'm on my phone at the no so can't post examples.
User avatar
pete_c
Posts: 228
Joined: Wed 12 Oct 2011 11:22 pm
Weather Station: Davis Vue-Pro2 - Fine Offset
Operating System: W2003-XPSP3-Linux
Location: Time Traveler

Re: Text file with tags and a calculation

Post by pete_c »

Thank you Mark.

So using the example (and I know I am wrong right now) it would be something like:

<?php
require_once("cumulusradio.php");
echo $time;
echo "<br/>";
Echo "Current Radio Reception: " & "(($DavisTotalPacketsReceived/$DavisTotalPacketsMissed)+$DavisTotalPacketsReceived)100)"& %"
?>

Went to looking at banner php stuff and testing it; it works fine on my webserver.

Looking at integrating Cumulus stuff with my automation stuff here for a little status mini banner of sorts.
- Pete
Automator
Locked