Publish data to openhab-problem

Hi! I’m new here and I have problem with publishing data to openhab.

I’m using NodeMCU, temperature and humidity sensors and want to publish temperature and humidity to openhab but it doesn’t work.

Here is part of arduino code:

client.publish(“mySensor/temp”, shttChar);
client.publish(“mySensor/hum”, hChar);

This is Item:

Group All

Number Office_temperature “Temperature [%.1f °C]” {mqtt="<[broker:mySensor/temp:state:default]"}
Number Office_humidity “Humidity [%.1f]” {mqtt="<[broker:mySensor/hum:state:default]"}


sitemap demo label=“Main Menu”
Frame label=“MQTT” {
Text item=Office_temperature
Text item=Office_humidity

Probably is some stupid mistake but I can’t find it, so I would appreciate if anybody could help.

Your items definition looks fine, does your broker work?

I tested it with mosquitto_sub -v -t ‘test/topic’ and mosquitto_pub -t ‘test/topic’ -m ‘helloWorld’ and everything seems fine. Don’t know what else could be problem. This is how my openhab looks like:

So, nothing is published and it should be…

Your broker seems to work (internally) and your mqtt definitions look fine.
So the only thing what could be missing: make sure your lua script publishes to the broker …

also, post your /etc/openhab2/services/mqtt.cfg to check it


this is my mqtt.cfg, I think it’s fine. Is there any other document I need to change?

here is messages from logs:

2017-05-01 00:49:46.385 [ERROR] [t.mqtt.internal.MqttBrokerConnection] - MQTT connection to ‘broker’ was lost: Connection lost : ReasonCode 32109 : Cause : null
2017-05-01 00:49:46.385 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting connection helper to periodically try restore connection to broker 'broker’
2017-05-01 00:49:56.389 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'broker’
2017-05-01 00:50:05.251 [ERROR] [t.mqtt.internal.MqttBrokerConnection] - MQTT connection to broker was lost

Do you have more than one client with the same id connected? See

Okay, how to check if this is the problem and how to fix it?