1f261ee8d2
* Replace multiple device-based automations with a single event-driven automation * Eliminate duplicate `unique_id` conflicts * Switch from device actions to service calls (`cover.open_cover`, `cover.close_cover`, `light.turn_on/off`) * Add support for: * Short press (button 1) → open garage * Long press (button 1) → close garage * Short press (button 4) → turn off all lights * Long press (button 4) → turn on all lights * Set `mode: restart` to improve responsiveness under rapid input * Simplify structure for easier maintenance and debugging Result: more stable and predictable Hue switch behavior
62 lines
1.8 KiB
YAML
62 lines
1.8 KiB
YAML
- id: hue_switch_garage_and_lights
|
|
alias: Hue switch - garage og lys
|
|
mode: restart
|
|
|
|
trigger:
|
|
- platform: event
|
|
event_type: hue_event
|
|
event_data:
|
|
id: 5f6b41e54f3226acd9c9ab54a3acb527
|
|
|
|
action:
|
|
- choose:
|
|
|
|
# --- GARAGE ---
|
|
|
|
# Kort tryk på knap 1 → Åbn garage
|
|
- conditions:
|
|
- condition: template
|
|
value_template: >
|
|
{{ trigger.event.data.type == 'initial_press'
|
|
and trigger.event.data.subtype == 1 }}
|
|
sequence:
|
|
- service: cover.open_cover
|
|
target:
|
|
entity_id: cover.anne
|
|
|
|
# Langt tryk på knap 1 → Luk garage
|
|
- conditions:
|
|
- condition: template
|
|
value_template: >
|
|
{{ trigger.event.data.type == 'long_press'
|
|
and trigger.event.data.subtype == 1 }}
|
|
sequence:
|
|
- service: cover.close_cover
|
|
target:
|
|
entity_id: cover.anne
|
|
|
|
|
|
# --- LYS ---
|
|
|
|
# Kort tryk på knap 4 → Sluk alt lys
|
|
- conditions:
|
|
- condition: template
|
|
value_template: >
|
|
{{ trigger.event.data.type == 'initial_press'
|
|
and trigger.event.data.subtype == 4 }}
|
|
sequence:
|
|
- service: light.turn_off
|
|
target:
|
|
entity_id: light.alle_lys
|
|
|
|
# Langt tryk på knap 4 → Tænd alt lys
|
|
- conditions:
|
|
- condition: template
|
|
value_template: >
|
|
{{ trigger.event.data.type == 'long_press'
|
|
and trigger.event.data.subtype == 4 }}
|
|
sequence:
|
|
- service: light.turn_on
|
|
target:
|
|
entity_id: light.alle_lys
|