Switch using two MQTT topics for on or off in OH3

i have a sonoff rf bridge flashed with tasmota. The lights to be switched have two separate rf codes to be sent (One for on, another for off).

I have two mqtt topics to be used for switching lights on and off and after banging my head for hours now i could not solve this.

The topics are
ON: indoor/rfbridge/cmnd/rfkey1
OFF: indoor/rfbridge/cmnd/rfkey2

is there a solution to have a switch in openhab use this two topics “under the hood” but present only one single switch (toggle switch) at the ui?



You’ll need to create a Design Pattern: Proxy Item and a rule. Instead of creating two separate Items, one for ON and one for OFF, I’d use the publishMQTT Action in the rule to publish the message to the right topic based on whether the command was ON or OFF.

1 Like

Nice, that seems to be a good solution. Thanks! Could you point me where i can create a proxy item which can be used in rules and scripts ? In OH2 i would have created a new proxy item in a .item file. In OH3 this will be possible from the UI?

Go to Settings → Items and click the blue + icon.

Tried that, but a created item without channel to a binding seems not be available in rules and scripts?

An Item is an Item. Whether it’s linked to no Channels or 100 Channels is completely invisible to Rules. All it sees is the Item. If the Item is listed among the others in Settings → Items then it exists and is available like any other Item.

Thanks! Didn’t recognize, that you can not only use the 4 main categories for actions in Rules. Tried to work with “Item Action” and could not find my proxy item in the list presented.

Show more did the trick … Works like a charm now!!

There is a check box to show Items that are not a part of the model.