Hi, Thank you. I stuck just into passed config_dict.
How can I pass this value into my driver ? In documentation, he say that create class like this : class MyAlarm(StdService): """Service that sends email if an arbitrary expression evaluates true""" def __init__(self, engine, config_dict): Thank's Le lundi 22 juin 2020 00:16:03 UTC+2, Tom Keffer a écrit : > > Yes, it's possible to access anything in the dictionary. For example, the > name of the database used by the binding wx_binding would be given by > > config_dict['Databases']['wx_binding']['database'] > > > However, it is rarely necessary to do this. Better to use the functions in > manager.py to simply open up the database you need. For example, > > db = manager.open_manager_with_config(config_dict, 'wx_binding') > > > would return a database Manager object for the wx_binding. > > See the section *Programming interface > <http://www.weewx.com/docs/customizing.htm#Programming_interface>* in the > Customizing Guide. > > -tk > > On Sun, Jun 21, 2020 at 2:21 PM Florentin Prevost <flor...@pre-vost.fr > <javascript:>> wrote: > >> Thank you very well for your answer :) >> >> For the first question, sorry, I wanted to say that if it possible to >> pass argument that is not in stanza [myWlink] for example. Because I've set >> the same parameter for sql database if you know what i mean. >> >> >> Le dimanche 21 juin 2020 20:58:58 UTC+2, Tom Keffer a écrit : >>> >>> Make sure you read the section *Porting to new hardware >>> <http://www.weewx.com/docs/customizing.htm#porting>* in the Customizing >>> Guide. It answers some of your questions. >>> >>> 1. The full configuration information is available as the first argument >>> to your driver loader() function as a dictionary. However, in general, >>> you should try to keep your driver as modular as possible, and not pick and >>> choose information from all over the dictionary. Best practice is to have >>> your driver depend on information in its private stanza. For example, if >>> your driver is named mywlnk.py, it should have a stanza >>> >>> [MyWlink] >>> >>> and look there for all its information. But, there are many exceptions >>> to this best practice. >>> >>> 2. The function genArchiveRecords() is a *generator function*. If you >>> don't know what that is, see the section *Generators >>> <https://wiki.python.org/moin/Generators>* in the Python documentation. >>> It takes one argument: a timestamp with the last time in the database. Your >>> function should return all archive records since that time, using a yield >>> statement. It will be called at startup and at the end of each archive >>> interval. However, exactly when should not be your concern --- that's the >>> engine's job. >>> >>> -tk >>> >>> On Sun, Jun 21, 2020 at 10:18 AM Florentin Prevost <flor...@pre-vost.fr> >>> wrote: >>> >>>> Hi, >>>> >>>> I worked with the fork of >>>> https://github.com/vinceskahan/weewx-weatherlinklive-json and I would >>>> like to ask some questions about driver developpment. >>>> >>>> - How can I passed argument of weewx.conf to my driver ? I work to >>>> request lost data from Weewx on Weatherlink.com because WeatherLink Live >>>> don't have API to take archive directly and I would like to passed some >>>> arguments like archive_interval, sql password & etc >>>> - How work genArchiveRecords when it call? It run as each report ? Or >>>> it is a loop that waiting to have return values ? >>>> >>>> >>>> Thank you for your answer and support. >>>> >>>> -- >>>> 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-de...@googlegroups.com. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/weewx-development/d04b1fde-25c3-476d-b885-8d45b682976ao%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/weewx-development/d04b1fde-25c3-476d-b885-8d45b682976ao%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- >> 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-de...@googlegroups.com <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/weewx-development/d524dd2b-0369-42ee-b5e5-73194a97fce1o%40googlegroups.com >> >> <https://groups.google.com/d/msgid/weewx-development/d524dd2b-0369-42ee-b5e5-73194a97fce1o%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- 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/3a68298f-1115-4edf-bac0-b0890b132c7fo%40googlegroups.com.