Skip to content

Instantly share code, notes, and snippets.

@OddF
Created December 8, 2022 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OddF/273158a73fe61c206474ff8d09fea88e to your computer and use it in GitHub Desktop.
Save OddF/273158a73fe61c206474ff8d09fea88e to your computer and use it in GitHub Desktop.
blueprint:
name: ZHA - IKEA wireless on/off switch
description: Control anything using IKEA wireless on/off switch
domain: automation
input:
remote:
name: Remote
description: IKEA wireless on/off switch to use
selector:
device:
integration: zha
manufacturer: IKEA of Sweden
model: TRADFRI on/off switch
button_on_short:
name: On button press
description: Action to run on press of On button
default: []
selector:
action:
button_off_short:
name: Off button press
description: Action to run on press of Off button
default: []
selector:
action:
button_on_long:
name: On button hold
description: Action to run on long press of On button
default: []
selector:
action:
button_off_long:
name: Off button hold
description: Action to run on long press of Off button
default: []
selector:
action:
mode: restart
max_exceeded: silent
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 }}"
args: "{{ trigger.event.data.args }}"
- choose:
- conditions:
- "{{ command == 'on' }}"
sequence: !input button_on_short
- conditions:
- "{{ command == 'off' }}"
sequence: !input button_off_short
- conditions:
- "{{ command == 'move_with_on_off' }}"
sequence: !input button_on_long
- conditions:
- "{{ command == 'move' }}"
sequence: !input button_off_long
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment