Weatherflow UDP driver, Tempest battery reports 'LOW'

283 views
Skip to first unread message

John Pierce

unread,
Dec 2, 2021, 7:00:52 PM12/2/21
to weewx-user
So I brought up my new WF Tempest w/ the UDP driver in weewx yesterday, and it seems to be working fine...

On  the weatherflow station website, my battery is fine, but on weewx, its showing consistently 'low'.

sensor map:

[WeatherFlowUDP]
    driver = user.weatherflowudp
    udp_address = 0.0.0.0
    share_socket = False

    [[sensor_map]]
        outTemp = air_temperature.ST-00047518.obs_st
        outHumidity = relative_humidity.ST-00047518.obs_st
        pressure = station_pressure.ST-00047518.obs_st
        #lightning_strikes =  lightning_strike_count.ST-00047518.obs_st
        #avg_distance =  lightning_strike_avg_distance.ST-00047518.obs_st
        outTempBatteryStatus = battery.ST-00047518.obs_st
        windSpeed = wind_speed.ST-00047518.rapid_wind
        windDir = wind_direction.ST-00047518.rapid_wind
        #luxXXX = illuminance.ST-00047518.obs_st
        UV = uv.ST-00047518.obs_st
        rain = rain_accumulated.ST-00047518.obs_st
        windBatteryStatus = battery.ST-00047518.obs_st
        radiation = solar_radiation.ST-00047518.obs_st
        #lightningXXX = distance.ST-00047518.evt_strike
        #lightningYYY = energy.ST-00047518.evt_strike

output: 

  Battery Status
      Wind Battery: LOW
      Outside Temperature Battery : LOW

I'd really like to graph the battery voltage, but I dunno how to add a new graph type to weewx.

vince

unread,
Dec 2, 2021, 8:37:44 PM12/2/21
to weewx-user
You're going to have to tell us which skin(s) you are seeing 'low' on and which one(s) you want to add images to.

You only need to map the obs_st battery status to one weewx element.  The example you copied I think probably assume the old Air+Sky two-sensor Weatherflow station.  The Tempest has only one battery to report on.

Re: adding images, you want to see the Customization Guide which admittedly is a bit of a tough read for new users.  Short answer is that you define your images in skin.conf for the skin you want the image to be in, and you hook it into the web by editing the .tmpl template file(s) for that skin.

Re: battery voltage showing ok/low, the default skins assume a Davis Vantage scenario where a battery status of  0 = ok and 1 = not_ok, so if you're mapping voltages to the default elements you would see the 'not ok' thing rather than the voltage in volts.  You'd have to edit sensors.inc in the Seasons skin to display voltages as you seem to want.   The check for zero/non-zero is at the top of the file.

At the top of sensors.inc there it says:

#def get_battery_status($x)
#if $x == 0
<span class="status_ok">OK</span>
#else
<span class="status_low">LOW</span>
#end if
#end def

You would change it to just display the voltage in volts.
Something like the following (totally untested):

#def get_battery_status($x)
#if $x >= 0
<span class="data">$x</span>
#end def

Alternately you could change the calls down below that look like:

#if $day.outTempBatteryStatus.has_data
    <tr>
      <td class="label">$obs.label.outTempBatteryStatus</td>
      <td class="data">$get_battery_status($current.outTempBatteryStatus.raw)</td>
    </tr>
#end if

to....

#if $day.outTempBatteryStatus.has_data
    <tr>
      <td class="label">$obs.label.outTempBatteryStatus</td>
      <td class="data">$current.outTempBatteryStatus.raw</td>
    </tr>
#end if

The .raw will show the number.  If you omit the .raw you'll see the units too.

John Pierce

unread,
Dec 2, 2021, 9:21:35 PM12/2/21
to weewx-user
ah, I'm using Seasons.  and I just found the fix on the weatherflow-UDP github 'issues'.

and yeah, trying to fix it to display txBatteryStatus now, instead of outTemp or wind or whatever.

vince

unread,
Dec 2, 2021, 9:40:59 PM12/2/21
to weewx-user
yup - that's where I was going.  Use that example.

John Pierce

unread,
Dec 2, 2021, 10:19:11 PM12/2/21
to weewx-user
yeesh, if I even look sideways at that code, I get a  TypeError: '>=' not supported between instances of 'NoneType' and 'float' in the modified get_battery_status routine in sensors.inc..

I don't know my python at all well, or this templating language used in the .inc files.

I have it working again, and I don't think I'm going to touch it.


