Last active
February 1, 2021 22:05
-
-
Save sle118/1ddfc397cd1c1ade7db4c489acbd230a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: ZHA - IKEA Tradfri on/off switch - flexible | |
description: | | |
"Control your light(s) with IKEA Tradfri on/off switch | |
Select the Tradfri remote and your lights. | |
You can turn the lights On / Off, or hold the buttons to dim the 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 on/off switch' | |
light: | |
name: Light | |
description: The lights that will be controlled for dim up/down | |
selector: | |
target: | |
entity: | |
domain: light | |
on_button_short: | |
name: On button short | |
description: Action to run when ON button SHORT press | |
default: [] | |
selector: | |
action: {} | |
off_button_short: | |
name: Off button short | |
description: Action to run when OFF button SHORT pressed | |
default: [] | |
selector: | |
action: {} | |
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: | |
- '{{ endpoint_id == 1 }}' | |
- '{{ cluster_id == 6 }}' | |
- '{{ command == ''on'' }}' | |
sequence: !input 'on_button_short' | |
- conditions: | |
- '{{ endpoint_id == 1 }}' | |
- '{{ cluster_id == 6 }}' | |
- '{{ command == ''off'' }}' | |
sequence: !input 'off_button_short' | |
- 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: 5 | |
- delay: 0.5 | |
- 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: -5 | |
- delay: 0.5 | |
- 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