feat: allow multiple remotes (#17)
* feat!: allow multiple remotes * doc: add fancy emojis * fix: press-dots2-z2m-e2213 * chore: add PR labeling and changelog template
This commit is contained in:
@@ -3,9 +3,9 @@ blueprint:
|
||||
min_version: 2024.10.0
|
||||
author: damru
|
||||
domain: automation
|
||||
name: IKEA Tradfri on/off (E1743), IKEA Rodret (E2201) or IKEA Somrig (E2213) Controls (ZHA/Z2M)
|
||||
name: Ikea's Tradfri, Rodret or Somrig ⚙️ Controls
|
||||
description: >
|
||||
## Control anything with **IKEA TRADFRI ON/OFF** or **IKEA RODRET** or **IKEA SOMRIG** remotes
|
||||
## ⚙️ Control anything with **IKEA TRADFRI ON/OFF** or **IKEA RODRET** or **IKEA SOMRIG** remotes
|
||||
|
||||
|
||||
Only for use with [ZHA](https://www.home-assistant.io/integrations/zha/)
|
||||
@@ -22,8 +22,8 @@ blueprint:
|
||||
- Hold **on/off** (Tradfri, Rodret) **1 dot/2 dots** (Somrig).
|
||||
Actions will be executed every **Hold delay**, but maximum **Max number of loops** times.
|
||||
input:
|
||||
remote_device:
|
||||
name: Remote
|
||||
remote_devices:
|
||||
name: Remotes
|
||||
description: >
|
||||
IKEA remote (Tradfri, Rodret, Somrig) to use.
|
||||
default: []
|
||||
@@ -60,7 +60,7 @@ blueprint:
|
||||
- integration: mqtt
|
||||
manufacturer: IKEA
|
||||
model: SOMRIG shortcut button (E2213)
|
||||
multiple: false
|
||||
multiple: true
|
||||
on_press_action:
|
||||
name: Press "on / 1 dot" action
|
||||
description: Choose action(s) to run when **on** (Tradfri, Rodret) or **1 dot** (Somrig) button is **pressed**.
|
||||
@@ -168,189 +168,161 @@ blueprint:
|
||||
mode: single
|
||||
max_exceeded: silent
|
||||
triggers:
|
||||
# TRADFRI - E1743 + RODRET - E2201
|
||||
# TRADFRI (E1743) + RODRET (E2201)
|
||||
- trigger: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_id: !input remote_device
|
||||
command: "on"
|
||||
cluster_id: 6
|
||||
endpoint_id: 1
|
||||
id: press-on-zha-e1743-e2201
|
||||
- trigger: device
|
||||
domain: mqtt
|
||||
device_id: !input remote_device
|
||||
type: action
|
||||
subtype: "on"
|
||||
- trigger: mqtt
|
||||
topic: "+/+/action"
|
||||
payload: "on"
|
||||
id: press-on-z2m-e1743-e2201
|
||||
- trigger: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_id: !input remote_device
|
||||
command: "off"
|
||||
cluster_id: 6
|
||||
endpoint_id: 1
|
||||
id: press-off-zha-e1743-e2201
|
||||
- trigger: device
|
||||
domain: mqtt
|
||||
device_id: !input remote_device
|
||||
type: action
|
||||
subtype: "off"
|
||||
- trigger: mqtt
|
||||
topic: "+/+/action"
|
||||
payload: "off"
|
||||
id: press-off-z2m-e1743-e2201
|
||||
- trigger: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_id: !input remote_device
|
||||
command: "move_with_on_off"
|
||||
command: move_with_on_off
|
||||
cluster_id: 8
|
||||
endpoint_id: 1
|
||||
args: [0, 83]
|
||||
id: hold-on-zha-e1743-e2201
|
||||
- trigger: device
|
||||
domain: mqtt
|
||||
device_id: !input remote_device
|
||||
type: action
|
||||
subtype: "brightness_move_up"
|
||||
- trigger: mqtt
|
||||
topic: "+/+/action"
|
||||
payload: brightness_move_up
|
||||
id: hold-on-z2m-e1743-e2201
|
||||
- trigger: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_id: !input remote_device
|
||||
command: "move"
|
||||
command: move
|
||||
cluster_id: 8
|
||||
endpoint_id: 1
|
||||
args: [1, 83, 0, 0]
|
||||
id: hold-off-zha-e1743-e2201
|
||||
- trigger: device
|
||||
domain: mqtt
|
||||
device_id: !input remote_device
|
||||
type: action
|
||||
subtype: "brightness_move_down"
|
||||
- trigger: mqtt
|
||||
topic: "+/+/action"
|
||||
payload: brightness_move_down
|
||||
id: hold-off-z2m-e1743-e2201
|
||||
- trigger: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_id: !input remote_device
|
||||
endpoint_id: 1
|
||||
cluster_id: 8
|
||||
command: stop_with_on_off
|
||||
id: release-zha-e1743-e2201
|
||||
- trigger: device
|
||||
domain: mqtt
|
||||
device_id: !input remote_device
|
||||
type: action
|
||||
subtype: "brightness_stop"
|
||||
- trigger: mqtt
|
||||
topic: "+/+/action"
|
||||
payload: brightness_stop
|
||||
id: release-z2m-e1743-e2201
|
||||
|
||||
# SOMRIG - E2213
|
||||
# SOMRIG (E2213)
|
||||
- trigger: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_id: !input remote_device
|
||||
command: "short_release"
|
||||
command: short_release
|
||||
endpoint_id: 1
|
||||
id: press-dots1-zha-e2213
|
||||
- trigger: device
|
||||
domain: mqtt
|
||||
device_id: !input remote_device
|
||||
type: action
|
||||
subtype: "1_short_release"
|
||||
- trigger: mqtt
|
||||
topic: "+/+/action"
|
||||
payload: 1_short_release
|
||||
id: press-dots1-z2m-e2213
|
||||
- trigger: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_id: !input remote_device
|
||||
command: "short_release"
|
||||
command: short_release
|
||||
endpoint_id: 2
|
||||
id: press-dots2-zha-e2213
|
||||
- trigger: device
|
||||
domain: mqtt
|
||||
device_id: !input remote_device
|
||||
type: action
|
||||
subtype: "2_short_release"
|
||||
- trigger: mqtt
|
||||
topic: "+/+/action"
|
||||
payload: 2_short_release
|
||||
id: press-dots2-z2m-e2213
|
||||
- trigger: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_id: !input remote_device
|
||||
command: "multi_press_complete"
|
||||
command: multi_press_complete
|
||||
endpoint_id: 1
|
||||
id: double-press-dots1-zha-e2213
|
||||
- trigger: device
|
||||
domain: mqtt
|
||||
device_id: !input remote_device
|
||||
type: action
|
||||
subtype: "1_double_press"
|
||||
- trigger: mqtt
|
||||
topic: "+/+/action"
|
||||
payload: 1_double_press
|
||||
id: double-press-dots1-z2m-e2213
|
||||
- trigger: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_id: !input remote_device
|
||||
command: "multi_press_complete"
|
||||
command: multi_press_complete
|
||||
endpoint_id: 2
|
||||
id: double-press-dots2-zha-e2213
|
||||
- trigger: device
|
||||
domain: mqtt
|
||||
device_id: !input remote_device
|
||||
type: action
|
||||
subtype: "2_double_press"
|
||||
- trigger: mqtt
|
||||
topic: "+/+/action"
|
||||
payload: 2_double_press
|
||||
id: double-press-dots2-z2m-e2213
|
||||
- trigger: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_id: !input remote_device
|
||||
command: "long_press"
|
||||
command: long_press
|
||||
endpoint_id: 1
|
||||
id: hold-dots1-zha-e2213
|
||||
- trigger: device
|
||||
domain: mqtt
|
||||
device_id: !input remote_device
|
||||
type: action
|
||||
subtype: "1_long_press"
|
||||
- trigger: mqtt
|
||||
topic: "+/+/action"
|
||||
payload: 1_long_press
|
||||
id: hold-dots1-z2m-e2213
|
||||
- trigger: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_id: !input remote_device
|
||||
command: "long_press"
|
||||
command: long_press
|
||||
endpoint_id: 2
|
||||
id: hold-dots2-zha-e2213
|
||||
- trigger: device
|
||||
domain: mqtt
|
||||
device_id: !input remote_device
|
||||
type: action
|
||||
subtype: "2_long_press"
|
||||
- trigger: mqtt
|
||||
topic: "+/+/action"
|
||||
payload: 2_long_press
|
||||
id: hold-dots2-z2m-e2213
|
||||
- trigger: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_id: !input remote_device
|
||||
command: "long_release"
|
||||
command: long_release
|
||||
endpoint_id: 1
|
||||
id: release-hold-dots1-zha-e2213
|
||||
- trigger: device
|
||||
domain: mqtt
|
||||
device_id: !input remote_device
|
||||
type: action
|
||||
subtype: "1_long_release"
|
||||
- trigger: mqtt
|
||||
topic: "+/+/action"
|
||||
payload: 1_long_release
|
||||
id: release-hold-dots1-z2m-e2213
|
||||
- trigger: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_id: !input remote_device
|
||||
command: "long_release"
|
||||
command: long_release
|
||||
endpoint_id: 2
|
||||
id: release-hold-dots2-zha-e2213
|
||||
- trigger: device
|
||||
domain: mqtt
|
||||
device_id: !input remote_device
|
||||
type: action
|
||||
subtype: "2_long_release"
|
||||
- trigger: mqtt
|
||||
topic: "+/+/action"
|
||||
payload: 2_long_release
|
||||
id: release-hold-dots2-z2m-e2213
|
||||
variables:
|
||||
on_double_press_exposed: !input on_double_press_exposed
|
||||
off_double_press_exposed: !input off_double_press_exposed
|
||||
remote_devices: !input remote_devices
|
||||
remote_device: >-
|
||||
{% set is_zha = trigger.platform == "zha_event" %}
|
||||
{% set is_mqtt = trigger.platform == "mqtt" %}
|
||||
{% set device_name = trigger.topic.split("/")[1] if is_mqtt else none %}
|
||||
{{
|
||||
(trigger.event.data.device_id if is_zha) or
|
||||
(device_id(trigger.topic.split("/")[1]) if is_mqtt and device_name)
|
||||
}}
|
||||
mqtt_topic: "{{ trigger.topic }}"
|
||||
condition:
|
||||
- condition: template
|
||||
value_template: "{{ remote_device in remote_devices }}"
|
||||
actions:
|
||||
- variables:
|
||||
on_double_press_exposed: !input on_double_press_exposed
|
||||
off_double_press_exposed: !input off_double_press_exposed
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: trigger
|
||||
@@ -374,7 +346,7 @@ actions:
|
||||
- trigger: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_id: !input remote_device
|
||||
device_id: "{{ remote_device }}"
|
||||
command: "on"
|
||||
cluster_id: 6
|
||||
endpoint_id: 1
|
||||
@@ -392,11 +364,9 @@ actions:
|
||||
- press-on-z2m-e1743-e2201
|
||||
sequence:
|
||||
- wait_for_trigger:
|
||||
- trigger: device
|
||||
domain: mqtt
|
||||
device_id: !input remote_device
|
||||
type: action
|
||||
subtype: "on"
|
||||
- trigger: mqtt
|
||||
topic: "{{ mqtt_topic }}"
|
||||
payload: "on"
|
||||
timeout:
|
||||
milliseconds: !input helper_double_press_delay
|
||||
continue_on_timeout: true
|
||||
@@ -429,7 +399,7 @@ actions:
|
||||
- trigger: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_id: !input remote_device
|
||||
device_id: "{{ remote_device }}"
|
||||
command: "off"
|
||||
cluster_id: 6
|
||||
endpoint_id: 1
|
||||
@@ -447,11 +417,9 @@ actions:
|
||||
- press-off-z2m-e1743-e2201
|
||||
sequence:
|
||||
- wait_for_trigger:
|
||||
- trigger: device
|
||||
domain: mqtt
|
||||
device_id: !input remote_device
|
||||
type: action
|
||||
subtype: "off"
|
||||
- trigger: mqtt
|
||||
topic: "{{ mqtt_topic }}"
|
||||
payload: "off"
|
||||
timeout:
|
||||
milliseconds: !input helper_double_press_delay
|
||||
continue_on_timeout: true
|
||||
@@ -501,7 +469,7 @@ actions:
|
||||
- trigger: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_id: !input remote_device
|
||||
device_id: "{{ remote_device }}"
|
||||
command: "stop_with_on_off"
|
||||
cluster_id: 8
|
||||
endpoint_id: 1
|
||||
@@ -520,16 +488,12 @@ actions:
|
||||
- hold-dots1-z2m-e2213
|
||||
sequence:
|
||||
- wait_for_trigger:
|
||||
- trigger: device
|
||||
domain: mqtt
|
||||
device_id: !input remote_device
|
||||
type: action
|
||||
subtype: "brightness_stop"
|
||||
- trigger: device
|
||||
domain: mqtt
|
||||
device_id: !input remote_device
|
||||
type: action
|
||||
subtype: "1_long_release"
|
||||
- trigger: mqtt
|
||||
topic: "{{ mqtt_topic }}"
|
||||
payload: "brightness_stop"
|
||||
- trigger: mqtt
|
||||
topic: "{{ mqtt_topic }}"
|
||||
payload: "1_long_release"
|
||||
timeout:
|
||||
milliseconds: !input helper_hold_delay
|
||||
continue_on_timeout: true
|
||||
@@ -563,7 +527,7 @@ actions:
|
||||
- trigger: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_id: !input remote_device
|
||||
device_id: "{{ remote_device }}"
|
||||
command: "stop_with_on_off"
|
||||
cluster_id: 8
|
||||
endpoint_id: 1
|
||||
@@ -582,16 +546,12 @@ actions:
|
||||
- hold-dots2-z2m-e2213
|
||||
sequence:
|
||||
- wait_for_trigger:
|
||||
- trigger: device
|
||||
domain: mqtt
|
||||
device_id: !input remote_device
|
||||
type: action
|
||||
subtype: "brightness_stop"
|
||||
- trigger: device
|
||||
domain: mqtt
|
||||
device_id: !input remote_device
|
||||
type: action
|
||||
subtype: "2_long_release"
|
||||
- trigger: mqtt
|
||||
topic: "{{ mqtt_topic }}"
|
||||
payload: "brightness_stop"
|
||||
- trigger: mqtt
|
||||
topic: "{{ mqtt_topic }}"
|
||||
payload: "2_long_release"
|
||||
timeout:
|
||||
milliseconds: !input helper_hold_delay
|
||||
continue_on_timeout: true
|
||||
|
||||
Reference in New Issue
Block a user