Re: [weewx-user] Re: Weatherflow UDP driver, Tempest battery reports 'LOW'

2022-01-21 Thread andy gavras
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
OK - $y
#else
#if $x >= 2.41
LOW - Mode1 - $y
#else
#if $x >= 2.39
LOW - Mode2 - $y
#else
LOW - Mode3 - $y
#end if
#end if
#end if
#end def




On Friday, December 3, 2021 at 12:19:40 PM UTC-6 peterq...@gmail.com wrote:

> 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
>
>
> On Fri, Dec 3, 2021, 10:09 AM vince  wrote:
>
>> 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 
>> .
>>  
>> On Friday, December 3, 2021 at 12:43:40 AM UTC-8 jhn.p...@gmail.com 
>> wrote:
>>
>>> k.
>>>
>>>
>>> Battery OK - 2.62260003
>>>
>>> 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
>>> OK - *$x*
>>> #else
>>> #if $x >= 2.41
>>> LOW - mode 1 - *$x*
>>> #else
>>> #if $x >= 2.39
>>> LOW - mode 2 - *$x*
>>> #else
>>> LOW - mode 3 - *$x*
>>> #end if
>>> #end if
>>> #end if
>>>
>>>
>>> -- 
>> 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/fa850573-3052-4f98-bfa9-f3847dfd7c0cn%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/e279c414-1830-49f8-b994-a3f75aeae737n%40googlegroups.com.


Re: [weewx-user] Re: Weatherflow UDP driver, Tempest battery reports 'LOW'

2021-12-03 Thread p q
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


On Fri, Dec 3, 2021, 10:09 AM vince  wrote:

> 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
> .
>
> On Friday, December 3, 2021 at 12:43:40 AM UTC-8 jhn.p...@gmail.com wrote:
>
>> k.
>>
>>
>> Battery OK - 2.62260003
>>
>> 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
>> OK - *$x*
>> #else
>> #if $x >= 2.41
>> LOW - mode 1 - *$x*
>> #else
>> #if $x >= 2.39
>> LOW - mode 2 - *$x*
>> #else
>> LOW - mode 3 - *$x*
>> #end if
>> #end if
>> #end if
>>
>>
>> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/fa850573-3052-4f98-bfa9-f3847dfd7c0cn%40googlegroups.com
> 
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAA1SM21d_Ghqj2HGOPBjoJYghukGY%2BEQF%2BL8GfbkWp7FNBcbuQ%40mail.gmail.com.


[weewx-user] Re: Weatherflow UDP driver, Tempest battery reports 'LOW'

2021-12-03 Thread vince
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 
.
 
On Friday, December 3, 2021 at 12:43:40 AM UTC-8 jhn.p...@gmail.com wrote:

> k.
>
>
> Battery OK - 2.62260003
>
> 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
> OK - *$x*
> #else
> #if $x >= 2.41
> LOW - mode 1 - *$x*
> #else
> #if $x >= 2.39
> LOW - mode 2 - *$x*
> #else
> LOW - mode 3 - *$x*
> #end if
> #end if
> #end if
>
>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/fa850573-3052-4f98-bfa9-f3847dfd7c0cn%40googlegroups.com.


Re: [weewx-user] Re: Weatherflow UDP driver, Tempest battery reports 'LOW'

2021-12-03 Thread p q
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

On Fri, Dec 3, 2021 at 4:16 AM Stephen Hocking 
wrote:

> I feel your pain...
>
> On Fri, 3 Dec 2021 at 20:28, John Pierce  wrote:
>
>> 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.
>>
>>
>>
>> --
>> 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+unsubscr...@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"
>
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/CA%2BxzKjAbu_sdUc46guPtGSjYrf2m9u_qqhA%3D-775s0PsykDZMA%40mail.gmail.com
> 
> .
>


-- 
Peter Quinn
(415)794-2264

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAA1SM20Oqa5i25UJmChO%3DP3JjvwPdgUrk2AE8oZJ18wQ2LXzuw%40mail.gmail.com.


Re: [weewx-user] Re: Weatherflow UDP driver, Tempest battery reports 'LOW'

2021-12-03 Thread Stephen Hocking
I feel your pain...

On Fri, 3 Dec 2021 at 20:28, John Pierce  wrote:

> 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.
>
>
>
> --
> 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+unsubscr...@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"

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CA%2BxzKjAbu_sdUc46guPtGSjYrf2m9u_qqhA%3D-775s0PsykDZMA%40mail.gmail.com.


[weewx-user] Re: Weatherflow UDP driver, Tempest battery reports 'LOW'

2021-12-03 Thread John Pierce
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.



-- 
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+unsubscr...@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.


[weewx-user] Re: Weatherflow UDP driver, Tempest battery reports 'LOW'

2021-12-03 Thread John Pierce
k.


Battery OK - 2.62260003

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
OK - *$x*
#else
#if $x >= 2.41
LOW - mode 1 - *$x*
#else
#if $x >= 2.39
LOW - mode 2 - *$x*
#else
LOW - mode 3 - *$x*
#end if
#end if
#end if


-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/e11c96ec-6a32-4111-897d-ecca60f7da1en%40googlegroups.com.


[weewx-user] Re: Weatherflow UDP driver, Tempest battery reports 'LOW'

2021-12-02 Thread John Pierce
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.


-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/8121cb78-8ff8-4da6-b00c-7a7271a5349cn%40googlegroups.com.


[weewx-user] Re: Weatherflow UDP driver, Tempest battery reports 'LOW'

2021-12-02 Thread vince
yup - that's where I was going.  Use that example.

On Thursday, December 2, 2021 at 6:21:35 PM UTC-8 jhn.p...@gmail.com wrote:

> 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.
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/7ea0db7f-e45b-483f-8be8-36912524f16en%40googlegroups.com.


[weewx-user] Re: Weatherflow UDP driver, Tempest battery reports 'LOW'

2021-12-02 Thread John Pierce
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.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/c44da557-7e3b-42f3-9975-b430fca9dd7en%40googlegroups.com.


[weewx-user] Re: Weatherflow UDP driver, Tempest battery reports 'LOW'

2021-12-02 Thread vince
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
OK
#else
LOW
#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
$x
#end def

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

#if $day.outTempBatteryStatus.has_data

  $obs.label.outTempBatteryStatus
  $get_battery_status($current.outTempBatteryStatus.raw)

#end if

to

#if $day.outTempBatteryStatus.has_data

  $obs.label.outTempBatteryStatus
  $current.outTempBatteryStatus.raw

#end if

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

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/bee98149-2bc5-4ed3-bbf2-e7a89cd910f8n%40googlegroups.com.