Skip to content

Instantly share code, notes, and snippets.

@DarkCoder28
Last active March 31, 2025 00:54
Show Gist options
  • Save DarkCoder28/f0e5ee651deb72978bd3d6ede07a2472 to your computer and use it in GitHub Desktop.
Save DarkCoder28/f0e5ee651deb72978bd3d6ede07a2472 to your computer and use it in GitHub Desktop.
Allow for actions to be set for each button action available to the STYRBAR remote. Short and Long Press for each button.
blueprint:
name: IKEA STYRBAR Dimmer Remote Action Buttons
description:
"Allow for actions to be set for each button action available to the STYRBAR remote. Short and Long Press for each button.\n\n Blueprint:\t Version: 1"
domain: automation
input:
remote:
name: IKEA STYRBAR
description: Pick an IKEA STYRBAR remote
selector:
device:
integration: zha
manufacturer: IKEA of Sweden
model: Remote Control N2
multiple: false
up_short_press:
name: Up (Short press)
description: Action to run on up, short press
default: []
selector:
action: {}
up_long_press:
name: Up (Long press)
description: Action to run on up, long press
default: []
selector:
action: {}
up_long_press_term:
name: Up (Long press Termination)
description: Action to run on up, long press termination
default: []
selector:
action: {}
down_short_press:
name: Down (Short press)
description: Action to run on down, short press
default: []
selector:
action: {}
down_long_press:
name: Down (Long press)
description: Action to run on down, long press
default: []
selector:
action: {}
down_long_press_term:
name: Down (Long press Termination)
description: Action to run on down, long press termination
default: []
selector:
action: {}
left_short_press:
name: Left (Short press)
description: Action to run on left, short press
default: []
selector:
action: {}
left_long_press:
name: Left (Long press)
description: Action to run on long, short press
default: []
selector:
action: {}
left_long_press_term:
name: Left (Long press Termination)
description: Action to run on left, long press termination
default: []
selector:
action: {}
right_short_press:
name: Right (Short press)
description: Action to run on Right, short press
default: []
selector:
action: {}
right_long_press:
name: Right (Long press)
description: Action to run on Right, long press
default: []
selector:
action: {}
right_long_press_term:
name: Right (Long press Termination)
description: Action to run on right, long press termination
default: []
selector:
action: {}
source_url: https://gist.github.com/DarkCoder28/f0e5ee651deb72978bd3d6ede07a2472
mode: restart
max_exceeded: silent
#variables:
# remote: !input remote
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 }}"
lr_button: "{{ 'left' if trigger.event.data.params.param1 == 257 else 'right' if trigger.event.data.params.param1 == 256 else 'undefined' }}"
- choose:
#
# Up
#
- conditions:
- condition: template
value_template: "{{ True if (command == 'on' and cluster_id == 6 and endpoint_id == 1) else False }}"
sequence: !input up_short_press
- conditions:
- condition: template
value_template: "{{ True if (command == 'move_with_on_off' and cluster_id == 8 and endpoint_id == 1) else False }}"
sequence: !input up_long_press
- conditions:
- condition: template
value_template: "{{ True if (command == 'stop_with_on_off' and cluster_id == 8 and endpoint_id == 1) else False }}"
sequence: !input up_long_press_term
#
# Down
#
- conditions:
- condition: template
value_template: "{{ True if (command == 'off' and cluster_id == 6 and endpoint_id == 1) else False }}"
sequence: !input down_short_press
- conditions:
- condition: template
value_template: "{{ True if (command == 'move' and cluster_id == 8 and endpoint_id == 1) else False }}"
sequence: !input down_long_press
- conditions:
- condition: template
value_template: "{{ True if (command == 'stop' and cluster_id == 8 and endpoint_id == 1) else False }}"
sequence: !input down_long_press_term
#
# Left
#
- conditions:
- condition: template
value_template: "{{ True if (command == 'press' and cluster_id == 5 and endpoint_id == 1 and lr_button == 'left') else False }}"
sequence: !input left_short_press
# Long Press is unstable for left... I can't figure it out... any ideas, let me know :)
# - conditions:
# - condition: template
# value_template: "{{ True if ((command == 'on' or command == 'recall' or command == 'hold' or command == 'release') and cluster_id == 5 and endpoint_id == 1 and lr_button == 'left') else False }}"
# sequence: !input left_long_press
# Long Press Terminate is unstable for left... I can't figure it out... any ideas, let me know :)
# - condition: template
# - conditions:
# value_template: "{{ True if (command == 'release' and cluster_id == 5 and endpoint_id == 1 and lr_button == 'left') else False }}"
# sequence: !input left_long_press_term
#
# Right
#
- conditions:
- condition: template
value_template: "{{ True if (command == 'press' and cluster_id == 5 and endpoint_id == 1 and lr_button == 'right') else False }}"
sequence: !input right_short_press
# Long Press is unstable for right... I can't figure it out... any ideas, let me know :)
# - conditions:
# - condition: template
# value_template: "{{ True if ((command == 'on' or command == 'recall' or command == 'hold' or command == 'release') and cluster_id == 5 and endpoint_id == 1 and lr_button == 'right') else False }}"
# sequence: !input right_long_press
# Long Press Terminate is unstable for right... I can't figure it out... any ideas, let me know :)
# - conditions:
# - condition: template
# value_template: "{{ True if (command == 'release' and cluster_id == 5 and endpoint_id == 1 and lr_button == 'right') else False }}"
# sequence: !input right_long_press_term
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment