Openhab2 can't read working MQTT Mosquitto


Is spend a few days now on finding out how to read out my topics on my mosquitto in openhab2.
Despite all the posts in this forum I can’t find out what I’m doing wrong. Mosquitto and Openhabian are running on the same Raspberry Pi V3.

The temperatures from my Arduino come in the broker.
mosquitto_sub -v -t ‘/home/woonkamer/temp/’

gives me

/home/woonkamer/temp/ 26.5

The MQTT Binding (binding-mqtt1 - 1.11.0) is installed, together with the Javascript Transformation (transformation-javascript - 2.2.0)

Here are my openhab2 files:


URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:o883


Optional. Client id (max 23 chars) to use when connecting to the broker.

If not provided a random default is generated.


items/mqtt.items (also without the JS transformation (mosquitto:home/keuken/temp:state:default) it doesn’t work)

Number Temperatuur_Keuken “Temperatuur [%.1f °C]” { mqtt="<[mosquitto:home/keuken/temp:state:JS(number.js)]" }
Number Temperatuur_Living “Temperatuur [%.1f °C]” { mqqt="<[mosquitto:home/woonkamer/temp:state:JS(number.js)]" }


result = input.trim();


sitemap cvovolt label=“Demo Arduino” {
Frame label=“Temperatuur keuken” {
Text item=Temperatuur_Keuken
Frame label=“Temperatuur living” {
Text item=Temperatuur_Living

I hope someone can help me, because I did every suggestion on the forum allready, without success :frowning:

Thanks a lot!


If it is coming in with a leading slash, you need to use that in your config:

Number Temperatuur_Living "Temperatuur [%.1f °C]" { mqtt="<[mosquitto:/home/woonkamer/temp:state:default:]" }

Also note a typo: mqtt, not mqqt

Thanks a lot sihui, you are my hero! I tried that allready but it gave no result, now it does. So probably it was in combination with another configuration switch I made. But now everything works fine!!

Thanks again!!


1 Like