OH3: MQTT topic to an item / ECMA script

Hi community,

It would be great if someone could point me in the right direction. I am trying to get a MQTT topic to a item or into a ECMA rule so I can do stuff, managed to get stuck.

I have got the broker set up and the binding configured and I can see the below into the log.

2021-06-05 13:12:28.416 [INFO ] [openhab.event.ChannelTriggeredEvent ] - mqtt:systemBroker:openHab:test triggered 1
2021-06-05 13:16:37.244 [INFO ] [openhab.event.ChannelTriggeredEvent ] - mqtt:systemBroker:openHab:test triggered 0

Could someone show me how I could,

  • get the value into an item
  • use that value in an ECMA script

Kind Regards,

Example below for one of my items controlled via MQTT:


Channels and Item:

Example ECMA rule:

Hope those help you to build your setup.

Hi Chris,

Thanks for that! Much appreciated.
That should get me going.

Kind Regards,