Missing keys in event.record dictionary for Archive event

56 views
Skip to first unread message

Peter Fletcher

unread,
Apr 8, 2025, 2:22:52 PMApr 8
to weewx-development
Are there any circumstances under which event.record in the event structure passed to the NEW_ARCHIVE_RECORD handler would not be expected to contain the key 'inTemp' (or, indeed, any other key corresponding to a field in the database)? I ask because I am seeing some odd behavior in a user-written Service. Basically, under certain rare circumstances (which may be having to do with the service processing multiple Archive records before any Loop records are processed), the service code errors out reporting that the 'inTemp' key is not found in the dictionary.

Tom Keffer

unread,
Apr 8, 2025, 7:21:21 PMApr 8
to Peter Fletcher, weewx-development
Hello, Peter,

Under normal circumstances, an archive record starts in one of two ways:

1. If hardware generation is supported, then the hardware provides it.
2. If not, then it is extracted out of accumulated LOOP packets, which, in turn, come from the hardware.

Either way, whether or not an observation type appears depends entirely on whether the hardware supplies it. If the device driver doesn't emit inTemp, then it will not appear in the archive records. There is no other source for it.

Other types are synthesized (e.g., dewpoint) from measured observation types, but that's not the case with inTemp.

Of course, I can't speak for a user supplied service. It may supply inTemp in some other way or, indeed, it could even delete it.

Hope this answers your question.

-tk

On Tue, Apr 8, 2025 at 11:22 AM 'Peter Fletcher' via weewx-development <weewx-de...@googlegroups.com> wrote:
Are there any circumstances under which event.record in the event structure passed to the NEW_ARCHIVE_RECORD handler would not be expected to contain the key 'inTemp' (or, indeed, any other key corresponding to a field in the database)? I ask because I am seeing some odd behavior in a user-written Service. Basically, under certain rare circumstances (which may be having to do with the service processing multiple Archive records before any Loop records are processed), the service code errors out reporting that the 'inTemp' key is not found in the dictionary.

--
You received this message because you are subscribed to the Google Groups "weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-developm...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/weewx-development/eeefc048-1139-497f-9cf3-827c2df27b6cn%40googlegroups.com.

Peter Fletcher

unread,
Apr 8, 2025, 10:23:16 PMApr 8
to weewx-development
My weather station is a Vantage Pro 2, using the standard weewx Vantage driver, and I believe that the station is one which generates its own archive records for weewx to process. The Davis documentation shows that the archive record includes the inside temperature, and, indeed, almost all the time, the service code finds the relevant key and value in event.record. The error that I have described only occurs after the weewx service has been stopped for a significant amount of time (not well defined, but certainly more than a single 5-minute archive interval). The problem, then, is not that the key:value pair is missing under normal circumstances, but that it is missing under certain circumstances. 

Peter Fletcher

unread,
Apr 9, 2025, 9:59:32 AMApr 9
to weewx-development
A bit of further (I hope!) clarification: when the error occurs, the service is trying to read and save the value of the 'inTemp' record, as it exists (or should exist) in the dictionary that is passed into the service's event handler code. The service has, at that point, done nothing to the dictionary.
Reply all
Reply to author
Forward
0 new messages