On Thursday, January 25, 2018 at 8:59:11 AM UTC-5, Bill Morrow wrote:
>
>     The loop handler essentially populates a data[] array? It could be 
> very similar to the driver's genLoopPackets() method, which populates 
> _packet.  Or should the service also populate _packet? I looked at some 
> other drivers - they use "packet" as a data sink. No underscore. I think 
> I'm missing something.
>

a driver creates a new dict in the genLoopPackets generator.  the driver 
specifies whatever usUnits it wants, but the observations that go into a 
packet must be consistent with that usUnits.

a service may add items or modify items in an existing dict.  this is done 
in whatever method is bound to NEW_LOOP_PACKET or NEW_ARCHIVE_RECORD 
events, and the actual dict is in event.packet or event.record, 
respectively.  beware that the service must respect the usUnits in the 
packet/record!

 

> - the service would read config from weewx.conf the same as the driver 
> does?
>

correct
 

> - create the service installer install.py
>

this is ill-defined.  the extension installer does not know how to handle a 
python module that can be either a service or a driver.

for drivers, the process is to use wee_extension to install the driver, 
then wee_config to choose that newly installed driver.

for services, wee_extension does everything (as long as install.py has the 
default configuration and the correct Engine->Service items)

so for an extension that can be either driver or service, the safe thing to 
do is to put the default conf stanzas in install.py, but do not put any 
service entries in install.py (the lines that enable a service).  that way 
the extension installs, but is not activated until the user either (1) 
enables it as a driver (using wee_config or manual edit of weewx.conf) or 
(2) enables it as a service (by manually modifying the Engine->Services 
section of weewx.conf)

m

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to