I am trying to link two OH systems using MQTT and the new v2 MQTT binding.
Specifically I have items in the source system that have event trigger channels, for example when the paddle on a light switch is tapped it triggers a channel event “ON”.
I know how to link items to MQTT but how do I link a channel trigger to MQTT? Since there is no item definition, there is nowhere to link a channel trigger to a channel on an MQTT thing.
I know I could do this with rules but that would require creating a dummy item, linking the dummy to the MQTT channel then writing a rule to capture the channel trigger event, and command the dummy item. Messy and time consuming to set up.
Also, on the other end, the OH instance that will consume the MQTT events, I see how I can add an event trigger channel to a broker but this makes no sense to me since the event is clearly a ‘property’ of a specific thing.
For example, in addition to raising events when a paddle is pressed on a light switch, the light switch also reports it’s state linked to a standard item. On the consumer instance I set up a topic representing the light switch and add a channel to consume the status updates, but as far as I can see I cannot add an event trigger ‘type’ channel to this topic thing. Instead I would have to add all of these triggers to the base broker which will be very messy and fragments the channels that are all actually part of the same base thing.
How do I add an event trigger channel to an MQTT topic to avoid this mess?
So really two questions in one. Thanks in advance.
Log file output when publising hello world to topic “MQTTSwitch/Trigger”:
[vent.ChannelTriggeredEvent] - mqtt:topic:mqttBroker:mqttTest:mqttTrigger triggered hello world
@David_Graeff an innocent question: Looking at the documentation you linked, I was interested to see an example .things file showing how to add a ‘publishTrigger’ Type channel to a broker Bridge.
Having added a “trigger” channel to my topic thing I am left wondering why not allow the publishTrigger type as a channel type of a topic Thing?
Wouldn’t this remove the need for the “trigger” property?
Also, it would correctly render the channel as a channel-based trigger (grey icon, unlinkable) in Paper UI vs the current that shows as a standard (blue) ‘linkable’ channel but behaves like a channel-based trigger.
I ended up exactly the same place as @mcqwerty for a somewhat different use case. I am adding wall switches to my setup through zigbee2mqtt, and need the press on the wall switch to end up in a trigger channel.
It seems very strange that we can not handle trigger channels somehow more directly. @David_Graeff, please consider adding this in an upcoming version