I am using DeCONZ and a few Busch-Jaeger ZigBee switches. For the “dim up” button the switch emits the following events (like many other ZigBee switches):
2001: HOLD
2002: SHORT_RELEASED
2003: LONG_RELEASED
So I’d like to smoothly dim the lights up while the button is kept pressed. The tricky thing is that when pressing the button, only one single 2001 event is fired and when releasing the button one 2003 event is fired. What’s the best way to create an automation which dims up a light on 2001 until 2003 is reached?
My current solution consists of one script and two automations. The script dims up the light in 10% steps with a couple of delays in between the steps. The script is started by an automation which is triggered on 2001. Another automation which is triggered by 2003 stops the script. These are the automations:
This is working but it is super bulky. The script itself is reusable for other lights, as it accepts the light as an argument. But I’d still like to do this with one single automation? I mean this is a pretty common task (run something until an event comes in), so I guess there must be a cleaner approach.
Right now I need 4 automations for changing the brightness of one light
Hi. Thanks for the suggestion. This is what I was looking for. It’s actually quite simple but apparently I was not creative enough to come up with a solution like this
I found an even simper solution which is made possible by Home Assistant’s recent automation mode feature. This gives me dim-up and dim-down all within one automation:
Note the mode=restart, which causes a running “Kitchen Ambient Dimmer” automation to stop on any other incoming event from that switch. So I don’t need to handle the PRESS_RELEASE events any more, it’s enough to catch them in the trigger (catchall for the switch). This is super awesome!
@direx I know I’m 10 months late to the party, but any chance you could share your increase_brightness and decrease_brightness scripts? I’m in the exact same boat as you and this would immediately solve my problem. Thanks!