Treat rotate followed by immediate stop rotate as a single click with Aqara H2 EU dimmer
This commit is contained in:
1 parent
746a048251
commit
9e3c770178
1 file changed
+30
-2
@@ -210,9 +210,37 @@ action:
|
|||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ action_type == 'rotation' }}"
|
value_template: "{{ action_type == 'rotation' }}"
|
||||||
sequence:
|
sequence:
|
||||||
# Filter out accidental micro-rotations (knocks) below the deadzone
|
- choose:
|
||||||
|
# A click can occasionally appear as a small rotation followed
|
||||||
|
# immediately by stop_rotating. Only treat it as a single press
|
||||||
|
# if the stop_rotating packet actually follows.
|
||||||
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ (raw_angle | abs) >= (deadzone | float(0)) }}"
|
value_template: "{{ (raw_angle | abs) < (deadzone | float(0)) }}"
|
||||||
|
sequence:
|
||||||
|
- wait_for_trigger:
|
||||||
|
- platform: mqtt
|
||||||
|
topic: !input mqtt_topic
|
||||||
|
payload: "stop_rotating"
|
||||||
|
value_template: "{{ value_json.action | default('') }}"
|
||||||
|
timeout:
|
||||||
|
milliseconds: 500
|
||||||
|
continue_on_timeout: false
|
||||||
|
|
||||||
|
- choose:
|
||||||
|
- conditions:
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ enable_toggle }}"
|
||||||
|
sequence:
|
||||||
|
- service: light.toggle
|
||||||
|
target: !input target_light
|
||||||
|
|
||||||
|
- choose:
|
||||||
|
- conditions: []
|
||||||
|
sequence: !input single_press_action
|
||||||
|
|
||||||
|
# Normal rotation above the configured deadzone.
|
||||||
|
default:
|
||||||
# Only fire the turn_on service if there was a registrable angle change
|
# Only fire the turn_on service if there was a registrable angle change
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ scaled_step != 0 }}"
|
value_template: "{{ scaled_step != 0 }}"
|
||||||
|
|||||||
Reference in new issue
Block a user