Welcome to the new home of the Cumulus Support forum.

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3044 7 December 2018. See the Wiki for download

Text file with tags and a calculation

Discussion of version 3 of Cumulus, which runs on Windows, Linux, and OS X. All Cumulus MX queries in here, please.

Moderator: mcrossley

Post Reply
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 » Sat 02 Apr 2016 8:54 pm

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

http://longboatkey.golffan.us/ - Fine Offset

http://BrokenArrow.golffan.us/ - Davis Vantage Vue / Pro2 - Cumulus MX

User avatar
mcrossley
Posts: 5234
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Text file with tags and a calculation

Post by mcrossley » Sat 02 Apr 2016 9:42 pm

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 » Sat 02 Apr 2016 11:48 pm

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

http://longboatkey.golffan.us/ - Fine Offset

http://BrokenArrow.golffan.us/ - Davis Vantage Vue / Pro2 - Cumulus MX

Post Reply