bellrichm / WeeWX-Extras

A place to hold some small extras
GNU General Public License v3.0
1 stars 1 forks source link

[observationtime] 'Caught' values and times bleed into next archive record #3

Open bellrichm opened 1 month ago

bellrichm commented 1 month ago

This seems to be a 'timing' issue along with the fact that the loop packets know nothing about archive periods and intervals. This appears to be what is happening.

The result is the min/last values 'bleed' into the next archive record.

bellrichm commented 1 month ago

I see no good and clean way to manage this. A couple of possibilities are

Ultimately, for now at least, the loop packet will only be augmented if the observation's whose value is to be captured is in the record and has a value. Effectively this removes 'state' from the processing. If downstream process, either in WeeWX or outside (for example, a MQTT Subscriber), wants to know the captured values/times; it either needs to keep track (which might be possible....) or it should use the archive record.

The question is, if the packet's observation being tracked does not have a value or is None, is the packet augmented with None. I believe the WeeWX way would augment with None, but I think missing values might be more useful and less misleading (and might be considered a partial packet). I will not put in None values in this case.

bellrichm commented 1 month ago

I went with checking that the observation has a value. Even this won't work all the time. If a packet comes in before the pre loop event is processed. And if that packet has a value that is bigger than currently stored packet, the currently stored packet will be used. When, really the one in the event packet should be used. This is better, and will roll with it for now. But needs more work. See commit, https://github.com/bellrichm/WeeWX-Extras/blob/41b578d026cae5f7105669ae6464ae4ce9fe11b6/bin/user/observationtime.py

bellrichm commented 1 month ago

Additional information is in this thread, https://groups.google.com/g/weewx-development/c/1cJBMAX3Wsg