John Pierce

unread,
Dec 3, 2021, 3:43:40 AM12/3/21
to weewx-user
eeeek.


Battery OK - 2.6226000000000003

k, how do I format a float in this cheetah template language?  I mean, I assume thats what sensor.inc is ?

#if $x >= 2.455
<span class="status_ok">OK - $x</span>
#else
#if $x >= 2.41
<span class="status_low">LOW - mode 1 - $x</span>
#else
#if $x >= 2.39
<span class="status_low">LOW - mode 2 - $x</span>
#else
<span class="status_low">LOW - mode 3 - $x</span>
#end if
#end if
#end if


John Pierce

unread,
Dec 3, 2021, 4:28:29 AM12/3/21
to weewx-user
k, answering own question after some googling and guessing....     *gawd* I remember why I spent the last 10-15 years of my engineering career disliking Python

            #set $y = "{:.2f}".format($x)

and using $y instead of $x in all those bold places in my previous post.

in what sane language would "formatstring".format(value)   make sense ?   sure, I could see value.format("formatstring"), but really, what is wrong with format(value, "format") ??

oh never mind, just chalk this up to another crotchety old greybeard who started on FORTRAN and Assembler in the 1970s and managed to stay gainfully employed cranking out low level systems code for 45 years.



Stephen Hocking

unread,
Dec 3, 2021, 7:16:44 AM12/3/21
to weewx...@googlegroups.com
I feel your pain...

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/ba1b1b4d-59a3-49fa-8b11-1156ac35120cn%40googlegroups.com.


--
  "I and the public know
  what all schoolchildren learn
  Those to whom evil is done
  Do evil in return"		W.H. Auden, "September 1, 1939"

p q

unread,
Dec 3, 2021, 9:42:20 AM12/3/21
to weewx...@googlegroups.com
It's from the C and Unix heritage. Scroll down to the History part here: https://en.wikipedia.org/wiki/Printf_format_string

tldr; It goes back to BCPL in 1966



--
Peter Quinn
(415)794-2264

vince

unread,
Dec 3, 2021, 1:09:34 PM12/3/21
to weewx-user
Well you WANTED accuracy, you're getting accuracy :-)

I know you figured it out, but be forewarned that the Cheetah engine under the hood here is very finicky and debugging things when you have even the slightest typo can get very frustrating.   Definitely make small changes one at a time and keep your modifications in a version control system such as git.  You'll thank yourself later.

Incidentally - Cheetah is a third-party thing weewx relies on, so it's not anything anybody here can fix.  It is what it is.  Sometimes you have to go with it.  It's powerful but yes it can make you a little crazy when it throws a fit.

Hint for the future - go through the formatting examples in the Customization guide.   It'll make how to tweak things more obvious.  In fact, you should at least scan the whole Customization guide and the other large sets of info in the wiki and the FAQ.
 

p q

unread,
Dec 3, 2021, 1:19:40 PM12/3/21
to weewx...@googlegroups.com
You might want do a test for null before doing a greater/less than comparison to avoid the "TypeError: '>=' not supported between instances of 'NoneType' and 'float'" errors. I suspect you'll get those errors if there is no value for $x in your example. 

This is off the top of my head and likely the wrong syntax:
#if $x is not None and $x>= 2.41


--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.

andy gavras

unread,
Jan 21, 2022, 9:36:25 AM1/21/22
to weewx-user
i just wanted to say Thank You 'jhn.p...@gmail.com' for starting this thread and vince for getting it rolling.  I'm an aged 50+ closet nerd with great google skills and who learned  B.A.S.I.C  on an Atari...  

Here's what they said in the above messages in a way that worked for me.
Maybe next  i'll use TxBattery... instead of OutTempBattery, and maybe a pretty graph.
not sure how to implement that test for null... might look into that more as well.  

To show tempest voltage and current low battery mode in seasons skin...
in 'etc/weewx/skins/Seasons/sensors.inc' change the #def get_battery _status($x) definition to read as follows:

#def get_battery_status($x)

#set $y = "{:.2f}".format($x)
#if $x >= 2.455
<span class="status_ok">OK - $y</span>

#else
#if $x >= 2.41
<span class="status_ok">LOW - Mode1 - $y</span>

#else
#if $x >= 2.39
<span class="status_ok">LOW - Mode2 - $y</span>
#else
<span class="status_ok">LOW - Mode3 - $y</span>

#end if
#end if
#end if
#end def
Reply all
Reply to author
Forward
0 new messages