I now have a solution for myself:
if current data is available, it is displayed and if the data is not 
current, it is shown how old it is.

With the original code of "sensors.inc" the data is not displayed 
immediately when new observations are added.

#if $have_voltage
    <tr><th>$gettext("Voltage")</th><th></th></tr>
#for $x in $sensor_voltages
  #if $getattr($recent, $x).has_data or $getattr($current, $x).has_data
    <tr>
      <td class="label">$obs.label[$x]</td>
      <td class="data">$getVar('current.' + $x)</td>
      #if $getattr($recent, $x).has_data
       #set $lasttime = $getattr($recent, $x).lasttime.raw
       <td class="timestamp">$get_time_delta($lasttime, $now)</td>
      #end if
    </tr>
  #end if
#end for
#end if

vince schrieb am Samstag, 28. September 2024 um 20:07:12 UTC+2:

> The code that you said is failing seems to be from the Seasons skin 
> sensors.inc file (???) which gets its list of $sensor_voltages to report on 
> from skin.conf, with a hardcoded fallback value in sensors.inc itself. Is 
> it possible you are trying to look up a sensor that does not exist or that 
> has recently failed or been undefined in skin.conf ?
>
> (in Seasons skin.conf)
> sensor_voltages = consBatteryVoltage, heatingVoltage, supplyVoltage, 
> referenceVoltage
>
> (in Seasons sensors.inc)
> #set $sensor_voltages = $to_list($DisplayOptions.get('sensor_voltages', 
> ['consBatteryVoltage', 'heatingVoltage', 'supplyVoltage', 
> 'referenceVoltage']))
>
> [...]
>
> ###### (to me, this says if there are 'any' readings in the last month 
> from 'any' sensor)
> #set $have_voltage = 0
>
> #for $x in $sensor_voltages
>   #if $getattr($recent, $x).has_data
>     #set $have_voltage = 1
>   #end if
> #end for
>
> [...]
>
> ###### up above in the file it defines 'recent' as 
> $recent=$span($day_delta=30, boundary='midnight')
>
> #if $have_voltage
>     <tr><th>$gettext("Voltage")</th><th></th></tr>
> #for $x in $sensor_voltages
>   #if $getattr($recent, $x).has_data
>     <tr>
>       <td class="label">$obs.label[$x]</td>
>       <td class="data">$getVar('current.' + $x)</td>
> #set $lasttime = $getattr($recent, $x).lasttime.raw
>
>       <td class="timestamp">$get_time_delta($lasttime, $now)</td>
>     </tr>
>   #end if
> #end for
> #end if
>
>
> I'd suggest trying to add some debugging print statements to see what's in 
> there for each sensor (?)
>
> #if $have_voltage
>     <tr><th>$gettext("Voltage")</th><th></th></tr>
> #for $x in $sensor_voltages
>   #if $getattr($recent, $x).has_data
>     <tr>
>       <td class="label">$obs.label[$x]</td>
>       <td class="data">$getVar('current.' + $x)</td>
>       <td class="data">$getattr($recent, $x)</td>
>     </tr>
>   #end if
> #end for
> #end if
>
>
>
> On Saturday, September 28, 2024 at 10:03:51 AM UTC-7 Werner Krenn wrote:
>
> I have now tried to reproduce the error, but was unsuccessful.
>
> "I would try inserting '#errorCatcher Echo' at top of template"
> This is a default setting in the original WeeWx 5.1.0 sensors.inc
>
> I have hidden this error so far:
>
> -----------------------------------------------------------------------------------------
> #if $have_voltage
>     <tr><th>$gettext("Voltage")</th><th></th></tr>
> #for $x in $sensor_voltages
>   #if $getattr($recent, $x).has_data
>     <tr>
>       <td class="label">$obs.label[$x]</td>
>       <td class="data">$getVar('current.' + $x)</td>
> ##set $lasttime = $getattr($recent, $x).lasttime.raw
> ##     <td class="timestamp">$get_time_delta($lasttime, $now)</td>
>     </tr>
>   #end if
> #end for
> #end if
>
> -----------------------------------------------------------------------------------------------------
>
> Tom Keffer schrieb am Freitag, 27. September 2024 um 21:57:04 UTC+2:
>
> "lasttime" is an aggregation type, not an observation type. It chooses the 
> time of the last non-null value for an observation type.
>
> For example, $month.outTemp.lasttime would be the time of the last 
> non-null temperature for the month. 
>
> $month.outTemp.lasttime.raw would be that time as a pure number (unix 
> epoch time).
>
> Hope that answers your question. 
>
> On Fri, Sep 27, 2024 at 12:10 PM 'Werner Krenn' via weewx-user <
> [email protected]> wrote:
>
> LOG:
> raspi5-rt weewxd[505937]: ERROR weewx.cheetahgenerator: Evaluation of 
> template /etc/weewx/skins/Seasons/index.html.tmpl failed.
> raspi5-rt weewxd[505937]: ERROR weewx.cheetahgenerator: **** Ignoring 
> template /etc/weewx/skins/Seasons/index.html.tmpl
> raspi5-rt weewxd[505937]: ERROR weewx.cheetahgenerator: **** Reason: 
> cannot find 'raw' while searching for 'lasttime.raw'
> raspi5-rt weewxd[505937]: ERROR weewx.cheetahgenerator: **** To debug, try 
> inserting '#errorCatcher Echo' at top of template
>
> How can I "catch" this error "cannot find 'raw' while searching for 
> 'lasttime.raw'"
>
> -- 
> 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/e8ecb90e-681d-46d9-bb59-416f09c99d02n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/weewx-user/e8ecb90e-681d-46d9-bb59-416f09c99d02n%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/645553b5-2958-4e4c-a4f9-ae2825e84ce1n%40googlegroups.com.

Reply via email to