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 <[email protected]>
> 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 <[email protected]>
>>> 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 <
>>>>> [email protected]> 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 [email protected].
>>>>>> 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 [email protected].
>>>> 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 [email protected].
>> 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/weewx-development/93d69e63-e20a-49d3-a2f3-7761436c3c52n%40googlegroups.com.