Odd Mosquitto / Hassio behaviour

So using mosquitto broker, with logging enabled and the rtl4332mqtt add-on and all is working fine.

Example Home Assistant log output:
2018-02-08 16:45:58 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on home/rtl433/oil: {"time" : "2018-02-08 16:38:26", "model" : "Oil Ultrasonic STANDARD", "id" : 21663, "flags" : 96, "alarm" : 0, "binding_countdown" : 0, "depth_cm" : 41}

Publishing messages via the MQTT developer tool front-end is all fine, and messages are logged as above.

However, if I use mosquitto_pub on the command line, the connection is established, debug suggests everything is transmitted ok:

mosquitto_pub -h 192.168.1.10 -u homeassistant -P XXX -i Manual1 -t /home/rtl433/oil -d -m test
Client Manual1 sending CONNECT
Client Manual1 received CONNACK
Client Manual1 sending PUBLISH (d0, q0, r0, m1, '/home/rtl433/oil', ... (26 bytes))
Client Manual1 sending DISCONNECT

The add-on in hassio (Mosquitto broker) log shows the debug suggesting all received ok.

1518108238: New client connected from 172.30.32.1 as Manual1 (c1, k60, u'homeassistant').
1518108238: Client Manual1 disconnected.

But the message does not appear to get any further…ie no message shown in the Home Assistant log. It is as if mosquitto broker is receiving fine but not passing it onto home assistant for some reason.

Any suggestions?

is not the same as

Missing initial '/`

Well the leading ‘/’ was the problem!

When the topic has a leading ‘/’ that was causing Home Assistant to ignore the message entirely. Removing the leading / and all is now working fine with any topic name used.

Thanks for the quick reply!

1 Like