i just wanted to say Thank You '[email protected]' 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
On Friday, December 3, 2021 at 12:19:40 PM UTC-6 [email protected] 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 <[email protected]> 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
>> <https://weewx.com/docs/customizing.htm#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
>> <https://weewx.com/docs/customizing.htm> and the other large sets of
>> info in the wiki <https://github.com/weewx/weewx/wiki> and the FAQ
>> <https://github.com/weewx/weewx/wiki/WeeWX-Frequently-Asked-Questions>.
>>
>> On Friday, December 3, 2021 at 12:43:40 AM UTC-8 [email protected]
>> wrote:
>>
>>> 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
>>>
>>>
>>> --
>> 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 [email protected].
>>
> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/weewx-user/fa850573-3052-4f98-bfa9-f3847dfd7c0cn%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/weewx-user/fa850573-3052-4f98-bfa9-f3847dfd7c0cn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/weewx-user/e279c414-1830-49f8-b994-a3f75aeae737n%40googlegroups.com.