I’m having really hard time using hassio with MQTT. Messages are being published by devices to the bus but hassio itself doesn’t seem to register them in any way.
hassio 0.93.2 /RPi (reproduced on VIrtualBox VM)
using MQTT Server & Web client 1.10 (switched from official Mosquitto in search of a solution of this same problem)
example setup in configuration.yaml:
- platform: mqtt
I can manually publish to the topic via HiveMQ/CLI and I see the message in the MQTT add-on logs:
1559235433: Sending PUBLISH to hassio-mqtt-client (d0, q0, r0, m0, ‘/some/light/switch’, … (3 bytes))
1559235438: Sending PUBACK to auto-6F8FA606-C03D-D8BC-2897-DE92CCA98F36 (m1575, rc0)
However there’s no trace of acknowledgement in hassio - the light stays off, other mqtt entities also don’t work. Nor does the dev-mqtt publish service.
Any help would be greatly appreciated!
First, you should format properly the code to understand it better.
See point 11 here
This is the only mqtt sensor that is not working?
Try to use an MQTT client connected to the HA MQTT broker to check if you see the message you’re sending from HiveMQ
Sorry for the sloppy formatting. Let me try to elaborate.
I do have other devices that are sending messages to the broker (but tried to limit the post to a simple example).
Messages are successfully pushed (so not an ACL issue) and I can subscribe to the topics via i.e. HiveMQ or mosquitto_sub (so not a device->broker issue) which is basically what you’ve suggested and I can see all messages.
I have tried mosquitto add-on and then the mosquitto+client add-on (so multiple brokers).
How is defined the mqtt broker in the configuration.yaml?
Hopefully I am understanding your question. I am using the hassio mqtt broker. Here is an example of one of my working config.yaml mqtt subscribe code:
- platform: mqtt
Hope this helps
I’m not using an mqtt broker definition in configuration.yaml. I’m using the integration functionality which is working without obvious errors and is generating a valid (AFAICT) entry in /config/.storage/core.config_entries:
This entry gets updated, deleted and recreated when I modify the broker integration
Given that everything is fine from the MQTT side, what kind of light is this?
Can you subscribe also to
Can you turn it on from an MQTT client? And what is the message you receive when you turn it ON?
the example I’ve shown is a dummy entity I created in order to eliminate the possibility that the error is in the device itself. so not connected to a light, although I do have some lights I can experiment with.
In reality I’m using i.e. an alarm panel and some 10-odd PIRs that successfully push messages to the to broker on the topics I configure for them.
My problem is I can see the messages by subscribing to the topic, I can see the messages in the broker logs (pls see the original post) but the entities defined in HA are not triggered. Even the dev-mqtt service doesn’t seem to be working, so its definitely an issue in HA.
can you show the message in the broker, removing sensitive data, if any?
This is the first time I see the integration functionality for MQTT, my fault.
Where do you “define” this integration?
I would like to test it with a cloudMQTT instance I have for test purpose.
The configuration you provided:
- platform: mqtt
state_topic so it cannot receive anything.
command_topic to publish commands to the broker, not to receive commands from the broker (that’s the responsibility of
This doesn’t have anything to do with your problem at hand, but it is poor practice to start a topic with
Integrations are done via the HA GUI (Configuration->Integrations, then MQTT from the long list). Once you do that an entry gets created in /config/.storage/core.config_entries. You can browse your file using the Configurator add-on, just look for the .storage folder.
As for the mqtt message in the broker here’s an example
2019-05-31 16:42:46Topic: /some/light/switchQos: 1Retained OFF
note taken. state_topic added and topic changed:
- platform: mqtt
Then trying to push ON via HiveMQ.
2019-05-31 16:51:45 Topic: some/light/state Qos: 0 ON
… and add-on logs show:
1559310704: Sending PUBLISH to hassio-mqtt-client (d0, q0, r0, m0, ‘some/light/state’, … (2 bytes))
so still no go
light is written ligth in the state topic
ok so I’m definitely not doing a good job of setting up this example
however, typo changed, still nothing
so, let me recap.
you have some mqtt entity that are working in HA and some that are not working.
is it right?
if yes, what is the main difference between them?
none of my mqtt entries are working. no matter if I create from scratch or copy/paste from somebody’s ‘prooven working’ example
Do you see anything strange in the MQTT addon log after re-starting?
Why don’t you save configuration and remove the MQTT integration ad try to define it in the configuration.yaml ?
my configuration is like this (the broker is exactly like this for the addon you have, that is also my addon)
username: !secret mqtt_user
password: !secret mqtt_pwd
Thanks, adding the mqtt: configuration to configuration.yaml seems to fix things for the dummy light.
I have a lovelace light card setup for it and now it changes icons depending of the ON/OFF msg I sent to the broker.
Now I’ll be off to fixing my other entities
Don’t be so hard on yourself. It still serves as an excellent example of everything that prevents it from working:
- No MQTT configuration to connect Home Assistant to the broker.
state_topic to receive messages from the broker.
- Wrong topic name to receive messages.
Had you also used invalid quotation characters it would have been an even better example of everything that can prevent it working.