-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reconnect to MQTT broker if connection is lost #166
Comments
Please provide the config and full debug log. Actually MQTT reconnect is already in place. It's performed by the underlying |
How can I generate the debug log? By config you mean the deye docker container config, right? |
Set
Yes |
OK, here goes - this is my docker compose config:
I'll attach the log. It seems it tries to publish when the broker is stopped and fails. Judging by the log it even reeastablishes the connection to the broker, but for some reason does not publish anymore. |
Reconnecting worked. Look at the bottom of the log.
|
Yes, I saw that. But before losing connection to the broker the log looked like this when successfully publishing:
...continuing with all the other metrics. But after it reestablishes the connection to the broker, it stops after
and does not continue. Next log entry should have been
followed by the readings from the inverter. That never happens though, no matter if I wait one minute or ten minutes. Checking the topics, there really is nothing published to the broker. Only restarting the deye-mqtt container will make it publish to the broker again. So I guess this does not happen to you if you stop your MQTT broker until the error shows up in the logs and start the broker again? For you publishing resumes as it should without needing to restart the deye-mqtt container? |
My educated guess is that it could be a thread locking issue, that I mistakenly introduced when adding multi-inverter support. Could you test this beta version? |
Thanks, this seems to work fine:
It fails to publish twice because the MQTT broker was offline at that time, but when MQTT came back up it continued publishing. Thank you for the investigation! I'll keep using the Beta for now. |
It seems that there currently is no reconnect mechanism in place if the connection to MQTT broker is lost for whatever reason.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Connection retries should be attempted at regular intervals.
Actual behaviour
Error
Unknown MQTT publishing error: Message publish failed: The client is not currently connected.
is seen in the logs and no reconnection attempt is made.Software (please complete the following information):
The text was updated successfully, but these errors were encountered: