Closed FredericMa closed 7 years ago
Hi Frederic, I checked this behaviour on my environment (mosquitto-broker on another machine) and some of that problems I found.
That crash or stopping services you had I couldn't found on my environment. What I have done is stopping the mosquitto-broker and after that the errors are logged to the mqtt-client-logfile (topic not sendable). The mqtt-IF Client and also the Collgate-daemon are still running. After mqtt-broker restart the collected topics are send to the mqtt-broker and the system continuing it's work. Some more details are required (log-informations e.g.) to find that problems on your environment. Greetings, Norbert
Hi Norbert,
Sounds like a good idea. This also means that topics that are updated during the wait time will also be sent to the broker once connected?
I agree with you that an mqtt-broker should be online 24/7 but I run it on a server where I also have other stuff installed so now and then it needs a reboot for updates or changes. Since it my home environment I also don't really bother about 4/7 availability :-D What does "waiting for the network" actually means? I would think that it means that it waits until it has received an IP from the DHCP server so it can setup connections but this doesn't seem to be the case.
The crash only seems to occur during startup in case the broker is not available. If the broker goes offline during normal operation, the reconnect works fine. I see this in the mqtt-client logfile at startup:
18.08.2017 10:14:52 CRITICAL: cmqtt_baseclass.mqtt_init() broker not available:192.168.50.101; port:1883
18.08.2017 10:14:52 CRITICAL: mqtt_client_if() terminated!
and this in the collgate logfile:
18.08.2017 10:26:56 CRITICAL: ccollgate().run();Error;mqtt_client_if-thread terminated, see mqtt-logfile for details.
18.08.2017 10:26:56 CRITICAL: ccollgate().run();Error; terminated
18.08.2017 10:26:56 CRITICAL: cstore2db.run();Error; thread terminated unexpected
At this point there is no reconnect initiated anymore.
If the broker goes offline during normal operation and comes back online is see indeed that the program continues as expected:
18.08.2017 10:34:41 WARNING: cmqtt_client.publish_data() error occured; topic:heating/dhw_Tmeasured; mid:70
18.08.2017 10:34:41 WARNING: cmqtt_client.publish_data() error occured; topic:heating/dhw_Tcylinder; mid:71
18.08.2017 10:34:50 INFO: My CONNACK received with code:0.
I hope this is some useful information!
Thanks!
Greetings, Frederic
Hi Frederic,
Hi Norbert,
Thanks!
Greetings, Frederic
Hi Frederic,
Hi @norberts1 ,
First of all, thanks for the big update and all the improvements!
I have a suggestion; at the moment it looks like everything stops working once the MQTT broker goes offline. In my case, the broker is running on another server. In noticed that, when the broker goes offline, the application stops working, generates an error and doesn't reconnect to the broker.
I also noticed, and think, that there is a timing issue when connecting to the remote broker. When I restarted the raspberry pi, the software wasn't able to connect to the broker. Maybe because the network is not yet fully initialized? I've added a 10 second sleep (probably way to high) to the mqtt_init function in the mqtt_client_if.py file and this solved the issue.
Are there any plans to implement a reconnect to the broker in case of disconnection? I think it would also be good if the software submits all topics again to the broker after successfully reconnecting.
Greetings, Frederic