Skip to content

Instantly share code, notes, and snippets.

@elyobelyob
Last active January 29, 2021 01:33
Show Gist options
  • Save elyobelyob/ab6e2b363d54eeee26f1c2d08c80d9ea to your computer and use it in GitHub Desktop.
Save elyobelyob/ab6e2b363d54eeee26f1c2d08c80d9ea to your computer and use it in GitHub Desktop.
IKEA Wireless Dimmer
blueprint:
name: ZHA - IKEA Tradfri Wireless Dimmer
description: |
"Control your light(s) with IKEA Tradfri wireless dimmer
Select the Tradfri remote and your lights.
domain: automation
input:
remote:
name: Remote
description: The remote that will control the lights
selector:
device:
integration: zha
manufacturer: 'IKEA of Sweden'
model: 'TRADFRI wireless dimmer'
light:
name: Light
description: The lights that will be controlled
selector:
target:
entity:
domain: light
mode: restart
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input 'remote'
action:
- variables:
command: "{{ trigger.event.data.command }}"
cluster_id: "{{ trigger.event.data.cluster_id }}"
endpoint_id: "{{ trigger.event.data.endpoint_id }}"
- choose:
- conditions:
- "{{ command == 'move_to_level_with_on_off' }}"
- "{{ cluster_id == 8 }}"
- "{{ endpoint_id == 1 }}"
sequence:
- service: light.turn_off
target: !input 'light'
data:
transition: 1
- conditions:
- "{{ command == 'move_with_on_off' }}"
- "{{ cluster_id == 8 }}"
- "{{ endpoint_id == 1 }}"
sequence:
repeat:
while:
- condition: template
value_template: "{{ repeat.index < 10 }}"
sequence:
- service: light.turn_on
target: !input 'light'
data:
transition: 1
brightness_step_pct: 10
- delay: 1
- conditions:
- "{{ command == 'move' }}"
- "{{ cluster_id == 8 }}"
- "{{ endpoint_id == 1 }}"
sequence:
repeat:
while:
- condition: template
value_template: "{{ repeat.index < 10 }}"
sequence:
- service: light.turn_on
target: !input 'light'
data:
transition: 1
brightness_step_pct: -10
- delay: 1
- conditions:
- "{{ command == 'stop' }}"
- "{{ cluster_id == 8 }}"
- "{{ endpoint_id == 1 }}"
sequence:
- service: light.turn_on
target: !input 'light'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment