Iterate over records for the last 24h

41 views
Skip to first unread message

jterr...@gmail.com

unread,
Jul 26, 2021, 8:08:18 AM7/26/21
to weewx-user
Hi,

I am trying to define a template that would list selected data for each record for the last 24h

Here is my test code, running on Weewx 4.5.1 :

test 24h
    
#for $_record in $span($hour_delta=24).records
$_record.dateTime.format("%Y-%m-%d"),  $_record.dateTime.format("%H:%M:%S")
#end for

In my output file, I have only the "test 24h" line, and no other data. I tried also $span($day_delta=1).records without success.

Do you have some suggestions ?

Thanks

gjr80

unread,
Jul 26, 2021, 8:53:28 AM7/26/21
to weewx-user
Works fine for me:

test 24h

2021-07-15, 12:30:00
2021-07-15, 12:31:00
2021-07-15, 12:32:00
2021-07-15, 12:33:00
2021-07-15, 12:34:00
2021-07-15, 12:36:00
2021-07-15, 12:37:00
2021-07-15, 12:38:00
2021-07-15, 12:39:00
2021-07-15, 12:40:00
2021-07-15, 12:41:00
2021-07-15, 12:42:00
2021-07-15, 12:43:00

Do you actually have any data in your archive within the last 24 hours?

Gary

Jacques Terrettaz

unread,
Jul 26, 2021, 11:32:15 AM7/26/21
to weewx...@googlegroups.com
Thanks gjr80. Yes, I have verified that I have the last data in the archive table.

For my first tests, I put the code at the end of the monthly NOAA template file and it was not working.

Finally I have added a separate template file in an existing skin, and it works now. I am not sure why, but at least it works!

Jacques

-- 
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/qFFJl1SpL1k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/397c0f00-c3c5-4de8-85a5-f10fb82e3b38n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages