[SOLVED] NAN when linking Item to Generic MQTT Thing

Hi I am a bloody beginner with openhab and hope that my silly question does not bother you too much.

I am using Openhab 2.4 on a Raspberry Pi.
A ESP8266 is sending temperature values to the mosquitto broker embedded on the Pi (Channel /esp8266_station123/out)

I have connected the 2.4 Mqtt Binding to the mosquitto server and it is online according to the paperui.

Under the generic MQTT Thing i linked the thing to the broker and generated a new channel. I linked the state topic of the channel to the “esp8266_station123/out” Channel.

Finally i linked this new Channel to a new Item.

Now, when i click in the control tab, i can see the new item. But its value is NAN

I checkt the esp8266_station123/out-Channel via MQTT.fx and i can see that the Esp is sending numbers, so here everything is fine and i quess it is a wrong setting in the PaperUI.

I wasted(?) my complete evening on this topic, and couldn’t find a solution. Maybe you guys can help me.

Desperate Regards,
Arne

I don’t think I’ve seen a NAN or NaN. Not that I use control tab much, but feels like a clue. An invalid Item state would normally come up NULL or UNDEF. Formatting issue?

May we see your Item definition?
What does events.log tell you about that Item?
Any clues in openhab.log?

What firmware are you using with the esp device?

Hi… here is the Openhab log , the one from http://openhabianpi:9001 (events.log?) relevant for mqtt things after start up:

Blockquote

2019-02-10 08:39:04.400 [.ItemChannelLinkAddedEvent] - Link ‘GenericMQTTThing_Temperature-mqtt:topic:48450fd7:temperature’ has been added.

2019-02-10 08:39:04.410 [.ItemChannelLinkAddedEvent] - Link ‘ESP_Temperature-mqtt:topic:48450fd7:test’ has been added.

2019-02-10 08:39:04.969 [hingStatusInfoChangedEvent] - ‘mqtt:topic:48450fd7’ changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)

==> /var/log/openhab2/openhab.log <==

2019-02-10 08:39:06.294 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at http://192.168.0.132:8080

2019-02-10 08:39:06.299 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at https://192.168.0.132:8443

2019-02-10 08:39:07.112 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui

==> /var/log/openhab2/events.log <==

2019-02-10 08:39:07.656 [hingStatusInfoChangedEvent] - ‘mqtt:broker:1ce33688’ changed from UNINITIALIZED to INITIALIZING

2019-02-10 08:39:07.987 [hingStatusInfoChangedEvent] - ‘mqtt:broker:1ce33688’ changed from INITIALIZING to OFFLINE

2019-02-10 08:39:08.076 [hingStatusInfoChangedEvent] - ‘mqtt:topic:48450fd7’ changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING

2019-02-10 08:39:08.175 [hingStatusInfoChangedEvent] - ‘mqtt:topic:48450fd7’ changed from INITIALIZING to OFFLINE (BRIDGE_OFFLINE)

==> /var/log/openhab2/openhab.log <==

2019-02-10 08:39:08.215 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to ‘localhost’ with clientid paho69695361643 and file store ‘/var/lib/openhab2/mqtt/localhost’

==> /var/log/openhab2/events.log <==

2019-02-10 08:39:08.378 [hingStatusInfoChangedEvent] - ‘mqtt:broker:1ce33688’ changed from OFFLINE to ONLINE

2019-02-10 08:39:08.419 [me.event.ThingUpdatedEvent] - Thing ‘mqtt:broker:1ce33688’ has been updated.

2019-02-10 08:39:08.437 [hingStatusInfoChangedEvent] - ‘mqtt:topic:48450fd7’ changed from OFFLINE (BRIDGE_OFFLINE) to ONLINE

Blockquote

In the openhab.log there is just this line mentioned:

2019-02-10 08:39:08.215 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to ‘localhost’ with clientid paho69695361643 and file store ‘/var/lib/openhab2/mqtt/localhost’

The Esp is a ESP12 using the following moduls:
NodeMCU custom build by frightanic.com
modules: dht,file,gpio,mqtt,net,node,tmr,uart,wifi

Where can i find the config file of the generic mqtt thing?
Here are two screenshots.


Do i need to make a transformation of the MQTT Value?

That depends, what is the mqtt payload? EXACTLY?

Your state topic is wrong:

There is a leading /

Your state topic in your MQTT thing is esp8266_station123/out without the leading /

So your either remove the leading / from the ESP code (BEST PRACTICE). Leading / are not recommended even though it still works because they lead to errors (Just like yours…)
Or you add a leading / to your state topic in your MQTT thing

1 Like

THANK YOU very much, it was the leading / in the esp code…

I am so glad that you found my error (or to say, the error from the tutorial which i used).

Thank you, thank you!

You are welcome,
Please like and tick the solution mark on the post. Thanks