I want to control 2 groups of lights with one switch (button) (VMB8PBU).
If I press it long, the PRESSED event comes first and afterwards the LONG_PRESSED. This way, both my lights go on. I solved it now with a Boolean, but I wonder if there is an easier or better solution.
(I know I can set it up in the Velbuslink software and setup a virtual switch for the long press there, but then I’ll have to configure it at 2 places).
The rule now (which works):
var Boolean ButtonLong=false
rule "Test short press"
when
Channel 'velbus:vmb8pbu:c41d4dfc2f:18:input#CH3' triggered PRESSED
then
// Group 10 is switched at release
ButtonLong=false
end
rule "Test long press"
when
Channel 'velbus:vmb8pbu:c41d4dfc2f:18:input#CH3' triggered LONG_PRESSED
then
WelkLicht.sendCommand("8")
CommandGroepLicht_Running.sendCommand(ON) // Groep 8
ButtonLong=true
end
rule "Test release"
when
Channel 'velbus:vmb8pbu:c41d4dfc2f:18:input#CH3' triggered RELEASED
then
if (ButtonLong==false){
WelkLicht.sendCommand("10")
CommandGroepLicht_Running.sendCommand(ON) // Groep 10
}
ButtonLong=false
end