-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[mqtt] Topics not subscribed after OpenHab 3.0 restart on generic MQTT Thing #9715
Comments
Update: I just had to restart again and this time I also got different errors in the log regarding the generic MQTT Thing:
|
Is there an update regarding this problem? |
I'm still having this issue with Openhab 3.0.2. I've now just added trace logging for "org.openhab.core.io.transport.mqtt" and found something interesting. It seems that when OpenHab is starting the mqtt binding is subscribing multiple times to the same topics. It also tries to unsubscribe topics. I guess this could be the cause for my problems because the first time it subscribes everything seem to work fine. Then on the second or third time I get error messages. Here is a full trace log from "org.openhab.core.io.transport.mqtt" when I start OpenHab:
|
This issue has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/oh3-mqtt-somtimes-issues-after-starting/113104/7 |
I did further analysis and I currently suspect that the availability topic of my devices could cause this problem. I have various homie and homeassistant things which all provide an availability topic to report if they are online or offline. This also changes the thing status in OpenHab. Using the even log I found out that some of the items do change multiple times between online, unknown and offline during the OpenHab startup and this seems to trigger an event that unsubscribes and subscribes all topics again. On my development computer this happens without any major problems, but on my Rasperry Pi I get error "NoSuchElementException" messages from the mqtt client after a few re-subscriptions. I guess this could be because the Raspberry Pi is much slower and has overall less resources than my development computer. Is there maybe a thread limit or other optimization setting that I could change to solve this problem? |
I think that #10566 might fix this. It has the title "Discovery services shall not unsubscribe unless they have already subscribed", but it also implements code such that "Discovery services shall not subscribe again if they they have already subscribed". @TheNetStriker on my system I don't see the problem that you describe, so I cannot test if my fix also fixes your problem. The only way to test it is for you to wait until my PR is merged into the OH official distribution, and then ask you test your situation once more with that respective new version of the binding. PS if you are not willing to wait for my PR to be merged into the OH official distribution, there is probably a way that I could let you test it sooner. It would require you to do the following (which is quite complex, so I would not recommend you to do it unless you are fully confident).
PS if you are willing to try it, the respective dependency files are here |
This issue has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/oh3-mqtt-somtimes-issues-after-starting/113104/15 |
This problem seems to be fixed with OpenHab 3.1. I'm closing this issue. |
Sometimes after a restart of OpenHab 3.0 the topics of one MQTT Things are not correctly subscribed. I can send MQTT commands out from OpenHab, but updates to the topics are not reflected to the items. When this happens I can always find a specific error in the OpenHab log which seems to be related to the HomeAssistant handler, but it affects a generic MQTT Thing. Before the update to OpenHab 3.0 I did not have this problem. I've also reported this in the community forum: https://community.openhab.org/t/oh3-mqtt-somtimes-issues-after-starting/113104
When I try to disable and re-enable the generic MQTT Thing in the UI I also get the error
java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
in the UI. My Things are configured via the UI and the Items with files. I have 13 MQTT Things and 2 brokers in total with a mix of Homeassistant, Homie and generic MQTT Things. The one that often fails after a restart also has a lot of channels. (69 in total) I've also created this issue about a different warning that I get after every start regarding an HomeAssistant (ESPHome) Thing.The only way to solve the problem at the moment is to restart OpenHab again, maybe even twice until the error in the log does not appear anymore. Below you can see the log and the Thing config of the generic Thing with a lot of channels.
OpenHab Log
Generic MQTT Thing config
Your Environment
OpenHab 3.0 running on Rasperry Pi 4 (OpenHabian)
I hope those infos are sufficient to analyze the problem.
The text was updated successfully, but these errors were encountered: