Skip to content

Instantly share code, notes, and snippets.

@FHeilmann
Last active December 18, 2020 10:11
Show Gist options
  • Save FHeilmann/1347e38ea5fc0039cfcdb7d54e504b17 to your computer and use it in GitHub Desktop.
Save FHeilmann/1347e38ea5fc0039cfcdb7d54e504b17 to your computer and use it in GitHub Desktop.
blueprint:
name: Z2M - IKEA five button remote for lights - modified
description: 'Control lights with an IKEA five button remote (the round ones).
The middle "on" button, toggle the lights on/off to the last set brightness
(unless the force brightness is toggled on in the blueprint).
Dim up/down buttons will change the brightness smoothly and can be pressed
and hold until the brightness is satisfactory.
The "left" and "right" buttons can be assigned to a short and long button
press action. This allows you to assign, e.g., a scene or anything else.
'
domain: automation
input:
remote:
name: Remote
description: IKEA remote to use
selector:
entity:
domain: sensor
button_center:
name: Center button action
description: Action to run on short center button press
default: []
selector:
action: {}
button_up:
name: Up button action
description: Action to run on short up button press
default: []
selector:
action: {}
button_down:
name: Down button action
description: Action to run on short down button press
default: []
selector:
action: {}
button_left:
name: Left button action
description: Action to run on short left button press
default: []
selector:
action: {}
button_right:
name: Right button action
description: Action to run on short right button press
default: []
selector:
action: {}
source_url: https://gist.github.com/FHeilmann/1347e38ea5fc0039cfcdb7d54e504b17
mode: restart
max_exceeded: silent
trigger:
- platform: state
entity_id: !input 'remote'
attribute: action
action:
- variables:
command: '{{ trigger.to_state.state }}'
- choose:
- conditions:
- '{{ command == ''toggle'' }}'
sequence: !input 'button_center'
- conditions:
- '{{ command == ''brightness_up_click'' }}'
sequence: !input 'button_up'
- conditions:
- '{{ command == ''brightness_up_hold'' }}'
sequence:
- repeat:
until:
- condition: state
entity_id: !input 'remote'
state: brightness_up_release
attribute: action
sequence: !input 'button_up'
- conditions:
- '{{ command == ''brightness_down_click'' }}'
sequence: !input 'button_down'
- conditions:
- '{{ command == ''brightness_down_hold'' }}'
sequence:
- repeat:
until:
- condition: state
entity_id: !input 'remote'
state: brightness_down_release
attribute: action
sequence: !input 'button_down'
- conditions:
- '{{ command == ''arrow_left_click'' }}'
sequence: !input 'button_left'
- conditions:
- '{{ command == ''arrow_left_hold'' }}'
sequence:
- repeat:
until:
- condition: state
entity_id: !input 'remote'
state: arrow_left_release
attribute: action
sequence: !input 'button_left'
- conditions:
- '{{ command == ''arrow_right_click'' }}'
sequence: !input 'button_right'
- conditions:
- '{{ command == ''arrow_right_hold'' }}'
sequence:
- repeat:
until:
- condition: state
entity_id: !input 'remote'
state: arrow_right_release
attribute: action
sequence: !input 'button_right'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment