[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.
https://imgur.com/a/1j4ASBF
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