344 lines
10 KiB
YAML
344 lines
10 KiB
YAML
blueprint:
|
|
name: IKEA Rodret (E2201) or IKEA Somrig (E2213) Light control (ZHA/Z2M)
|
|
description: >
|
|
## Control a light with **IKEA RODRET** or **IKEA SOMRIG** remotes
|
|
|
|
|
|
Only for use with [ZHA](https://www.home-assistant.io/integrations/zha/)
|
|
or Zigbee2MQTT (cf [MQTT](https://www.home-assistant.io/integrations/mqtt)
|
|
+ [Z2M addon](https://www.zigbee2mqtt.io/guide/installation/03_ha_addon.html)).
|
|
|
|
|
|
Available controls:
|
|
|
|
- Press **on** (Rodret) or **1 dot** (Somrig) to turn on the light
|
|
(Optional: set the target brightness by enabling **Helper - Force Brightness** and setting a **Helper - Brightness** value)
|
|
|
|
- Press **off** (Rodret) or **2 dots** (Somrig) to turn off the light
|
|
|
|
- Hold **on** (Rodret) or **1 dot** button to increase the brightness
|
|
|
|
- Hold **off** (Rodret) or **2 dots** button to decrease the brightness down to 1%
|
|
domain: automation
|
|
input:
|
|
remote_device:
|
|
name: (ZHA) Remote
|
|
description: >
|
|
**_Choose if you are using ZHA._** IKEA remote to use.
|
|
default: ""
|
|
selector:
|
|
device:
|
|
filter:
|
|
- integration: zha
|
|
manufacturer: IKEA of Sweden
|
|
model: RODRET Dimmer
|
|
- integration: zha
|
|
manufacturer: IKEA of Sweden
|
|
model: SOMRIG shortcut button
|
|
multiple: false
|
|
remote_name:
|
|
name: (Zigbee2MQTT) Remote Name
|
|
description: >
|
|
**_Choose if you are using Zigbee2MQTT._** The name of the controller (e.g. IKEA Rodret).
|
|
default: ""
|
|
base_topic:
|
|
name: (Zigbee2MQTT) Base mqtt topic
|
|
description: The topic configured in [Z2M addon](https://www.zigbee2mqtt.io/guide/usage/mqtt_topics_and_messages.html).
|
|
default: zigbee2mqtt
|
|
light:
|
|
name: Light
|
|
description: Light to control
|
|
selector:
|
|
entity:
|
|
filter:
|
|
domain: light
|
|
multiple: false
|
|
helper_force_brightness:
|
|
name: Helper - Force brightness
|
|
description: Force the brightness to **Helper - Brightness** value when light turns on.
|
|
default: false
|
|
selector:
|
|
boolean: {}
|
|
helper_brightness:
|
|
name: Helper - Brightness
|
|
description:
|
|
Target light brightness when turning on. Requires **Helper - Force brightness**
|
|
to be enabled.
|
|
default: 50
|
|
selector:
|
|
number:
|
|
unit_of_measurement: "%"
|
|
min: 1.0
|
|
max: 100.0
|
|
step: 1.0
|
|
mode: slider
|
|
mode: restart
|
|
max_exceeded: silent
|
|
trigger_variables:
|
|
z2m_base_topic: !input base_topic
|
|
z2m_controller: !input remote_name
|
|
zha_controller: !input remote_device
|
|
trigger:
|
|
# RODRET - E2201
|
|
- platform: event
|
|
event_type: zha_event
|
|
event_data:
|
|
device_id: "{{ zha_controller }}"
|
|
command: "on"
|
|
cluster_id: 6
|
|
endpoint_id: 1
|
|
id: press-on-zha-e2201
|
|
- platform: mqtt
|
|
topic: "{{ z2m_base_topic ~ '/' ~ z2m_controller ~ '/action' }}"
|
|
payload: "on"
|
|
id: press-on-z2m-e2201
|
|
- platform: event
|
|
event_type: zha_event
|
|
event_data:
|
|
device_id: "{{ zha_controller }}"
|
|
command: "off"
|
|
cluster_id: 6
|
|
endpoint_id: 1
|
|
id: press-off-zha-e2201
|
|
- platform: mqtt
|
|
topic: "{{ z2m_base_topic ~ '/' ~ z2m_controller ~ '/action' }}"
|
|
payload: "off"
|
|
id: press-off-z2m-e2201
|
|
- platform: event
|
|
event_type: zha_event
|
|
event_data:
|
|
device_id: "{{ zha_controller }}"
|
|
command: "move_with_on_off"
|
|
cluster_id: 8
|
|
endpoint_id: 1
|
|
args: [0, 83]
|
|
id: hold-on-zha-e2201
|
|
- platform: mqtt
|
|
topic: "{{ z2m_base_topic ~ '/' ~ z2m_controller ~ '/action' }}"
|
|
payload: "brightness_move_up"
|
|
id: hold-on-z2m-e2201
|
|
- platform: event
|
|
event_type: zha_event
|
|
event_data:
|
|
device_id: "{{ zha_controller }}"
|
|
command: "move"
|
|
cluster_id: 8
|
|
endpoint_id: 1
|
|
args: [1, 83, 0, 0]
|
|
id: hold-off-zha-e2201
|
|
- platform: mqtt
|
|
topic: "{{ z2m_base_topic ~ '/' ~ z2m_controller ~ '/action' }}"
|
|
payload: "brightness_move_down"
|
|
id: hold-off-z2m-e2201
|
|
- platform: event
|
|
event_type: zha_event
|
|
event_data:
|
|
device_id: "{{ zha_controller }}"
|
|
command: stop_with_on_off
|
|
endpoint_id: 1
|
|
cluster_id: 8
|
|
id: release-zha-e2201
|
|
- platform: mqtt
|
|
topic: "{{ z2m_base_topic ~ '/' ~ z2m_controller ~ '/action' }}"
|
|
payload: "brightness_stop"
|
|
id: release-z2m-e2201
|
|
|
|
# SOMRIG - E2213
|
|
- platform: event
|
|
event_type: zha_event
|
|
event_data:
|
|
device_id: "{{ zha_controller }}"
|
|
command: "short_release"
|
|
cluster_id: 64640
|
|
endpoint_id: 1
|
|
args: [0]
|
|
id: press-dots1-zha-e2213
|
|
- platform: mqtt
|
|
topic: "{{ z2m_base_topic ~ '/' ~ z2m_controller ~ '/action' }}"
|
|
payload: "1_short_release"
|
|
id: press-dots1-z2m-e2213
|
|
- platform: event
|
|
event_type: zha_event
|
|
event_data:
|
|
device_id: "{{ zha_controller }}"
|
|
command: "short_release"
|
|
cluster_id: 64640
|
|
endpoint_id: 2
|
|
args: [0]
|
|
id: press-dots2-zha-e2213
|
|
- platform: mqtt
|
|
topic: "{{ z2m_base_topic ~ '/' ~ z2m_controller ~ '/action' }}"
|
|
payload: "2_short_release"
|
|
id: press-dots2-z2m-e2213
|
|
- platform: event
|
|
event_type: zha_event
|
|
event_data:
|
|
device_id: "{{ zha_controller }}"
|
|
command: "multi_press_complete"
|
|
cluster_id: 64640
|
|
endpoint_id: 1
|
|
args: [0, 2]
|
|
id: double-press-dots1-zha-e2213
|
|
- platform: mqtt
|
|
topic: "{{ z2m_base_topic ~ '/' ~ z2m_controller ~ '/action' }}"
|
|
payload: "1_double_press"
|
|
id: double-press-dots1-z2m-e2213
|
|
- platform: event
|
|
event_type: zha_event
|
|
event_data:
|
|
device_id: "{{ zha_controller }}"
|
|
command: "multi_press_complete"
|
|
cluster_id: 64640
|
|
endpoint_id: 2
|
|
args: [0, 2]
|
|
id: double-press-dots2-zha-e2213
|
|
- platform: mqtt
|
|
topic: "{{ z2m_base_topic ~ '/' ~ z2m_controller ~ '/action' }}"
|
|
payload: "2_double_press"
|
|
id: double-press-dots2-z2m-e2213
|
|
- platform: event
|
|
event_type: zha_event
|
|
event_data:
|
|
device_id: "{{ zha_controller }}"
|
|
command: "long_press"
|
|
cluster_id: 64640
|
|
endpoint_id: 1
|
|
args: [0]
|
|
id: hold-dots1-zha-e2213
|
|
- platform: mqtt
|
|
topic: "{{ z2m_base_topic ~ '/' ~ z2m_controller ~ '/action' }}"
|
|
payload: "1_long_press"
|
|
id: hold-dots1-z2m-e2213
|
|
- platform: event
|
|
event_type: zha_event
|
|
event_data:
|
|
device_id: "{{ zha_controller }}"
|
|
command: "long_press"
|
|
cluster_id: 64640
|
|
endpoint_id: 2
|
|
args: [0]
|
|
id: hold-dots2-zha-e2213
|
|
- platform: mqtt
|
|
topic: "{{ z2m_base_topic ~ '/' ~ z2m_controller ~ '/action' }}"
|
|
payload: "2_long_press"
|
|
id: hold-dots2-z2m-e2213
|
|
- platform: event
|
|
event_type: zha_event
|
|
event_data:
|
|
device_id: "{{ zha_controller }}"
|
|
command: "long_release"
|
|
cluster_id: 64640
|
|
endpoint_id: 1
|
|
args: [0]
|
|
id: release-hold-dots1-zha-e2213
|
|
- platform: mqtt
|
|
topic: "{{ z2m_base_topic ~ '/' ~ z2m_controller ~ '/action' }}"
|
|
payload: "1_long_release"
|
|
id: release-hold-dots1-z2m-e2213
|
|
- platform: event
|
|
event_type: zha_event
|
|
event_data:
|
|
device_id: "{{ zha_controller }}"
|
|
command: "long_release"
|
|
cluster_id: 64640
|
|
endpoint_id: 2
|
|
args: [0]
|
|
id: release-hold-dots2-zha-e2213
|
|
- platform: mqtt
|
|
topic: "{{ z2m_base_topic ~ '/' ~ z2m_controller ~ '/action' }}"
|
|
payload: "2_long_release"
|
|
id: release-hold-dots2-z2m-e2213
|
|
action:
|
|
- variables:
|
|
helper_force_brightness: !input helper_force_brightness
|
|
helper_hold_delay: 0.05
|
|
helper_hold_dim_step: 5
|
|
light: !input light
|
|
- choose:
|
|
- conditions:
|
|
- condition: trigger
|
|
id:
|
|
- press-on-zha-e2201
|
|
- press-on-z2m-e2201
|
|
- press-dots1-zha-e2213
|
|
- press-dots1-z2m-e2213
|
|
sequence:
|
|
- choose:
|
|
- conditions: "{{ helper_force_brightness }}"
|
|
sequence:
|
|
- service: light.turn_on
|
|
target:
|
|
entity_id: !input light
|
|
data:
|
|
transition: 1
|
|
brightness_pct: !input helper_brightness
|
|
default:
|
|
- service: light.turn_on
|
|
target:
|
|
entity_id: !input light
|
|
data:
|
|
transition: 1
|
|
- conditions:
|
|
- condition: trigger
|
|
id:
|
|
- press-off-zha
|
|
- press-off-z2m-e2201
|
|
- press-dots2-zha-e2213
|
|
- press-dots2-z2m-e2213
|
|
sequence:
|
|
- service: light.turn_off
|
|
target:
|
|
entity_id: !input light
|
|
data:
|
|
transition: 1
|
|
- conditions:
|
|
- condition: trigger
|
|
id:
|
|
- hold-on-zha-e2201
|
|
- hold-on-z2m-e2201
|
|
- hold-dots1-zha-e2213
|
|
- hold-dots1-z2m-e2213
|
|
sequence:
|
|
- repeat:
|
|
while:
|
|
- condition: trigger
|
|
id:
|
|
- hold-on-zha-e2201
|
|
- hold-on-z2m-e2201
|
|
- hold-dots1-zha-e2213
|
|
- hold-dots1-z2m-e2213
|
|
sequence:
|
|
- parallel:
|
|
- service: light.turn_on
|
|
target:
|
|
entity_id: !input light
|
|
data:
|
|
brightness_step_pct: "{{ helper_hold_dim_step }}"
|
|
- delay: "{{ helper_hold_delay }}"
|
|
- conditions:
|
|
- condition: trigger
|
|
id:
|
|
- hold-off-zha-e2201
|
|
- hold-off-z2m-e2201
|
|
- hold-dots2-zha-e2213
|
|
- hold-dots2-z2m-e2213
|
|
sequence:
|
|
- repeat:
|
|
while:
|
|
- condition: template
|
|
value_template:
|
|
"{{ state_attr(light, 'brightness') | int / 255 > helper_hold_dim_step/100
|
|
}}"
|
|
sequence:
|
|
- parallel:
|
|
- service: light.turn_on
|
|
data:
|
|
brightness_step_pct: "{{ helper_hold_dim_step | int * -1 }}"
|
|
target:
|
|
entity_id: !input light
|
|
- delay: "{{ helper_hold_delay }}"
|
|
- service: light.turn_on
|
|
data:
|
|
brightness_pct: 1
|
|
target:
|
|
entity_id: !input light |