- Fix Z2M automation to listen for Z2M events
This commit is contained in:
parent
63aa5050a4
commit
9ab215f54a
|
@ -26,8 +26,7 @@ blueprint:
|
||||||
selector:
|
selector:
|
||||||
device:
|
device:
|
||||||
filter:
|
filter:
|
||||||
integration: zha
|
integration: mqtt
|
||||||
model: TS004F
|
|
||||||
|
|
||||||
mode_tracker:
|
mode_tracker:
|
||||||
name: Mode tracker
|
name: Mode tracker
|
||||||
|
@ -61,19 +60,33 @@ blueprint:
|
||||||
filter:
|
filter:
|
||||||
domain: input_number
|
domain: input_number
|
||||||
|
|
||||||
|
base_topic:
|
||||||
|
name: Zigbee2MQTT Base mqtt topic
|
||||||
|
description: The base topic configured in Zigbee2MQTT. If you haven't changed this, leave the default here ("zigbee2mqtt")
|
||||||
|
default: zigbee2mqtt
|
||||||
|
|
||||||
# Queued, to ignore non-matched events but capture existing ones
|
# Queued, to ignore non-matched events but capture existing ones
|
||||||
mode: queued
|
mode: queued
|
||||||
max: 20
|
max: 20
|
||||||
max_exceeded: silent
|
max_exceeded: silent
|
||||||
|
|
||||||
variables:
|
trigger_variables:
|
||||||
|
base_topic: !input base_topic
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
- platform: mqtt
|
||||||
|
topic: "{{ base_topic }}/+/action"
|
||||||
|
|
||||||
|
action:
|
||||||
|
- variables:
|
||||||
light: !input "light"
|
light: !input "light"
|
||||||
dial: !input "dial"
|
dial: !input "dial"
|
||||||
mode_tracker: !input "mode_tracker"
|
mode_tracker: !input "mode_tracker"
|
||||||
hue_tracker: !input "hue_tracker"
|
hue_tracker: !input "hue_tracker"
|
||||||
brightness_tracker: !input "brightness_tracker"
|
brightness_tracker: !input "brightness_tracker"
|
||||||
color_tracker: !input "color_tracker"
|
color_tracker: !input "color_tracker"
|
||||||
command: "{{ trigger.to_state.state }}"
|
dial_topic: "{{ base_topic }}/{{ device_attr(dial, 'name') }}/action"
|
||||||
|
command: "{{ trigger.payload }}"
|
||||||
single_pressed: "{{ command == 'single' }}"
|
single_pressed: "{{ command == 'single' }}"
|
||||||
double_pressed: "{{ command == 'double' }}"
|
double_pressed: "{{ command == 'double' }}"
|
||||||
rotated: "{{ command in ['rotate_right', 'rotate_left'] }}"
|
rotated: "{{ command in ['rotate_right', 'rotate_left'] }}"
|
||||||
|
@ -154,15 +167,13 @@ variables:
|
||||||
{%- set val = max_color - (diff % max_color) -%}
|
{%- set val = max_color - (diff % max_color) -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{{ val | int }}
|
{{ val | int }}
|
||||||
|
|
||||||
trigger:
|
|
||||||
- platform: event
|
|
||||||
event_type: zha_event
|
|
||||||
event_data:
|
|
||||||
device_id: !input dial
|
|
||||||
|
|
||||||
action:
|
|
||||||
# Process current event
|
# Process current event
|
||||||
|
- choose:
|
||||||
|
# Verify that the dial is the one that triggered the event
|
||||||
|
- conditions:
|
||||||
|
- "{{ trigger.payload != ''}}"
|
||||||
|
- "{{ trigger.topic == dial_topic }}"
|
||||||
|
sequence:
|
||||||
- choose:
|
- choose:
|
||||||
# If event was a dial turn
|
# If event was a dial turn
|
||||||
- conditions:
|
- conditions:
|
||||||
|
|
Loading…
Reference in New Issue