energywave

Deconz 4 keys ikea remote automation - for Mazzurco

Dec 30th, 2021 (edited)
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 2.14 KB | None | 0 0
  1. automation:
  2.  # Telecomando Ikea 4 tasti con Deconz (per Massimiliano Mazzurco)
  3.   # Implementati solo tasto su, giù e pressione/rilascio su/giù per dimming
  4.   # Usare la stessa tecnica per gestire i tasti destra/sinistra/pressione/rilascio
  5.   - id: 12c75001-291f-41db-8b56-978143118402
  6.     alias: 'Gestione telecomando Ikea'
  7.     mode: restart
  8.     trigger:
  9.       - platform: event
  10.         event_type: deconz_event
  11.         event_data:
  12.           unique_id: 'cc:86:xx:xx:xx:xx:xx:xx'
  13.     action:
  14.       - variables:
  15.           command: "{{ trigger.event.data.event }}"
  16.           light_dest: light.tua_luce
  17.       - choose:
  18.          # ON
  19.           - conditions: "{{ command == '1002' }}"
  20.             sequence:
  21.               - service: light.turn_on
  22.                 target:
  23.                   entity_id: "{{ light_dest }}"
  24.           # OFF
  25.           - conditions: "{{ command == '2002' }}"
  26.             sequence:
  27.               - service: light.turn_off
  28.                 target:
  29.                   entity_id: "{{ light_dest }}"
  30.           # Luminosità up hold (aumenta luminosità)
  31.           - conditions: "{{ command == '1001' }}"
  32.             sequence:
  33.               repeat:
  34.                 while: "{{ repeat.index <= 10 }}"
  35.                 sequence:
  36.                 - service: light.turn_on
  37.                   target:
  38.                     entity_id: "{{ light_dest }}"
  39.                   data:
  40.                     brightness_step_pct: 10
  41.                 - delay: 1
  42.           # Luminosità down hold (diminuisce luminosità)
  43.           - conditions: "{{ command == '2001' }}"
  44.             sequence:
  45.               repeat:
  46.                 while: "{{ repeat.index <= 10 }}"
  47.                 sequence:
  48.                 - service: light.turn_on
  49.                   target:
  50.                     entity_id: "{{ light_dest }}"
  51.                   data:
  52.                     brightness_step_pct: -10
  53.                 - delay: 1
  54.           # Rilascio luminosità up/down
  55.           - conditions: "{{ command == '1003' or command == '2003' }}"
  56.             sequence:
  57.             - service: light.turn_on
  58.               target:
  59.                 entity_id: "{{ light_dest }}"
  60.  
Add Comment
Please, Sign In to add comment