It might be worth revising the operation of genLoopPackets() and 
genArchiveRecords(), in particular when running under hardware and software 
record generation.

The task of genLoopPackets() is to emit loop packets and these packets are 
processed and accumulated by WeeWX. The accumulated loop packets can be 
used to (1) synthesise an archive record at the end of the archive interval 
(which is ultimately saved to database in the archive table) and (2) if 
loop_hilo is True update the daily summary tables. On the other hand the 
task of genArchiveRecords() is to emit, when asked,  archive records which 
are processed by WeeWX and ultimately saved to database in the archive 
table and used to update the daily summary tables. 

If you are using software record generation then WeeWX never asks the 
driver to emit archive records, instead WeeWX takes the accumulated loop 
packet data received during an archive interval and synthesises an archive 
record. This archive record is saved to database in the archive table.If 
loop_hilo is True the daily summary tables are updated using the 
accumulated loop data. In other words the driver just continually emits 
loop packets and WeeWX does the rest. 

When using hardware record generation the driver continues to emit loop 
packets, and WeeWX continues to accumulate them; however, at the end of the 
archive interval instead of synthesising an archive record WeeWX asks the 
driver for an archive record. Since the driver has a genArchiveRecords() 
method an archive record is emitted by the driver and WeeWX takes that 
archive record and ultimately saves it to database in the archive table. 
WeeWX will use the archive data and, if loop_hilo is True, the accumulated 
loop packet data, to update the daily summary tables (note that no archive 
record is ever synthesised by WeeWX, the only archive record that exists 
comes from the driver). There is one more aspect to WeeWX operation when 
hardware record generation is selected. WeeWX asks the driver for an 
archive record by calling the genArchiveRecords() method,  if that call 
fails then WeeWX falls back to software record generation (ie WeeWX 
synthesises an archive record from the accumulated loop packets). So even 
though you have set hardware record generation WeeWX will still function 
properly with a driver that does not support hardware record generation (ie 
it has no genArchiveRecords() method).

Back to your situation. When you have genArchiveRecords() enabled you say 
that "*The driver sees the data and according to some logging it passes it 
to weewx just fine, but for some reason weewx seems to be silently ignoring 
the data, it is never added to the database with no indication why in the 
logfile.*" What do you mean by this, or what are you expecting to see? If 
you are using hardware record generation (you must be if genArchiveRecords() 
is being called) then WeeWX will never save the loop packet data to the 
archive table in the database, it saves the archive record emitted by 
genArchiveRecords() to the archive table in the database. WeeWX only uses 
the loop packet data to update the daily summary tables. Did you look at 
the daily summary tables, are the highs and lows and timestamps being 
updated with loop data?

When you disable genArchiveRecords(), even though you have hardware record 
generation set, the call to genArchiveRecords() fails and WeeWX 
automatically falls back to software record generation where WeeWX 
synthesises an archive record and saves that archive record to the archive 
table in the database.

>From your description above it is quite possible that WeeWX and your driver 
is working exactly as intended, it might not be, but I think you will need 
to look at bit deeper to show this.

Gary

On Wednesday, 10 February 2021 at 07:29:28 UTC+10 Jan-Jaap van der Geer 
wrote:

> I've modified an existing driver that originally only captured LOOP data 
> but I have added a 'genArchiveRecords()' method to it that fetches data 
> from a REST interface. This seems to work fine and it fetches the data.
>
> However, since this modification it no longer fetches the LOOP data. The 
> driver sees the data and according to some logging it passes it to weewx 
> just fine, but for some reason weewx seems to be silently ignoring the 
> data, it is never added to the database with no indication why in the 
> logfile.
>
> I've been investigating this for some days and I don't understand why it 
> is happening. I have found out that it is related to the 
> genArchiveRecords() method: If I have this method like this:
>
>     def genArchiveRecords(self, since_ts):
>         yield from ()
>
> then weewx is ignoring all values returned by genLoopPackets().
>
> However, if I comment out the genArchiveRecords() alltogether, then 
> suddenly the records returned from weewx by genLoopPackets() are being 
> inserted in the database as expected.
>
> This does not make any sense to me. Anybody understands what is going on?
>
> The code for this driver can be found here: 
> https://github.com/jjvdgeer/weatherflow-udp
>
> Thanks,
> Jan-Jaap
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-development/56f07bb2-8d56-4e17-9be1-ba8961d9687an%40googlegroups.com.

Reply via email to