Page 1 of 1
Editing <#txbattery>
Posted: Tue 07 Aug 2012 2:06 pm
by krmidas
The webtag for Davis transmitter battery status outputs a piece of text that gives the status of all 8 possible transmitters. Anyone know how can I edit this so it only displays the status of the first 2?
-Tom
Re: Editing <#txbattery>
Posted: Tue 07 Aug 2012 2:17 pm
by mcrossley
Can you post an example of the string this tag outputs?
Re: Editing <#txbattery>
Posted: Tue 07 Aug 2012 2:41 pm
by RayProudfoot
Re: Editing <#txbattery>
Posted: Tue 07 Aug 2012 2:48 pm
by steve
Code: Select all
TX Battery Status: 1-ok 2-ok 3-ok 4-ok 5-ok 6-ok 7-ok 8-ok
It displays "ok" for transmitters which are missing, or are present with good batteries. I can't remember what it displays if a particular battery is low, possibly the string "LOW" instead of "ok".
Re: Editing <#txbattery>
Posted: Tue 07 Aug 2012 4:11 pm
by mcrossley
Something like....?
Code: Select all
var val= "<#txbattery>".split(/\d-([a-z]+)/i);
//then...
//val[1] is status of battery #1
//val[3] is status of battery #2
//val[5] is status of battery #3
//val[7] is status of battery #4
//val[9] is status of battery #5
//etc
A bit messy, you could clean it up with two statements, or think of a more clever version!
Re: Editing <#txbattery>
Posted: Tue 07 Aug 2012 5:26 pm
by krmidas
Excuse my ignorance, but does that entire string (customized for the transmitters I want to track--namely #1 and #2) replace the webtag?
-Tom
Re: Editing <#txbattery>
Posted: Tue 07 Aug 2012 6:27 pm
by steve
I've added a 'channel' parameter to the <#txbattery> web tag, could you try it, please? It's just the cumulus.exe, zipped up:
http://nybbles.co.uk/downloads/Cumulus.zip
Just extract the cumulus.exe file into your existing installation of 1.9.3
Use it like this:
<#txbattery channel=1>
to get the relevant string for channel 1, and so on, up to channel=8. The result is just the string "ok" or whatever the string is for a low battery.
Re: Editing <#txbattery>
Posted: Tue 07 Aug 2012 6:47 pm
by RayProudfoot
That seems to work okay Steve. I have two transmitters, one for the ISS and another for the anemometer. I presume the ISS is 1 and the ane no 2?
http://www.cheadlehulmeweather.co.uk/system.htm
Re: Editing <#txbattery>
Posted: Tue 07 Aug 2012 6:58 pm
by steve
RayProudfoot wrote:That seems to work okay Steve.
Thanks.
I have two transmitters, one for the ISS and another for the anemometer. I presume the ISS is 1 and the ane no 2?
It would depend on what you've set them to on the dip switches, they could be either way around.
Re: Editing <#txbattery>
Posted: Tue 07 Aug 2012 7:27 pm
by krmidas
This sounds great. I'll try it out when I'm home tonight!
Many thanks.
Re: Editing <#txbattery>
Posted: Tue 07 Aug 2012 7:44 pm
by RayProudfoot
steve wrote:It would depend on what you've set them to on the dip switches, they could be either way around.
I think from memory the ISS is 1 and the anemometer tx 2 but I will check.
Re: Editing <#txbattery>
Posted: Wed 08 Aug 2012 12:22 am
by krmidas
Capture.JPG
Worked like a charm! Thanks for that lightning quick enhancement!