diff --git a/blueprints/controllers/philips_324131092621/philips_324131092621.yaml b/blueprints/controllers/philips_324131092621/philips_324131092621.yaml index 4957f40b..d76afa69 100644 --- a/blueprints/controllers/philips_324131092621/philips_324131092621.yaml +++ b/blueprints/controllers/philips_324131092621/philips_324131092621.yaml @@ -321,18 +321,18 @@ variables: button_down_long: [down_hold] button_down_release: [down_long_release] zigbee2mqtt: - button_on_short: [on-press] - button_on_long: [on-hold] - button_on_release: [on-hold-release] - button_off_short: [off-press] - button_off_long: [off-hold] - button_off_release: [off-hold-release] - button_up_short: [up-press] - button_up_long: [up-hold] - button_up_release: [up-hold-release] - button_down_short: [down-press] - button_down_long: [down-hold] - button_down_release: [down-hold-release] + button_on_short: [on_press_release] + button_on_long: [on_hold] + button_on_release: [on_hold_release] + button_off_short: [off_press_release] + button_off_long: [off_hold] + button_off_release: [off_hold_release] + button_up_short: [up_press_release] + button_up_long: [up_hold] + button_up_release: [up_hold_release] + button_down_short: [down_press_release] + button_down_long: [down_hold] + button_down_release: [down_hold_release] # pre-choose actions for buttons based on configured integration # no need to perform this task at automation runtime button_on_short: '{{ actions_mapping[integration_id]["button_on_short"] }}' @@ -380,7 +380,7 @@ condition: {{ trigger.event.data.command }} {%- endif -%} {%- endset -%} - {{ trigger_action not in ["","None"] }} + {{ trigger_action not in ["","None", "on_press", "up_press", "down_press", "off_press"] }} # only for zigbee2mqtt, check if the event is relative to a real state change, and not only some minor changes in the sensor attributes # this is required since multiple state_changed events are fired for a single button press, with the result of the automation being triggered multiple times - '{{ integration_id != "zigbee2mqtt" or trigger.event.data.new_state.state != trigger.event.data.old_state.state }}' @@ -401,7 +401,8 @@ action: {%- elif integration_id == "zha" -%} {{ trigger.event.data.command }} {%- endif -%} - trigger_delta: '{{ (as_timestamp(now()) - ((states(helper_last_controller_event) | from_json).t if helper_last_controller_event is not none and (states(helper_last_controller_event) | regex_match("^\{((\"a\": \".*\"|\"t\": \d+\.\d+)(, )?){2}\}$")) else as_timestamp("1970-01-01 00:00:00"))) * 1000 }}' + # helper_last_controller_event example: {"a":"on_press_release","t":1706926380.358825} + trigger_delta: '{{ (as_timestamp(now()) - ((states(helper_last_controller_event) | from_json).t if helper_last_controller_event is not none and (states(helper_last_controller_event) | regex_match("^\{((\"a\":\s*\".*\"|\"t\":\s*\d+\.\d+)(,\s*)?){2}\}$")) else as_timestamp("1970-01-01 00:00:00"))) * 1000 }}' # update helper - service: input_text.set_value data: @@ -489,7 +490,7 @@ action: - choose: - conditions: [] sequence: !input action_button_on_release - - conditions: '{{ trigger_action | string in button_off_short }}' + - conditions: "{{ trigger_action | string in button_off_short }}" sequence: - choose: # if double press event is enabled