diff --git a/aqara-h2-eu-dimmer-z2m-light-control.yaml b/aqara-h2-eu-dimmer-z2m-light-control.yaml index aa6ba18..0ad92f2 100644 --- a/aqara-h2-eu-dimmer-z2m-light-control.yaml +++ b/aqara-h2-eu-dimmer-z2m-light-control.yaml @@ -111,6 +111,14 @@ max: 15 trigger: - platform: mqtt topic: !input mqtt_topic + payload: "action" + value_template: > + {{ 'action' + if value_json is defined + and value_json.action is defined + and value_json.action is not none + and (value_json.action | string | length > 0) + else 'ignore' }} action: - variables: @@ -121,6 +129,8 @@ action: # Time since the previous MQTT event triggered this automation. # Genuine stop_rotating events immediately follow rotation events. # The H2 bug emits a stray stop_rotating after the device has been idle. + # Null/missing action packets are filtered at the MQTT trigger above, + # so only genuine action events affect this timer. idle_seconds: > {{ as_timestamp(now()) - as_timestamp( @@ -210,4 +220,4 @@ action: target: !input target_light data: brightness_step_pct: "{{ scaled_step }}" - transition: !input dim_transition + transition: !input dim_transition \ No newline at end of file