Instantly share code, notes, and snippets.
Last active
May 17, 2025 18:55
-
Star
0
(0)
You must be signed in to star a gist -
Fork
0
(0)
You must be signed in to fork a gist
-
Save niklaszerozero/b7ba16eb18beb5bcc0d0a5ca2523ba01 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mode: single | |
max_exceeded: silent | |
blueprint: | |
name: IKEA SOMRIG Button | |
description: " | |
Trigger Actions Using an IKEA SOMRIG Shortcut Button (like the E2213). | |
This blueprint supports event entities and therefore is compatible with Zigbee2MQTT 2.0.0. | |
**Version**: 0.0.1 | |
" | |
source_url: https://gist.github.com/niklaszerozero/b7ba16eb18beb5bcc0d0a5ca2523ba01 | |
domain: automation | |
input: | |
switch_entity: | |
name: "Action Entity" | |
description: "The button's action entity that will trigger this automation." | |
default: "" | |
selector: | |
entity: | |
filter: | |
- domain: event | |
multiple: false | |
helper_hold_delay: | |
name: "Helper - Hold delay" | |
description: "The delay between executions of the corresponding hold actions." | |
default: 250 | |
selector: | |
number: | |
unit_of_measurement: milliseconds | |
min: 100.0 | |
max: 5000.0 | |
step: 10.0 | |
mode: slider | |
action_single_dot_single_press: | |
name: "Single Dot - Single press action" | |
description: "The action that should be executed when the button with a single dot is pressed once." | |
default: [] | |
selector: | |
action: | |
action_single_dot_double_press: | |
name: "Single Dot - Double press action" | |
description: "The action that should be executed when the button with a single dot is pressed twice." | |
default: [] | |
selector: | |
action: | |
action_single_dot_hold: | |
name: "Single Dot - Hold action" | |
description: "The action that should be repeatedly executed when the button with a single dot is held down." | |
default: [] | |
selector: | |
action: | |
action_double_dot_single_press: | |
name: "Double Dot - Single press action" | |
description: "The action that should be executed when the button with two dots is pressed once." | |
default: [] | |
selector: | |
action: | |
action_double_dot_double_press: | |
name: "Double Dot - Double press action" | |
description: "The action that should be executed when the button with two dots is pressed twice." | |
default: [] | |
selector: | |
action: | |
action_double_dot_hold: | |
name: "Double Dot - Hold action" | |
description: "The action that should be repeatedly executed when the button with two dots is held down." | |
default: [] | |
selector: | |
action: | |
trigger: | |
- platform: state | |
entity_id: | |
- !input switch_entity | |
not_from: unavailable | |
action: | |
- variables: | |
switch_entity: !input switch_entity | |
command: "{{ state_attr(switch_entity, 'event_type') }}" | |
- choose: | |
- conditions: | |
- condition: template | |
value_template: "{{ command == '1_short_release' }}" | |
sequence: !input action_single_dot_single_press | |
- conditions: | |
- condition: template | |
value_template: "{{ command == '1_double_press' }}" | |
sequence: !input action_single_dot_double_press | |
- conditions: | |
- condition: template | |
value_template: "{{ command == '1_long_press' }}" | |
sequence: | |
- repeat: | |
count: 20 | |
sequence: | |
- parallel: | |
- sequence: !input action_single_dot_hold | |
- sequence: | |
- wait_for_trigger: | |
- platform: state | |
entity_id: | |
- !input switch_entity | |
timeout: | |
milliseconds: !input helper_hold_delay | |
continue_on_timeout: true | |
- if: | |
- condition: template | |
value_template: "{{ state_attr(switch_entity, 'event_type') == '1_long_release' }}" | |
then: | |
- stop: button released | |
- conditions: | |
- condition: template | |
value_template: "{{ command == '2_short_release' }}" | |
sequence: !input action_double_dot_single_press | |
- conditions: | |
- condition: template | |
value_template: "{{ command == '2_double_press' }}" | |
sequence: !input action_double_dot_double_press | |
- conditions: | |
- condition: template | |
value_template: "{{ command == '2_long_press' }}" | |
sequence: | |
- repeat: | |
count: 20 | |
sequence: | |
- parallel: | |
- sequence: !input action_double_dot_hold | |
- sequence: | |
- wait_for_trigger: | |
- platform: state | |
entity_id: | |
- !input switch_entity | |
timeout: | |
milliseconds: !input helper_hold_delay | |
continue_on_timeout: true | |
- if: | |
- condition: template | |
value_template: "{{ state_attr(switch_entity, 'event_type') == '2_long_release' }}" | |
then: | |
- stop: button released |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment