Hi
Did you ever find a solution to this issue?
I would like to be able to use Channel trigger data in NodeRed flows too.
Something like this
Channel 'velbus:vmbgpod:d212bf44:2C:input#CH1' triggered
or Channel 'velbus:vmbgpod:d212bf44:2C:input#CH2' triggered
or Channel 'velbus:vmbgpod:d212bf44:2C:input#CH3' triggered
or Channel 'velbus:vmbgpod:d212bf44:2C:input#CH4' triggered
Where the possible states are
RELEASED
PRESSED
LONG_PRESSED
The only thing I can think of so far is to create a blanket DSL rule that maps the state of these triggers to Virtual Items in openHAB2.
Using this thread as inspiration… - Passing receivedEvent and triggeringItem as parameters to a lambda: which type to use? - #3 by shutterfreak
I created this rule, which I might be able to use to map events to virtual items
rule "Button Event mapper"
when
Channel 'velbus:vmbgpod:d212bf44:2C:input#CH1' triggered
or Channel 'velbus:vmbgpod:d212bf44:2C:input#CH2' triggered
or Channel 'velbus:vmbgpod:d212bf44:2C:input#CH3' triggered
or Channel 'velbus:vmbgpod:d212bf44:2C:input#CH4' triggered
then
// receivedEvent.channel.toString // Full 'channel' that triggered the event
// receivedEvent.channel.thingUID.toString // Thing ID portion of channel (everything before the last ':')
// receivedEvent.channel.id.toString // ID portion of channel (everything after the last ':')
logInfo("Button Event","This button "+receivedEvent.channel.toString.replace(":","_").replace("#","_")+" -- Had this Event "+receivedEvent.getEvent())
sendCommand(receivedEvent.channel.toString.replace(":","_").replace("#","_"),receivedEvent.getEvent())
end