Let me give it a try. It's a simple uploader. -tk
On Thu, Jun 25, 2020 at 6:21 AM flor...@pre-vost.fr <floren...@pre-vost.fr> wrote: > Hi Tom, > > Sorry, at the moment, I fix this issue. > When you want to make a request by using : requests.get("url") in > genLoopPacket(), Weewx is mistaken with this proper get function, I don't > know why but I fix this by declare Request = requests.session() > > Also, I want to know if it possible to have the daily rain max by using a > function in manager.py ? I see _read_metadata() or _get_day_summary() but I > don't know how to implement it. > > F. Prevost > > I see > > > Le mardi 23 juin 2020 à 15:43:26 UTC+2, Tom Keffer a écrit : > >> Florentin, you are being very vague about the error. You're showing no >> code, and you're not showing the error. "weewx confuse to internal get". I >> don't know what that means. >> >> >> >> >> >> On Mon, Jun 22, 2020 at 11:35 AM flor...@pre-vost.fr <flor...@pre-vost.fr> >> wrote: >> >>> Ok I found the problem, I use request to get json from URL but weewx >>> confuse to internal get. >>> >>> How can I pass this error ? >>> >>> Le lundi 22 juin 2020 à 19:26:46 UTC+2, flor...@pre-vost.fr a écrit : >>> >>>> Hi, >>>> >>>> Yeahh :) It work ahah ^^ Thank you for your answer. >>>> >>>> I try to implement genArchiveRecords(self,since_ts): but I've this >>>> error : >>>> >>>> >>>> 1. INFO weewx.engine: Main loop exiting. Shutting engine down. >>>> 2. Jun 22 19:19:32 debian weewx[1344] CRITICAL __main__: Caught >>>> unrecoverable exception: >>>> 3. Jun 22 19:19:32 debian weewx[1344] CRITICAL __main__: **** >>>> 'generator' object has no attribute 'get' >>>> 4. Jun 22 19:19:32 debian weewx[1344] CRITICAL __main__: **** >>>> Traceback (most recent call last): >>>> 5. Jun 22 19:19:32 debian weewx[1344] CRITICAL __main__: **** >>>> File "/usr/share/weewx/weewxd", line 154, in main >>>> 6. Jun 22 19:19:32 debian weewx[1344] CRITICAL __main__: **** >>>> engine.run() >>>> 7. Jun 22 19:19:32 debian weewx[1344] CRITICAL __main__: **** >>>> File "/usr/share/weewx/weewx/engine.py", line 158, in run >>>> 8. Jun 22 19:19:32 debian weewx[1344] CRITICAL __main__: **** >>>> self.dispatchEvent(weewx.Event(weewx.STARTUP)) >>>> 9. Jun 22 19:19:32 debian weewx[1344] CRITICAL __main__: **** >>>> File "/usr/share/weewx/weewx/engine.py", line 224, in dispatchEvent >>>> 10. Jun 22 19:19:32 debian weewx[1344] CRITICAL __main__: **** >>>> callback(event) >>>> 11. Jun 22 19:19:32 debian weewx[1344] CRITICAL __main__: **** >>>> File "/usr/share/weewx/weewx/engine.py", line 530, in startup >>>> 12. Jun 22 19:19:32 debian weewx[1344] CRITICAL __main__: **** >>>> self._catchup(self.engine.console.genStartupRecords) >>>> 13. Jun 22 19:19:32 debian weewx[1344] CRITICAL __main__: **** >>>> File "/usr/share/weewx/weewx/engine.py", line 639, in _catchup >>>> 14. Jun 22 19:19:32 debian weewx[1344] CRITICAL __main__: **** >>>> ts = record.get('dateTime') >>>> 15. Jun 22 19:19:32 debian weewx[1344] CRITICAL __main__: **** >>>> AttributeError: 'generator' object has no attribute 'get' >>>> 16. Jun 22 19:19:32 debian weewx[1344] CRITICAL __main__: **** >>>> Exiting. >>>> 17. Jun 22 19:20:30 debian systemd[1]: session-14.scope: Succeeded. >>>> >>>> >>>> I don't know why ? I import weewx.engine into my blabla.py >>>> >>>> Maybe I losted to implement other value or function ? >>>> Le lundi 22 juin 2020 à 14:08:03 UTC+2, Tom Keffer a écrit : >>>> >>>>> A driver is different from a service. The documentation you quoted is >>>>> for a *service*. You want the section *Porting to new hardware >>>>> <http://www.weewx.com/docs/customizing.htm#porting>*. >>>>> >>>>> Take a look at Vince's driver that you linked to in the first post of >>>>> this thread. On line 106 >>>>> <https://github.com/vinceskahan/weewx-weatherlinklive-json/blob/master/bin/user/WeatherLinkLiveJSON.py#L106>, >>>>> the configuration dictionary (argument config_dict) is passed into >>>>> the function loader(). It contains everything in weewx.conf. On the >>>>> next line, 107, just the substructure >>>>> config_dict['WeatherLinkLiveJSON'], which corresponds to the section >>>>> [WeatherLinkLiveJSON]in weewx.conf, is passed on to the class >>>>> WeatherLinkLiveJSONDriver. Nothing else. That's a typical pattern. >>>>> >>>>> -tk >>>>> >>>>> On Sun, Jun 21, 2020 at 11:25 PM Florentin Prevost < >>>>> flor...@pre-vost.fr> wrote: >>>>> >>>>>> 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> 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. >>>>>>>> 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-developm...@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 >>>>>> <https://groups.google.com/d/msgid/weewx-development/3a68298f-1115-4edf-bac0-b0890b132c7fo%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-developm...@googlegroups.com. >>> >> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/weewx-development/5b438db6-281a-456e-b8b2-9cf7d5dd7325n%40googlegroups.com >>> <https://groups.google.com/d/msgid/weewx-development/5b438db6-281a-456e-b8b2-9cf7d5dd7325n%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/df28d5b8-8d9e-4727-a9ce-b1d39f7cb8f8n%40googlegroups.com > <https://groups.google.com/d/msgid/weewx-development/df28d5b8-8d9e-4727-a9ce-b1d39f7cb8f8n%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/CAPq0zECQq2Y8%3Dsz-Fj36kmV9Qj6iqMro%2BGrOUmwqRky2HcqqnQ%40mail.gmail.com.