Hello everybody,
There is issue and maybe an improvement that could be done in the driver
but I'm not sure to understand correctly.
My understanding is that:
def __init__(self, **stn_dict): is executed at weewx start
while :
def genLoopPackets(self): is executed at each packet lookp
The issue is that the mqtt connect is only in __init__ therefore, if weewx
gets disconnected from mqtt (ex: if I restart mosquitto), weewx stops
receiving packets.
would it make sense to add at the beginning of def genLoopPackets(self):
something like (NOT PYTHON, just principle example)
if not(self.client.isConnected())
then
self.client.subscribe(self.topic, qos=0)
self.client.connect(self.host, 1883, 60)
or maybe it could be used only .reconnect() ?
Here is the driver link for reference:
https://github.com/bonjour81/station_meteo/blob/master/weewx/driver/wxMesh.py
Le mardi 14 janvier 2020 21:48:03 UTC+1, Ralph Underwood a écrit :
>
> I am using WeeWx 4.0.0.b8 (latest development version) and I copied
> MQTTSubscribe from your GitHub. I did not install via wee_extension.
>
> My plan was to replace my standalone python program which subscribes to
> MQTT and writes a file for the filepile.py extension. I converted it to
> Python3 so with WeeWx 4 I will be all Python3. That has worked fine on one
> of my stations, however my program does not have a queue and only handles
> one MQTT message and I want to add more MQTT sensors to the stations. I
> have a separate development station that I am working with to get
> MQTTSubscribe working. I am going to start over with a clean installation
> and use wee-extension to install MQTTSubscribe.
>
> It's snowing here in Seattle, so I should have some time to experiment.
>
> I will start a new thread to report success or ask for help - I didn't
> notice that there were 5 pages on this thread before I asked about running
> as a service.
>
>
>
> On Tuesday, January 14, 2020 at 12:02:43 PM UTC-8, Rich Bell wrote:
>>
>> Ralph,
>> What version of WeeWX and MQTTSubscribe? Did you install via
>> wee_extension? If you post a copy of your config (making sure to remove any
>> sensitive information), I’d be happy to take a look.
>> We should probably move this out of the wxMesh thread...
>> Rich
>>
>>
>>
--
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/9633cb2b-1249-4391-9a73-e9f4e55650d1%40googlegroups.com.