Skip to content

Instantly share code, notes, and snippets.

@EmilZackrisson
Last active February 16, 2024 10:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save EmilZackrisson/29ee97c0994a066368328a47ed91eb36 to your computer and use it in GitHub Desktop.
Save EmilZackrisson/29ee97c0994a066368328a47ed91eb36 to your computer and use it in GitHub Desktop.
blueprint tutorial
blueprint:
name: ZHA - IKEA Styrbar 4 button custom commands
description: |
Choose what all four buttons will do.
domain: automation
input:
remote:
name: Remote
description: Choose the remote
selector:
device:
integration: zha
manufacturer: IKEA of Sweden
entity:
domain: sensor
device_class: battery
button_1_single_press:
name: "ON Button (Big Sun) Single Press"
description: Action to run on single press
default: []
selector:
action: {}
button_1_long_press:
name: "ON Buttun (Big Sun) Long Press"
description: Action to run on long press
default: []
selector:
action: {}
button_2_single_press:
name: "Button Right Single Press"
description: Action to run on single press
default: []
selector:
action: {}
# button_2_long_press:
# name: Button Right Long Press
# description: Action to run on long press
# default: []
# selector:
# action: {}
button_3_single_press:
name: "OFF Button (Small Sun) Single Press"
description: Action to run on single press
default: []
selector:
action: {}
button_3_long_press:
name: "OFF Button (Small Sun) Long Press"
description: Action to run on long press
default: []
selector:
action: {}
button_4_single_press:
name: Left Button Single Press
description: Action to run on single press
default: []
selector:
action: {}
# button_4_long_press:
# name: Left Button Long Press
# description: Action to run on long press
# 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 }}"
args: "{{ trigger.event.data.args }}"
- choose:
- conditions:
- "{{ command == 'on' }}"
sequence: !input "button_1_single_press"
- conditions:
- "{{ command == 'move_with_on_off' }}"
sequence: !input "button_1_long_press"
- conditions:
- "{{ args[0] == 256 }}"
sequence: !input "button_2_single_press"
# - conditions:
# - "{{ command == 'up_hold' }}"
# sequence: !input "button_2_long_press"
- conditions:
- "{{ command == 'off' }}"
sequence: !input "button_3_single_press"
- conditions:
- "{{ command == 'move' }}"
sequence: !input "button_3_long_press"
- conditions:
- "{{ args[0] == 257 }}"
sequence: !input "button_4_single_press"
# - conditions:
# - "{{ command == 'off_hold' }}"
# sequence: !input "button_4_long_press"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment