If I understand correctly you are trying to write a WLL driver that not 
only emits loop packets/archive records but also catchup archive records. 
if that is the case I think you are making this way more complex than it 
need be. A driver should only be concerned with emitting loop packets and 
archive records. These packets/records should be emitted using one of the 
three unit systems supported by WeeWX; US, METRIC or METRICWX. The driver 
should not care what unit system is used in the database, WeeWX takes care 
of any unit conversions before the StdArchive service saves any archive 
records to database. If the driver is more sophisticated and is able to 
emit 'catch up' archive records then the driver just neds to implement a 
genStartupRecords() method. There is no need to create a service to convert 
or save these (catchup) archive records as during startup WeeWX calls the 
driver's genStartupRecords() method and any archive records emitted are 
processed by WeeWX (eg units converted if required by StdConvert) and the 
archive record saved to database by StdArchive. Note that it is quite 
acceptable for a driver to convert an observation from one unit to another 
(say a temperature from C to F) but that should only be done for the 
purposes of getting the obs in a packet/record in the units used by the 
chosen unit system not to make the emitted packet/record agree with the 
database unit system (Note there are functions, largely in weewx.units, 
that can be imported to do various conversions for you). At the end of the 
day the driver chooses what unit system to use in packets/records it emits, 
the driver does not check the database unit system.

Gary

On Sunday, 5 July 2020 20:32:51 UTC+10, flor...@pre-vost.fr wrote:
>
> My service that I created to see the code : 
> https://github.com/Drealine/WLLDriver/blob/master/bin/user/WLLArchive.py
> Le dimanche 5 juillet 2020 à 12:03:36 UTC+2, flor...@pre-vost.fr a écrit :
>
>> Hi,
>>
>> How can I pass values from a new service 
>> http://www.weewx.com/docs/customizing.htm#Adding_a_service ? 
>>
>> I would like to pass packet to Weewx Engine and not by using this method 
>> that I use at the moment : self.db_manager.addRecord(_packet_wl)
>>
>> At the moment, I need to convert sensors values relative to target_unit 
>> in weewx.conf. But I would like that Weewx do it itself. 
>>
>

-- 
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-development+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-development/beaf8b98-ec4e-4c26-a09e-f0eb9ea6171do%40googlegroups.com.

Reply via email to