[Solved] MQTT-Binding (OpenHAB 2.5.6) - No data received by binding after activating user/password


I am running OpenHAB 2.5.6 in a docker container on my NAS. Additionally I have a Mosquitto v1.6.10 MQTT server running as well in a docker container … I have setup the MQTT binding successfully without user/password to get the data from the MQTT server into OpenHAB and everything worked well.

Now I have activated user/password authentication for better security and no data is being received by the binding anymore. I can see that the MQTT server is working correctly as I can subscribe with user/password from an MQTT client running on my PC and seeing that the data is published by the server and received by the MQTT client.

Furthermore I can see from the mosquitto.log that the MQTT binding sucessfully connects with user and password to the mosquitto server:

1598639604: New client connected from <docker_ip_address> as MY_CLIENT_ID (p2, c1, k60, u 'my_user').
1598639637: New connection from <docker_ip_address> on port 1883.

I would assume that turning on debugging might be a good idea to see where the problem is. But I don’t know how? And I would also kindly appreciate your ideas how to debug and solve the problem.


Find below my config and log files:

Output of openhab> bundle:list for the MQTT binding:

247 │ Active │  80 │ 2.5.8                   │ openHAB Add-ons :: Bundles :: MQTT Broker Binding
248 │ Active │  81 │ 2.5.8                   │ openHAB Add-ons :: Bundles :: MQTT Things and Channels
249 │ Active │  82 │ 2.5.8                   │ openHAB Add-ons :: Bundles :: MQTT HomeAssistant Convention
250 │ Active │  82 │ 2.5.8                   │ openHAB Add-ons :: Bundles :: MQTT Homie Convention

My things file:

Bridge mqtt:broker:mySecureBroker [ host="aaa.bbb.ccc.ddd", port=1883, secure=false, clientID="MY_CLIENT_ID", qos=1, username="my_user", password="my_password" ]
    Thing topic room1 {
        Type number : temperature "Temperatur" [ stateTopic="esp/bme280/temperature", qos=1]
        Type number : humidity "Luftfeuchte" [ stateTopic="esp/bme280/humidity", qos=1 ]
        Type number : pressure "Luftdruck" [ stateTopic="esp/bme280/pressure", qos=1 ]

My items file:

Group gESP8266 // Gruppe für alle ESP8266 items

Number:Temperature   ESP8266GHtemp "Temperatur [%.1f %unit%]" (gESP8266) { channel="mqtt:topic:room1:temperature" }
Number:Dimensionless ESP8266GHhumi "Luftfeuchte [%d %%]" (gESP8266)  { channel="mqtt:topic:room1:humidity" }
Number:Pressure      ESP8266GHpres "Luftdruck [%.0f hPa ]" (gESP8266)  { channel="mqtt:topic:room1:pressure" }

Here are the appropriate outputs from karaf log:

20:30:30.716 [INFO ] [o.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to 'aaa.bbb.ccc.ddd' with clientid MY_CLIENT_ID
20:30:31.252 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'mqtt:broker:mySecureBroker' changed from OFFLINE to ONLINE
20:30:31.267 [INFO ] [smarthome.event.ThingUpdatedEvent    ] - Thing 'mqtt:broker:mySecureBroker' has been updated.
20:30:42.747 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'mqtt:topic:mySecureBroker:room1' changed from UNINITIALIZED to INITIALIZING
20:30:42.904 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'mqtt:topic:mySecureBroker:room1' changed from INITIALIZING to ONLINE
20:30:52.242 [INFO ] [smarthome.event.ExtensionEvent       ] - Extension 'binding-mqtt' has been installed.

… and a bit later …

20:35:17.749 [INFO ] [thome.event.ItemChannelLinkAddedEvent] - Link 'ESP8266GHtemp-mqtt:topic:room1:temperature' has been added.
20:35:17.749 [INFO ] [thome.event.ItemChannelLinkAddedEvent] - Link 'ESP8266GHhumi-mqtt:topic:room1:humidity' has been added.
20:35:17.750 [INFO ] [thome.event.ItemChannelLinkAddedEvent] - Link 'ESP8266GHpres-mqtt:topic:room1:pressure' has been added.

But no data is received by the items …

STUPID ME!!! :partying_face:

When I changed from “myUnsecureBroker” to “mySecureBroker” I obvisously did not correct the string in the channel of my items file but I accidently removed it :flushed:

Now I changed it back
from channel="mqtt:topic:room1:temperature"
to channel="mqtt:topic:mySecureBroker:room1:temperature"

And it works again!!!

Number:Temperature   ESP8266GHtemp "Temperatur [%.1f %unit%]" (gESP8266,gTempWD) { channel="mqtt:topic:mySecureBroker:room1:temperature" }
Number:Dimensionless ESP8266GHhumi "Luftfeuchte [%d %%]" (gESP8266)  { channel="mqtt:topic:mySecureBroker:room1:humidity" }
Number:Pressure      ESP8266GHpres "Luftdruck [%.0f %unit%]" (gESP8266)  { channel="mqtt:topic:mySecureBroker:room1:pressure" }

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.