OH3, MQTT and textual item definitions?

Hi there,

Quick question, I’ve upgraded to OH3 and I wonder how to migrate my MQTT based items.

MQTT is defined in conf/services/mqtt.cfg and the items are defined with the “{mqtt=”<[…" syntax.

How would I set this up in OH3? If I add a bridge thing for the broker, can I reference it (such as ‘mqtt’ above) in the text definitions?

Thank you very much!

Here is a direct link to the guide written for the OH2 version of the MQTT Binding, which is the same as OH3. It explains how to convert from the OH1 binding which is what you’re currently using.

In general you will need to create:

  1. A Bridge Thing to connect to your MQTT broker
  2. A device Thing, referencing your Bridge Thing
  3. Channels within your Device Thing to connect to certain parameters of your device (temperature, humidity, switch etc)
  4. An Item linked to a Thing Channel

But check the link - it should help.

1 Like

Thanks a lot, that helped!

If you want to do it in the UI on OH3, this is how:


UID: mqtt:broker:52ed0d78e0
label: MQTT Broker
thingTypeUID: mqtt:broker
  lwtQos: 0
  publickeypin: true
  keepAlive: 60
  clientid: xxx
  secure: false
  certificatepin: true
  password: xxx
  qos: 0
  reconnectTime: 60000
  lwtRetain: true
  username: openhab
  enableDiscovery: true


UID: mqtt:topic:52ed0d78e0:kitchenlight
label: Kitchen Light
thingTypeUID: mqtt:topic
  payloadNotAvailable: Offline
  availabilityTopic: tele/kitchenlight/LWT
  payloadAvailable: Online
bridgeUID: mqtt:broker:52ed0d78e0
location: Kitchen
  - id: Power
    channelTypeUID: mqtt:switch
    label: Power
    description: null
      commandTopic: cmnd/kitchenlight/POWER
      stateTopic: stat/kitchenlight/POWER
      off: OFF
      on: ON
  - id: rssi
    channelTypeUID: mqtt:number
    label: WiFi Signal Strength
    description: null
      stateTopic: tele/kitchenlight/STATE
      transformationPattern: JSONPATH:$.Wifi.RSSI

(I can’t show the item, since there doesn’t seem to be a way to see or edit the code representation of an item in the OH3 UI (unless you are willing to dig into jsondb), which is something that annoys me.)

1 Like

You’re not the only one.