OpenHAB2 MQTT Temperature Item

Hello there,
i just started with OpenHAB2 and got some problems creating an Temperature Item to display temperature published by MQTT.

Mosquitto MQTT Binding to OpenHAB seems to work, because i could receive MQTT Data with mqttFX.

My mqtt.cfg looks like this:

Define your MQTT broker connections here for use in the MQTT Binding or

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


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

If not provided a default one is generated.


and my MQTT messages from the Sensor look like this:
mygateway1-out/2/0/1/0/1 60.0
mygateway1-out/2/1/1/0/0 24.0
mygateway1-out/2/0/1/0/1 62.0
mygateway1-out/2/1/1/0/0 25.0

Here is my problem… I dont realy know how to merge this to an working temperature Item:
I think it should look somethig like this…?

Number temperature “temp [%.1f]” {mqtt=”<mosquito:mygateway1-out/2/1/1/0/0"}

Thank you for your Help! :slight_smile:

Please have a look at this page:

What you need is described under the section named “Item Configuration for Inbound Messages”, or you could skip directly to the first line under the section called “Example Inbound Configurations”, where the following example is given:

Number temperature "temp [%.1f]" {mqtt="<[publicweatherservice:london-city/temperature:state:default]"}

You need to replace “publicweatherservice” with the name of your MQTT broker (i.e. “mosquitto”) and “london-city/temperature” with your MQTT topic (i.e. "mygateway1-out/2/1/1/0/0) and you should be all set.


Hi, i have the same problem:

I want to receive mqtt from my esp8266.

When i enter this into a linux bash, i get the following answer from the esp:

sudo mosquitto_sub -v -u mqttuser -P mqttpassword -t 'esprfid'

esprfid {"type":"access","time":1542734830,"isKnown":"true","access":"Always","username":"schwarz","uid":"12361353"}

I´m reading out rfid tags from a rfid reader.

But what do i have to enter into my item?

This isn´t working:

String rfid1 "RFID Test [%s]" {mqtt="<[mosquitto:esprfid]"}

I think, the esp8266 (rfid-reader) is sending many topics and i only catch the whole string with my bash-command?

(Name of my broker is mosquitto, in my esp8266 i set up “esprfid” as topic)

I also tried this today, but with no luck:

String rfid1 "RFID Test [%s]" {mqtt="<[mosquitto:/esprfid/uid:string:#]"}

What MQTT binding do you use?

I use mqtt1.

And with this line in my items file which gives me the whole mqtt string. Then i take the needed variables out of the whole string with a rule inside openhab:

String rfid_all_haustuer      "RFID HaustĂĽr komplett [%s]"      (gMapDB)      {mqtt="<[mosquitto:esprfid:state:default]"}