Files
N22/include/automations/bryggerbutton.yaml
T
claus 1f261ee8d2 Refactor Home Assistant Hue switch automations to use hue_event for improved reliability
* 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
2026-03-17 16:22:35 +01:00

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