On Thursday, February 11, 2021 at 4:02:30 AM UTC+1 gjr80 wrote:

> I think it might be worth taking a couple of steps back here and having a 
> look at what you are trying to do, if not for your benefit then for mine. 
> As I understand it you have started with a weatherflow driver that picks up 
> UDP packets and emits that data in loop packets for WeeWX to ingest. This 
> driver requires WeeWX to operate with software record generation as the 
> driver only emits loop packets. You have taken that driver and extended it 
> to pick up historical data via a REST interface. The aim of this is to give 
> the driver the ability to emit historical archive records so that if WeeWX 
> loses connection to the UDP packets WeeWX can catchup when connection is 
> restored. When I became involved in the conversation you were working on 
> implementing the genArchiveRecords() method in your driver, presumably as 
> a path to being able to have WeeWX backfill/catchup if WeeWX loses the UDP 
> connection. Do I have this correct?
>

Yes, that is correct :) 

I gave some earlier advice that in order to be able to catchup/backfill you 
> need implement genArchiveRecords(), that is not strictly true. In order 
> for WeeWX to be able to catchup the driver needs to have a 
> genStartupRecords() method. It so happens that if you look at the base 
> class of your driver, weewx.drivers.AbstractDevice 
> <https://github.com/weewx/weewx/blob/master/bin/weewx/drivers/__init__.py#L12>,
>  
> you will see that your driver will have inherited a genStartupRecords() 
> method from the base class but it simply calls the genArchiveRecords() 
> method. So by implementing your genArchiveRecords() method you have 
> automatically given your driver a (functional) genStartupRecords() 
> method. Nothing wrong with that but as you have found with the type of 
> station the weatherflow is (there are no explicit archive records 
> available, you need to construct them) you get some odd behaviour when 
> genArchiveRecords() is implemented. What I suspect your really want is to 
> implement genStartupRecords() and genLoopPackets() but NOT implement 
> genArchiveRecords() and operate WeeWX with software record generation. To 
> do this all you would do is move your genArchiveRecords() code to 
> genStartupRecords() and remove the genArchiveRecords() class definition 
> from your driver (just let it inherit the genArchiveRecords() method from 
> the base class). This will result in the driver emitting loop packets (as 
> the original driver does) and WeeWX accumulating these loop packets, 
> synthesising archive records  and saving the archive records to the 
> database archive table. No archive records are emitted by the driver during 
> normal operation. If the UDP connection is lost and later restored then 
> when WeeWX restarts it will call the genStartupRecords() method with the 
> last known timestamp in the archive table and the genStartupRecords() 
> method will then emit all archive records since this timestamp. WeeWX will 
> store these archive records in the database archive table. Once the catchup 
> is completed normal driver operation resumes and WeeWX continues processing 
> loop packets.
>

Brilliant! This sounds like exactly the thing I want! I'm going to play 
with this! :)

Thanks!

Cheers,
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/dce4a4e4-7ff9-4c02-9430-9141c0898269n%40googlegroups.com.

Reply via email to