So, after a bunch of trial-and-error and remembering various clues from
other questions over time, I was able to solve this problem
in weewx/skins/Seasons/current.inc
#elif $x == 'last_runtime'
<tr>
#set hours_on = $rnd(($current.last_runtime.raw / 3600.0), 1)
<td class="label">$obs.label[$x]</td>
<td class="data">$hours_on hrs</td>
</tr>
solves the "I want seconds converted to hours to one decimal."
On Monday, July 21, 2025 at 8:08:04 PM UTC-6 [email protected] wrote:
> I'm working on adding another observation to my solar monitor and I want
> the same thing Karen
> is asking. I didn't understand where the example code would go
> >> I can't think of any way to do that using a simple format string.
> You'll have to do something like:
> >> #set hours_up = $almanac.sun.visible.raw / 3600.0
> >> <p>Sun up: $("%.2f" % $hours_up)</p>"
>
> I tried this is current.inc (SKIN_VERSION = 4.10.2):
> #elif $x == 'last_runtime'
> #set hours_on = $day.last_runtime.raw / 3600.0
> <tr>
> <td class="label">$obs.label[$x]</td>
> <td class="data"><p>$("%.1f" % $hours_on)</p></td>
> </tr>
> and it failed miserably.
> Jul 21 13:04:02 router1 weewx[21556] ERROR weewx.cheetahgenerator:
> Evaluation of template /home/crichmon/weewx/skins/Seasons/index.html.tmpl
> failed with exception '<class 'TypeError'>'
> Jul 21 13:04:02 router1 weewx[21556] ERROR weewx.cheetahgenerator: ****
> Ignoring template /home/crichmon/weewx/skins/Seasons/index.html.tmpl
> Jul 21 13:04:02 router1 weewx[21556] ERROR weewx.cheetahgenerator: ****
> Reason: unsupported operand type(s) for /: 'AggTypeBinder' and 'float'
> Jul 21 13:04:02 router1 weewx[21556] ERROR weewx.cheetahgenerator: ****
> Traceback (most recent call last):
> Jul 21 13:04:02 router1 weewx[21556] ERROR weewx.cheetahgenerator: ****
> File "/home/crichmon/weewx/bin/weewx/cheetahgenerator.py", line 348, in
> generate
> Jul 21 13:04:02 router1 weewx[21556] ERROR weewx.cheetahgenerator: ****
> unicode_string = compiled_template.respond()
> Jul 21 13:04:02 router1 weewx[21556] ERROR weewx.cheetahgenerator: ****
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Jul 21 13:04:02 router1 weewx[21556] ERROR weewx.cheetahgenerator: ****
> File "_home_crichmon_weewx_skins_Seasons_index_html_tmpl.py", line 226, in
> respond
> Jul 21 13:04:02 router1 weewx[21556] ERROR weewx.cheetahgenerator: ****
> File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line 1708, in
> _handleCheetahInclude
> Jul 21 13:04:02 router1 weewx[21556] ERROR weewx.cheetahgenerator: ****
> self._CHEETAH__cheetahIncludes[_includeID].respond(trans)
> Jul 21 13:04:02 router1 weewx[21556] ERROR weewx.cheetahgenerator: ****
> File
> "cheetah__home_crichmon_weewx_skins_Seasons_current_inc_1753124642_9362485_61563.py",
>
> line 251, in respond
> Jul 21 13:04:02 router1 weewx[21556] ERROR weewx.cheetahgenerator: ****
> TypeError: unsupported operand type(s) for /: 'AggTypeBinder' and 'float'
>
> What am I missing? The value is in seconds and coming in via mqtt.
>
> Thx, Chris
> On Saturday, November 5, 2022 at 10:32:47 AM UTC-6 Tom Keffer wrote:
>
>> I can't think of any way to do that using a simple format string. You'll
>> have to do something like:
>>
>> #set hours_up = $almanac.sun.visible.raw / 3600.0
>> <p>Sun up: $("%.2f" % $hours_up)</p>
>>
>>
>>
>> On Sat, Nov 5, 2022 at 9:00 AM Karen K <[email protected]> wrote:
>>
>>> Is there a way to format a value of group_deltatime in decimal hours
>>> instead of hours, minutes, and seconds?
>>>
>>> Something like
>>> daylight: 9.5 hours
>>> instead of
>>> daylight: 9 hours, 30 minutes, and 0 seconds
>>>
>>> --
>>> 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/15b424e4-e698-4603-b247-95a0326dc195n%40googlegroups.com
>>>
>>> <https://groups.google.com/d/msgid/weewx-user/15b424e4-e698-4603-b247-95a0326dc195n%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 visit
https://groups.google.com/d/msgid/weewx-user/9a26a8d8-c8e4-4ebd-a824-f4685f309212n%40googlegroups.com.