[SOLVED] OpenHAB2 using MQTT Binding - receiving a published string on a subscribed topic

Not at all. This can be done using PaperUI. But I think we need more information.

First of all, that Channel you created on the MQTT Broker Thing cannot be linked to an Item. Instead it can be used to directly trigger a Rule. So your Rule will be triggered for ALL messages published to that topic, not just the one RfKey. Your rule doesn’t make clear whether you understand that or not.

Hmmmm. There might be a bug here. Did you define a separator character on the Channel?

image

I can confirm that that works.

Are you certain that receivedEvent is always null or is it the JSONPATH transformation that is returning null? Add logging to verify.

I would expect the JSONPATH to be $.RfReceived.RfKey (notice the dot between $ and Rf).

You can and I would argue should do this, but you will need to manually create a Generic MQTT Thing and separate Channels for each RfKey. Then use MQTT 2.5 M1+ How to implement the equivalent to MQTT1 REGEX filters so the Channel only processes the messages for one of the relays. Then you can link ordinary Switch Items to the individual Channels.

1 Like