Skip to content

Instantly share code, notes, and snippets.

@Bearstorm
Last active February 15, 2025 22:00
Show Gist options
  • Save Bearstorm/72691b3dc94709780326e2275e03d169 to your computer and use it in GitHub Desktop.
Save Bearstorm/72691b3dc94709780326e2275e03d169 to your computer and use it in GitHub Desktop.
blueprint:
homeassistant:
min_version: 2025.02.01
author: Bearstorm
domain: automation
name: (Z2M) IKEA Somrig Controls
description: '## Control anything with the IKEA Somrig remote control ⚠️ Only for use with Zigbee2MQTT 🚀 v1.1
([MQTT](https://www.home-assistant.io/integrations/mqtt) ➕ [Z2M addon](https://www.zigbee2mqtt.io/guide/installation/03_ha_addon.html)).
📖 The documentation for this blueprint is available [here](https://github.com/Bearstorm/HA_Blueprints/blob/main/Automations/Zigbee2MQTT%20IKEA%20Somrig%20controller.md).
🏗️ How to create and save Blueprints in Home Assistant can be found [here](https://www.bearstorm.com/blueprint-more-info.html).
📜 I was inspired by this [plan](https://gist.github.com/damru/b2c1c780ffb0ddc084952eb89db9573a).
🕒 Updated by Bearstorm 2025.02.08
✅ Added search window only for IKEA SOMRIG devices
🔌 Available controls:
- Press the **one dot** or **two dots** buttons
- Double press the **one dot** or **two dost** buttons.
- Press and hold the **one dot** or **two dots** buttons.
- **Helper - Hold delay**, Delay between the execution of the Hold action(s).
- **Helper - Max number of loops** Maximum number of loops when holding down a button. '
domain: automation
input:
remote_device:
name: (Zigbee2MQTT) Select Remote
description: Choose the IKEA Somrig (E2213) remote.
selector:
device:
integration: mqtt
manufacturer: "IKEA"
model: "SOMRIG shortcut button"
dots_1_press_action:
name: Dots 1 - Single press action
description: Action when **one dot** button is pressed.
default: []
selector:
action: {}
dots_2_press_action:
name: Dots 2 - Single press action
description: Action when **two dots** button is pressed.
default: []
selector:
action: {}
dots_1_double_press_action:
name: Dots 1 - Double press action
description: Action when pressing the **one dot** button twice.
default: []
selector:
action: {}
dots_2_double_press_action:
name: Dots 2 - Double press action
description: Action when pressing the **two dots** button twice.
default: []
selector:
action: {}
dots_1_hold_action:
name: Dots 1 - Hold action
description: Action when **one dot** button is held.
default: []
selector:
action: {}
dots_2_hold_action:
name: Dots 2 - Hold action
description: Action when **two dots** button is held.
default: []
selector:
action: {}
helper_hold_delay:
name: Helper - Hold delay
description: Delay between the execution of the **Hold** action(s).
default: 250
selector:
number:
unit_of_measurement: milliseconds
min: 100.0
max: 5000.0
step: 10.0
mode: slider
helper_max_loops:
name: Helper - Max number of loops
description: Maximum number of loops when holding down a button.
default: 20
selector:
number:
min: 1.0
max: 1000.0
step: 1.0
mode: slider
mode: single
max_exceeded: silent
trigger:
- platform: device
domain: mqtt
device_id: !input remote_device
type: action
subtype: "1_short_release"
id: press-dots-1-z2m
- platform: device
domain: mqtt
device_id: !input remote_device
type: action
subtype: "2_short_release"
id: press-dots-2-z2m
- platform: device
domain: mqtt
device_id: !input remote_device
type: action
subtype: "1_double_press"
id: double-press-dots-1-z2m
- platform: device
domain: mqtt
device_id: !input remote_device
type: action
subtype: "2_double_press"
id: double-press-dots-2-z2m
- platform: device
domain: mqtt
device_id: !input remote_device
type: action
subtype: "1_long_press"
id: hold-dots-1-z2m
- platform: device
domain: mqtt
device_id: !input remote_device
type: action
subtype: "2_long_press"
id: hold-dots-2-z2m
- platform: device
domain: mqtt
device_id: !input remote_device
type: action
subtype: "1_long_release"
id: release-dots-1-z2m
- platform: device
domain: mqtt
device_id: !input remote_device
type: action
subtype: "2_long_release"
id: release-dots-2-z2m
action:
- choose:
- conditions:
- condition: trigger
id: press-dots-1-z2m
sequence: !input dots_1_press_action
- conditions:
- condition: trigger
id: press-dots-2-z2m
sequence: !input dots_2_press_action
- conditions:
- condition: trigger
id: double-press-dots-1-z2m
sequence: !input dots_1_double_press_action
- conditions:
- condition: trigger
id: double-press-dots-2-z2m
sequence: !input dots_2_double_press_action
- conditions:
- condition: trigger
id: hold-dots-1-z2m
sequence:
- repeat:
count: !input helper_max_loops
sequence:
- parallel:
- sequence: !input dots_1_hold_action
- sequence:
- choose:
- conditions:
- condition: trigger
id: hold-dots-1-z2m
sequence:
- wait_for_trigger:
- platform: device
domain: mqtt
device_id: !input remote_device
type: action
subtype: "1_long_release"
timeout:
milliseconds: !input helper_hold_delay
continue_on_timeout: true
- if:
- condition: template
value_template: "{{ wait.trigger.idx is defined }}"
then:
- stop: button released
- conditions:
- condition: trigger
id: hold-dots-2-z2m
sequence:
- repeat:
count: !input helper_max_loops
sequence:
- parallel:
- sequence: !input dots_2_hold_action
- sequence:
- choose:
- conditions:
- condition: trigger
id: hold-dots-2-z2m
sequence:
- wait_for_trigger:
- platform: device
domain: mqtt
device_id: !input remote_device
type: action
subtype: "2_long_release"
timeout:
milliseconds: !input helper_hold_delay
continue_on_timeout: true
- if:
- condition: template
value_template: "{{ wait.trigger.idx is defined }}"
then:
- stop: button released
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment