Skip to content

Instantly share code, notes, and snippets.

@pavax
Created February 22, 2021 13:36
Show Gist options
  • Save pavax/32581f0d4ed860264159df1d79d8c849 to your computer and use it in GitHub Desktop.
Save pavax/32581f0d4ed860264159df1d79d8c849 to your computer and use it in GitHub Desktop.
blueprint:
name: Ikea on/off-switch and 5-Button Toggle
description: Custom Blueprint for Ikea Remote Controls (On/Off, TRADFRI remote control) x
domain: automation
input:
remote:
name: Remote
description: IKEA remote to use
selector:
entity:
integration: mqtt
domain: sensor
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: {}
on_button_long:
name: On button long
description: Action to run when ON button LONG pressed (brightness up)
default: []
selector:
action: {}
off_button_long:
name: Off button long
description: Action to run when OFF button LONG pressed (brightness down)
default: []
selector:
action: {}
toggle:
name: Toggle
description: Action to run when Toggle Button pressed
default: []
selector:
action: {}
source_url: https://community.home-assistant.io/t/zigbee2mqtt-ikea-on-off-switch-general-use/263895
mode: restart
max_exceeded: silent
trigger:
- platform: state
entity_id: !input 'remote'
attribute: action
variables:
command: '{{ trigger.to_state.state }}'
condition:
- condition: template
value_template: "{{ command != ''}}"
action:
- choose:
- conditions:
- '{{ command == ''on'' }}'
sequence: !input 'on_button_short'
- conditions:
- '{{ command == ''off'' }}'
sequence: !input 'off_button_short'
- conditions:
- '{{ command == ''brightness_move_up'' }}'
sequence: !input 'on_button_long'
- conditions:
- '{{ command == ''brightness_move_down'' }}'
sequence: !input 'off_button_long'
- conditions:
- '{{ command == ''toggle'' }}'
sequence: !input 'toggle'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment