Hello,
I have the following rules set up on all my dimmer switches:
rule "<NAME> Dimmer Switch"
when
Channel "hue:0820:<BRIDGE>:<sensorId>:dimmer_switch_event" triggered
then
switch(receivedEvent.getEvent()) {
case "1001.0": {
<NAME>_lights.sendCommand("0,0,100")
// Button 1 press and hold - white 100%
}
case "1002.0": {
<NAME>_lights.sendCommand("ON")
// Button 1 press - return to previous colour
}
case "2001.0": {
<NAME>_lights.sendCommand("100")
// Button 2 press and hold - previous colour but 100% brightness
}
case "2002.0": {
<NAME>_lights.sendCommand("INCREASE")
// Button 2 press - Increase brightness
}
case "3001.0": {
<NAME>_lights.sendCommand("1")
// Button 3 press and hold - previous colour minimum brightness
}
case "3002.0": {
<NAME>_lights.sendCommand("DECREASE")
// Button 3 press - Decrease brightness
}
case "4001.0": {
<NAME>_lights.sendCommand("OFF")
// Button 4 press and hold - OFF
}
case "4002.0": {
<NAME>_lights.sendCommand("OFF")
// Button 4 press - OFF
}
}
end
Hopefully other beginners may find this example useful!
I would like to improve things and add the functions I have lost by resetting the switches in the Hue app as well as adding new tricks
So my questions are:
Is there a way to make this rule work for all my switches without repeating it for each switch?
Also, is it possible to handle multiple button presses in order to perform different action each time a button is pressed, For example, switch colour each time 1002 is triggered?
Thanks