If you implement the method genArchiveRecords() there should be no reason
to do this. It will pass in as its only argument the last timestamp in the
database. So, do your retrieval since that timestamp. It should be a
generator function, yielding records.

-tk

On Sun, Mar 24, 2019 at 8:21 AM Louis De Lange <[email protected]> wrote:

> I am busy writing a new driver to capture electricity data from a meter
> send out the data using a restful service using POST requests - the driver
> is based heavily on the Interceptor driver..
>
> I have the whole thing working correctly as initially intended, but now it
> would be nice to add some features.
>
> The meter allows me to download historical data for any time that weewx
> was perhaps offline.  However, to do this is a practical way I need to know
> the time of the last record in the database.  When I try to open the
> database from the driver using
>
> db_manager = 
> self.engine.db_binder.get_manager(data_binding='name_of_binding', 
> initialize=True)
>
>
> or
>
> db_manager = weewx.manager.open_manager_with_config(config_dict, 
> data_binding='name_of_binding')
>
>
> as suggested in the customization guide it fails.
>
> This raises the question, is it possible to access the database from the
> driver? - and if yes, how?
>
> Thanks in advance
>
> Louis
>

Reply via email to