Item with input and output channel: propagate state change from outpost to MQTT


in the course of implementing my other post (dockerized outpost setup for legacy bindings) I created the following dummy setup:

  1. OH3 main instance with an OH2.5 outpost
  2. the outpost has a dummy switch item
  3. that dummy switch is mirrored to an item on the main instance (via the remote binding)
  4. the switch’s state should be published to an MQTT topic (that publishing should happen exclusively from the main instance, so that the outpost handles exclusively the legacy binding)

Basically, it works: Toggling the switch on the outpost propagates the state to the main instance and vice versa. However, publishing to MQTT works only if i toggle the switch on the main instance. Toggling the state on the outpost does not publish to MQTT.

This is the switch item configuration on the main instance:

Switch outpost_test_switch "outpost test switch" <light> (gGroup) ["Light"] {

So it seems that the state change coming through the input channel (remote binding) is not ‘propagated’ to the output channel (MQTT).

Is there some configuration that will do this ‘propagation’? Will I have to implement some rule or profile to do the ‘propagation’? Are there other ways?

Thank you for taking the time to consider and respond! :slight_smile:


Yes, that’s how it is supposed to work.
The general openHAB model with bindings is that external data received results in linked Item state updates. Item commands are processed to generate external messages.

So an Item state change or update whether from rules or external events will not get sent out on MQTT, only commands (to the channel commandTopic, unsurprisingly).
(When clicking on OH UI, that generates commands, so it just appears to “work” without awareness of what’s going on behind.)

What you need for your use case here is some kind of cheat, that pretends an Item update is a command and passes it to the MQTT channel as a command, so triggering the normal message.
That’s exactly what the follow profile does.

Take care that you do not set up loops when using this tool, e.g. in MQTT case you probably want to listen and send on different topics.

1 Like

Hi @rossko57,

and many thanks for being a good guide :slight_smile: Your pointers took me to (just) adding the follow profile to one channel in my configuration:

Switch outpost_test_switch "outpost test switch" <light> (gGroup) ["Light"] {

Now, as intended, state gets propagated back and forth between outpost and main instance, and no matter from where the state change is initiated an MQTT message is published from the main instance.

Thanks again!