-
Notifications
You must be signed in to change notification settings - Fork 24
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
Not connecting to MQTT in 1.2 #53
Comments
The mqtt host you have configured doesn’t appear to be the one it’s trying to connect to. Looks like a race condition, 1.2 calls connect_async so there is no guarantee that it will actually be connected to the mqtt server before the sensors are initialized and the publish topic function is called. If you trigger a sensor does it give the same error message or is the message actually published successfully? |
Hi @daveonkels. There were quite a few changes in 1.2, particularly around handling non-existant configs, or updating existing ones with new features. Also tried to fix number of MQTT connection issues, but I noted that using Paho's easy config might not cut it, and might need to switch to a commented out version that I left in place in case issues persist. I do know that to @AK5nowman's point, there is an expected race condition on startup where publishes are queued before the connection may be completed. Paho automatically handles queuing of messages when the connection is down, but as soon as it is completed the messages should go through. You will however see some publish errors early on, but then should see the messages send later in the log file. Can you confirm if you are seeing something like that? If not, it would be helpful to change the logging level to DEBUG for the file handler in your logging.yaml file, start things up, wait a few minutes, then reset logging back to INFO, or whatever value you have been using. Seeing the more complete startup log may help us diagnose and see if we can work around your issue. |
This seems to occur because the MQTT client has not connected yet when it publishes the entities. I changed
|
Seeing same issue on my end. Applying @TechIsCool fix above fixed the issue, now I can see the entities in HA Log before:
Log after:
|
I sometimes do have this issue, but as @raetha points out, it seems that |
I've been running 1.1 for several months without a hiccup. For some reason 1.2 isn't able to connect to my MQTT server. The logs were strangely devoid of useful information. Before I dig deeper, was there any change to the config file format that I'm missing? I've included sample configs below.
config.yaml
sensors.yaml
log excerpt
The text was updated successfully, but these errors were encountered: