- Switch Z2M to command mode

This commit is contained in:
nwithan8 2023-08-23 17:18:10 -06:00
parent 3f5b677c88
commit f6734d5228
1 changed files with 11 additions and 17 deletions

View File

@ -1,8 +1,11 @@
# Instructions: https://community.home-assistant.io/t/zha-z2m-control-light-color-hue-brightness-with-ers-dial/595002 # Instructions: https://community.home-assistant.io/t/zha-z2m-control-light-color-hue-brightness-with-ers-dial/595002
blueprint: blueprint:
name: ERS Rotary Dial - Light Control (Z2M) - EVENT mode name: ERS Rotary Dial - Light Control (Z2M) - COMMAND mode
description: Control light brightness, hue and color with an ERS rotary dial description: >
Control light brightness, hue and color with an ERS rotary dial.
Device needs to be in COMMAND mode (triple-press the button to switch modes).
Needs "Home Assistant legacy entity attributes" checked.
source_url: https://raw.githubusercontent.com/nwithan8/configs/main/home_assistant/blueprints/automations/ers_rotary_dial_light_control_z2m.yaml source_url: https://raw.githubusercontent.com/nwithan8/configs/main/home_assistant/blueprints/automations/ers_rotary_dial_light_control_z2m.yaml
@ -86,22 +89,13 @@ action:
brightness_tracker: !input "brightness_tracker" brightness_tracker: !input "brightness_tracker"
color_tracker: !input "color_tracker" color_tracker: !input "color_tracker"
dial_topic: "{{ base_topic }}/{{ device_attr(dial, 'name') }}/action" dial_topic: "{{ base_topic }}/{{ device_attr(dial, 'name') }}/action"
command: > # Ref: https://community.home-assistant.io/t/zigbee2mqtt-tuya-moes-smart-knob-ers-10tzbvk-aa/419989/26
{%- set command = '' -%} command: "{{ trigger.to_state.state }}"
{%- if 'action' in trigger.payload -%} single_pressed: "{{ command == 'toggle' }}"
{%- set command = trigger.payload.action -%}
{%- endif -%}
{{ command }}
single_pressed: "{{ command == 'single' }}"
double_pressed: "{{ command == 'double' }}" double_pressed: "{{ command == 'double' }}"
rotated: "{{ command in ['rotate_right', 'rotate_left'] }}" rotated: "{{ command in ['brightness_step_up', 'brightness_step_up'] }}"
positive: "{{ command == 'rotate_right' }}" positive: "{{ command == 'brightness_step_up' }}"
step_size: > step_size: "{{ trigger.to_state.attributes.action_step_size }}"
{% if rotated %}
{{ trigger.payload.action_step_size | int }}
{% else %}
{{ 0 }}
{% endif %}
# How many steps to go full rotation (min 13 per step * 20 steps per full rotation) # How many steps to go full rotation (min 13 per step * 20 steps per full rotation)
full_rotate_step_count: "{{ 13 * 20 | int }}" full_rotate_step_count: "{{ 13 * 20 | int }}"
current_mode: "{{ states(mode_tracker) | int }}" current_mode: "{{ states(mode_tracker) | int }}"