Thanks @falkena!
The pulse thing enabled me to replace this:
// things
Thing digital Outputs [ kind="Q" ]
Thing memory VB0_2 [ block="VB0.2" ]
// items
Switch Relay3 "Relay#3" (LOGO1) { channel="plclogo:digital:PLC01:Outputs:Q4" }
Switch PLC01_NI2 "PLC01_NI2" (LOGO1) { channel="plclogo:memory:PLC01:VB0_2:state" }
Switch VButton2 "VButton2" (LOGO1)
// rules
rule "forward VButton2 command to logo NI"
when
Item VButton2 received command
then
// short pulse
sendCommand(PLC01_NI2, ON)
sendCommand(PLC01_NI2, OFF)
end
rule "update VButton2 from logo relay"
when
Item Relay3 received update
then
postUpdate(VButton2, Relay3.state)
end
with this:
// things
Thing digital Outputs [ kind="Q" ]
Thing pulse VB0_1 [ block="VB0.1", pulse=100 ]
// items
Switch Relay1 "Relay#1" (LOGO1) { channel="plclogo:digital:PLC01:Outputs:Q2" }
Switch PLC01_NI1 "PLC01_NI1" (LOGO1) { channel="plclogo:pulse:PLC01:VB0_1:state" }
// rules
rule "forward Relay1 command to logo NI1"
when
Item Relay1 received command
then
sendCommand(PLC01_NI1, ON) // short pulse
end
to make my light switches work as I expect (physical click on the wall and virtual click in habpanel).
Best Regards and happy new year to you too!
Jacek
PS. I know that the base version was overcomplicated but still… the pulse thing made me re-think this and get a simpler solution.