Hi all,
I’m having a hard time figuring out how to combine multiple triggers and actions into one automation.
I’m using Hue wall switches to activate my lights. They’re all added to Deconz. The Hue wall switches have 4 buttons, but each button generates multiple “event codes” based on short press, long press etc.
At this moment I’m having 4 automations for one Hue wall switch. One to turn on the lights, one to turn off the lights, one to dim the lights and one to brighten the lights. If I want to utilize the long press functions I need 8 automations per wall switch. That’s a lot, considering I’m having like 10 switches in my house.
I believe it’s possible to pass the event_data code from the deconz_event to an if-else action. I can use different if-else actions to decide which service to call. Can you help me figuring this out?
description: ""
mode: single
trigger:
- platform: event
event_type: deconz_event
event_data:
id: slaapkamer_switch
event: << Make this a variable >>
condition: []
action:
- if:
- condition: template
value_template: Variable == '1000'
then:
- service: light.turn_on
data: {}
- if:
- condition: template
value_template: Variable == '2000'
then:
- service: light.turn_off
data: {}
What I want to do is make a variable within the trigger from the event.event_data.event object, and use that to decide which action to activate. This way I can reduce my automations to one automation per switch instead of multiple.
Hue switch button codes:
1000 - On short press
1003 - On long press
2000 - Dim + short press
2003 - Dim + long press
3000 - Dim - short press
3003 - Dim - long press
4000 - Off short press
4003 - Off long press