Treat rotate followed by immediate stop rotate as a single click with Aqara H2 EU dimmer

This commit is contained in:
mg committed 2026-10-02 23:15:32 +01:00
1 parent 746a048251
commit 9e3c770178
1 file changed
+39 -11
+39 -11
View File
@@ -210,14 +210,42 @@ 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:
- condition: template # A click can occasionally appear as a small rotation followed
value_template: "{{ (raw_angle | abs) >= (deadzone | float(0)) }}" # immediately by stop_rotating. Only treat it as a single press
# Only fire the turn_on service if there was a registrable angle change # if the stop_rotating packet actually follows.
- condition: template - conditions:
value_template: "{{ scaled_step != 0 }}" - condition: template
- service: light.turn_on value_template: "{{ (raw_angle | abs) < (deadzone | float(0)) }}"
target: !input target_light sequence:
data: - wait_for_trigger:
brightness_step_pct: "{{ scaled_step }}" - platform: mqtt
transition: !input dim_transition 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
- condition: template
value_template: "{{ scaled_step != 0 }}"
- service: light.turn_on
target: !input target_light
data:
brightness_step_pct: "{{ scaled_step }}"
transition: !input dim_transition