Hi All,

I modified slightly the code and uploaded it on my github here (as no 
recent news from Bill)

https://github.com/bonjour81/ESP8266-MQTT-WEEWX/blob/master/wxMesh.py

Bill, I hope it's no offence, I just wanted to put my modifications 
somewhere. 


Modifications are the following:
add loop_stop() for mqtt, as we launch a background thread for mqtt 
reception with loop_start(), it must be ended somewhere.
without it, I noticed some activity in mosquitto logs even when weewx was 
stopped.

I also move a bit the receive_buffer clear earlier, to make sure we dont 
loose any mqtt data during packet processing.  it's not clear for me if 
could happen before, but I like to have my "data" dict "frozen" during the 
packet construction.





Matthew, I have a big question for better understanding of how weewx deals 
with drivers !

There is an infinite loop in the driver (while true:).

So my understanding is that weewx launch the driver as a kind of background 
thread that output packet with that yield command ?
So it's just never go out of the while true loop as long as weewx run.

Then in case of weewx stop, weewx will force exit this infinite loop and 
launch the "close_port()" procedure ?

I may use wrong wording, but I hope my idea is clear, let me know if not :-)



by the way, if my understanding is correct, does it mean I shall check 
regularly if mqtt connexion is still valid and reconnect if needed ?  
The connexion is in the __init__ then, if disconnected for any reason, we 
cannot recover, am I right ?







Reply via email to