You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using this BP with Zigbee2MQTT, the automation never gets past the first condition, as shown in the automation's trace page. I am not skillful enough to determine the exact cause when looking at the code.
Automation YAML config
blueprint:
name: Controller - Philips 324131092621 Hue Dimmer switchdescription: "# Controller - Philips 324131092621 Hue Dimmer switch\n\nController automation for executing any kind of action triggered by the provided Philips 324131092621 Hue Dimmer switch. Allows to optionally loop an action on a button long press.\nSupports deCONZ, ZHA, Zigbee2MQTT.\n\nAutomations created with this blueprint can be connected with one or more [Hooks](https://epmatt.github.io/awesome-ha-blueprints/docs/blueprints/hooks) supported by this controller.\nHooks allow to easily create controller-based automations for interacting with media players, lights, covers and more.\nSee the list of [Hooks available for this controller](https://epmatt.github.io/awesome-ha-blueprints/docs/blueprints/controllers/philips_324131092621#available-hooks) for additional details.\n\n\U0001F4D5 Full documentation regarding this blueprint is available [here](https://epmatt.github.io/awesome-ha-blueprints/docs/blueprints/controllers/philips_324131092621).\n\n\U0001F680 This blueprint is part of the **[Awesome HA Blueprints](https://epmatt.github.io/awesome-ha-blueprints) project**.\n\nℹ️ Version 2022.08.08\n"source_url: https://github.com/EPMatt/awesome-ha-blueprints/blob/main/blueprints/controllers/philips_324131092621/philips_324131092621.yamldomain: automationinput:
integration:
name: (Required) Integrationdescription: Integration used for connecting the remote with Home Assistant.Select one of the available values.selector:
select:
options:
- deCONZ
- ZHA
- Zigbee2MQTTcustom_value: falsemultiple: falsecontroller_device:
name: (deCONZ, ZHA) Controller Devicedescription: The controller device to use for the automation. Choose a valueonly if the remote is integrated with deCONZ, ZHA.default: ''selector:
device: {}controller_entity:
name: (Zigbee2MQTT) Controller Entitydescription: The action sensor of the controller to use for the automation.Choose a value only if the remote is integrated with Zigbee2MQTT.default: ''selector:
entity:
domain:
- sensormultiple: falsehelper_last_controller_event:
name: (Required) Helper - Last Controller Eventdescription: Input Text used to store the last event fired by the controller.You will need to manually create a text input entity for this, please readthe blueprint Additional Notes for more info.default: ''selector:
entity:
domain:
- input_textmultiple: falseaction_button_on_short:
name: (Optional) On button short pressdescription: Action to run on short on button press.default: []selector:
action: {}action_button_on_long:
name: (Optional) On button long pressdescription: Action to run on long on button press.default: []selector:
action: {}action_button_on_release:
name: (Optional) On button releasedescription: Action to run on on button release after long press.default: []selector:
action: {}action_button_on_double:
name: (Optional) On button double pressdescription: Action to run on double on button press.default: []selector:
action: {}action_button_off_short:
name: (Optional) Off button short pressdescription: Action to run on short off button press.default: []selector:
action: {}action_button_off_long:
name: (Optional) Off button long pressdescription: Action to run on long off button press.default: []selector:
action: {}action_button_off_release:
name: (Optional) Off button releasedescription: Action to run on off button release after long press.default: []selector:
action: {}action_button_off_double:
name: (Optional) Off button double pressdescription: Action to run on double off button press.default: []selector:
action: {}action_button_up_short:
name: (Optional) Up button short pressdescription: Action to run on short up button press.default: []selector:
action: {}action_button_up_long:
name: (Optional) Up button long pressdescription: Action to run on long up button press.default: []selector:
action: {}action_button_up_release:
name: (Optional) Up button releasedescription: Action to run on up button release after long press.default: []selector:
action: {}action_button_up_double:
name: (Optional) Up button double pressdescription: Action to run on double up button press.default: []selector:
action: {}action_button_down_short:
name: (Optional) Down button short pressdescription: Action to run on short down button press.default: []selector:
action: {}action_button_down_long:
name: (Optional) Down button long pressdescription: Action to run on long down button press.default: []selector:
action: {}action_button_down_release:
name: (Optional) Down button releasedescription: Action to run on down button release after long press.default: []selector:
action: {}action_button_down_double:
name: (Optional) Down button double pressdescription: Action to run on double down button press.default: []selector:
action: {}button_on_long_loop:
name: (Optional) On button long press - loop until releasedescription: Loop the on button action until the button is released.default: falseselector:
boolean: {}button_on_long_max_loop_repeats:
name: (Optional) On button long press - Maximum loop repeatsdescription: Maximum number of repeats for the custom action, when looping isenabled. Use it as a safety limit to prevent an endless loop in case the correspondingstop event is not received.default: 500selector:
number:
min: 1.0max: 5000.0mode: sliderstep: 1.0button_off_long_loop:
name: (Optional) Off button long press - loop until releasedescription: Loop the off button action until the button is released.default: falseselector:
boolean: {}button_off_long_max_loop_repeats:
name: (Optional) Off button long press - Maximum loop repeatsdescription: Maximum number of repeats for the custom action, when looping isenabled. Use it as a safety limit to prevent an endless loop in case the correspondingstop event is not received.default: 500selector:
number:
min: 1.0max: 5000.0mode: sliderstep: 1.0button_up_long_loop:
name: (Optional) Up button long press - loop until releasedescription: Loop the up button action until the button is released.default: falseselector:
boolean: {}button_up_long_max_loop_repeats:
name: (Optional) Up button long press - Maximum loop repeatsdescription: Maximum number of repeats for the custom action, when looping isenabled. Use it as a safety limit to prevent an endless loop in case the correspondingstop event is not received.default: 500selector:
number:
min: 1.0max: 5000.0mode: sliderstep: 1.0button_down_long_loop:
name: (Optional) Down button long press - loop until releasedescription: Loop the down button action until the button is released.default: falseselector:
boolean: {}button_down_long_max_loop_repeats:
name: (Optional) Down button long press - Maximum loop repeatsdescription: Maximum number of repeats for the custom action, when looping isenabled. Use it as a safety limit to prevent an endless loop in case the correspondingstop event is not received.default: 500selector:
number:
min: 1.0max: 5000.0mode: sliderstep: 1.0button_on_double_press:
name: (Optional) Expose on button double press eventdescription: Choose whether or not to expose the virtual double press eventfor the on button. Turn this on if you are providing an action for the onbutton double press event.default: falseselector:
boolean: {}button_off_double_press:
name: (Optional) Expose off button double press eventdescription: Choose whether or not to expose the virtual double press eventfor the off button. Turn this on if you are providing an action for the offbutton double press event.default: falseselector:
boolean: {}button_up_double_press:
name: (Optional) Expose up button double press eventdescription: Choose whether or not to expose the virtual double press eventfor the up button. Turn this on if you are providing an action for the upbutton double press event.default: falseselector:
boolean: {}button_down_double_press:
name: (Optional) Expose down button double press eventdescription: Choose whether or not to expose the virtual double press eventfor the down button. Turn this on if you are providing an action for the downbutton double press event.default: falseselector:
boolean: {}helper_double_press_delay:
name: (Optional) Helper - Double Press delaydescription: Max delay between the first and the second button press for thedouble press event. Provide a value only if you are using a double press action.Increase this value if you notice that the double press action is not triggeredproperly.default: 500selector:
number:
min: 100.0max: 5000.0unit_of_measurement: millisecondsmode: boxstep: 10.0helper_debounce_delay:
name: (Optional) Helper - Debounce delaydescription: Delay used for debouncing RAW controller events, by default setto 0. A value of 0 disables the debouncing feature. Increase this value ifyou notice custom actions or linked Hooks running multiple times when interactingwith the device. When the controller needs to be debounced, usually a valueof 100 is enough to remove all duplicate events.default: 0selector:
number:
min: 0.0max: 1000.0unit_of_measurement: millisecondsmode: boxstep: 10.0variables:
integration: !input integrationbutton_on_long_loop: !input button_on_long_loopbutton_on_long_max_loop_repeats: !input button_on_long_max_loop_repeatsbutton_on_double_press: !input button_on_double_pressbutton_off_long_loop: !input button_off_long_loopbutton_off_long_max_loop_repeats: !input button_off_long_max_loop_repeatsbutton_off_double_press: !input button_off_double_pressbutton_up_long_loop: !input button_up_long_loopbutton_up_long_max_loop_repeats: !input button_up_long_max_loop_repeatsbutton_up_double_press: !input button_up_double_pressbutton_down_long_loop: !input button_down_long_loopbutton_down_long_max_loop_repeats: !input button_down_long_max_loop_repeatsbutton_down_double_press: !input button_down_double_presshelper_last_controller_event: !input helper_last_controller_eventhelper_double_press_delay: !input helper_double_press_delayhelper_debounce_delay: !input helper_debounce_delayintegration_id: '{{ integration | lower }}'adjusted_double_press_delay: '{{ [helper_double_press_delay - helper_debounce_delay, 100] | max }}'actions_mapping:
deconz:
button_on_short:
- '1000'button_on_long:
- '1001'button_on_release:
- '1003'button_off_short:
- '4000'button_off_long:
- '4001'button_off_release:
- '4003'button_up_short:
- '2000'button_up_long:
- '2001'button_up_release:
- '2003'button_down_short:
- '3000'button_down_long:
- '3001'button_down_release:
- '3003'zha:
button_on_short:
- on_short_releasebutton_on_long:
- on_holdbutton_on_release:
- on_long_releasebutton_off_short:
- off_short_releasebutton_off_long:
- off_holdbutton_off_release:
- off_long_releasebutton_up_short:
- up_short_releasebutton_up_long:
- up_holdbutton_up_release:
- up_long_releasebutton_down_short:
- down_short_releasebutton_down_long:
- down_holdbutton_down_release:
- down_long_releasezigbee2mqtt:
button_on_short:
- on_pressbutton_on_long:
- on_holdbutton_on_release:
- on_hold_releasebutton_off_short:
- off_pressbutton_off_long:
- off_holdbutton_off_release:
- off_hold_releasebutton_up_short:
- up_pressbutton_up_long:
- up_holdbutton_up_release:
- up_hold_releasebutton_down_short:
- down_pressbutton_down_long:
- down_holdbutton_down_release:
- down_hold_releasebutton_on_short: '{{ actions_mapping[integration_id]["button_on_short"] }}'button_on_long: '{{ actions_mapping[integration_id]["button_on_long"] }}'button_on_release: '{{ actions_mapping[integration_id]["button_on_release"] }}'button_off_short: '{{ actions_mapping[integration_id]["button_off_short"] }}'button_off_long: '{{ actions_mapping[integration_id]["button_off_long"] }}'button_off_release: '{{ actions_mapping[integration_id]["button_off_release"] }}'button_up_short: '{{ actions_mapping[integration_id]["button_up_short"] }}'button_up_long: '{{ actions_mapping[integration_id]["button_up_long"] }}'button_up_release: '{{ actions_mapping[integration_id]["button_up_release"] }}'button_down_short: '{{ actions_mapping[integration_id]["button_down_short"] }}'button_down_long: '{{ actions_mapping[integration_id]["button_down_long"] }}'button_down_release: '{{ actions_mapping[integration_id]["button_down_release"] }}'controller_entity: !input controller_entitycontroller_device: !input controller_devicecontroller_id: '{% if integration_id=="zigbee2mqtt" %}{{controller_entity}}{% else %}{{controller_device}}{% endif %}'mode: restartmax_exceeded: silenttrigger:
- platform: eventevent_type: state_changedevent_data:
entity_id: !input controller_entity
- platform: eventevent_type:
- deconz_event
- zha_eventevent_data:
device_id: !input controller_devicecondition:
- condition: andconditions:
- '{%- set trigger_action -%} {%- if integration_id == "zigbee2mqtt" -%} {{ trigger.event.data.new_state.state }} {%- elif integration_id == "deconz" -%} {{ trigger.event.data.event }} {%- elif integration_id == "zha" -%} {{ trigger.event.data.command }} {%- endif -%} {%- endset -%} {{ trigger_action not in ["","None"] }}'
- '{{ integration_id != "zigbee2mqtt" or trigger.event.data.new_state.state != trigger.event.data.old_state.state }}'action:
- delay:
milliseconds: !input helper_debounce_delay
- variables:
trigger_action: '{%- if integration_id == "zigbee2mqtt" -%} {{ trigger.event.data.new_state.state }} {%- elif integration_id == "deconz" -%} {{ trigger.event.data.event }} {%- 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 }}'
- service: input_text.set_valuedata:
entity_id: !input helper_last_controller_eventvalue: '{{ {"a":trigger_action,"t":as_timestamp(now())} | to_json }}'
- choose:
- conditions: '{{ trigger_action | string in button_on_short }}'sequence:
- choose:
- conditions: '{{ button_on_double_press }}'sequence:
- choose:
- conditions: '{{ trigger_action | string in states(helper_last_controller_event) and trigger_delta | int <= helper_double_press_delay | int }}'sequence:
- service: input_text.set_valuedata:
entity_id: !input helper_last_controller_eventvalue: '{{ {"a":"double_press","t":as_timestamp(now())} | to_json }}'
- event: ahb_controller_eventevent_data:
controller: '{{ controller_id }}'action: button_on_double
- choose:
- conditions: []sequence: !input action_button_on_doubledefault:
- delay:
milliseconds: '{{ adjusted_double_press_delay }}'
- event: ahb_controller_eventevent_data:
controller: '{{ controller_id }}'action: button_on_short
- choose:
- conditions: []sequence: !input action_button_on_shortdefault:
- event: ahb_controller_eventevent_data:
controller: '{{ controller_id }}'action: button_on_short
- choose:
- conditions: []sequence: !input action_button_on_short
- conditions: '{{ trigger_action | string in button_on_long }}'sequence:
- event: ahb_controller_eventevent_data:
controller: '{{ controller_id }}'action: button_on_long
- choose:
- conditions: '{{ button_on_long_loop }}'sequence:
- repeat:
while: '{{ repeat.index < button_on_long_max_loop_repeats | int }}'sequence: !input action_button_on_longdefault: !input action_button_on_long
- conditions: '{{ trigger_action | string in button_on_release }}'sequence:
- event: ahb_controller_eventevent_data:
controller: '{{ controller_id }}'action: button_on_release
- choose:
- conditions: []sequence: !input action_button_on_release
- conditions: '{{ trigger_action | string in button_off_short }}'sequence:
- choose:
- conditions: '{{ button_off_double_press }}'sequence:
- choose:
- conditions: '{{ trigger_action | string in states(helper_last_controller_event) and trigger_delta | int <= helper_double_press_delay | int }}'sequence:
- service: input_text.set_valuedata:
entity_id: !input helper_last_controller_eventvalue: '{{ {"a":"double_press","t":as_timestamp(now())} | to_json }}'
- event: ahb_controller_eventevent_data:
controller: '{{ controller_id }}'action: button_off_double
- choose:
- conditions: []sequence: !input action_button_off_doubledefault:
- delay:
milliseconds: '{{ adjusted_double_press_delay }}'
- event: ahb_controller_eventevent_data:
controller: '{{ controller_id }}'action: button_off_short
- choose:
- conditions: []sequence: !input action_button_off_shortdefault:
- event: ahb_controller_eventevent_data:
controller: '{{ controller_id }}'action: button_off_short
- choose:
- conditions: []sequence: !input action_button_off_short
- conditions: '{{ trigger_action | string in button_off_long }}'sequence:
- event: ahb_controller_eventevent_data:
controller: '{{ controller_id }}'action: button_off_long
- choose:
- conditions: '{{ button_off_long_loop }}'sequence:
- repeat:
while: '{{ repeat.index < button_off_long_max_loop_repeats | int }}'sequence: !input action_button_off_longdefault: !input action_button_off_long
- conditions: '{{ trigger_action | string in button_off_release }}'sequence:
- event: ahb_controller_eventevent_data:
controller: '{{ controller_id }}'action: button_off_release
- choose:
- conditions: []sequence: !input action_button_off_release
- conditions: '{{ trigger_action | string in button_up_short }}'sequence:
- choose:
- conditions: '{{ button_up_double_press }}'sequence:
- choose:
- conditions: '{{ trigger_action | string in states(helper_last_controller_event) and trigger_delta | int <= helper_double_press_delay | int }}'sequence:
- service: input_text.set_valuedata:
entity_id: !input helper_last_controller_eventvalue: '{{ {"a":"double_press","t":as_timestamp(now())} | to_json }}'
- event: ahb_controller_eventevent_data:
controller: '{{ controller_id }}'action: button_up_double
- choose:
- conditions: []sequence: !input action_button_up_doubledefault:
- delay:
milliseconds: '{{ adjusted_double_press_delay }}'
- event: ahb_controller_eventevent_data:
controller: '{{ controller_id }}'action: button_up_short
- choose:
- conditions: []sequence: !input action_button_up_shortdefault:
- event: ahb_controller_eventevent_data:
controller: '{{ controller_id }}'action: button_up_short
- choose:
- conditions: []sequence: !input action_button_up_short
- conditions: '{{ trigger_action | string in button_up_long }}'sequence:
- event: ahb_controller_eventevent_data:
controller: '{{ controller_id }}'action: button_up_long
- choose:
- conditions: '{{ button_up_long_loop }}'sequence:
- repeat:
while: '{{ repeat.index < button_up_long_max_loop_repeats | int }}'sequence: !input action_button_up_longdefault: !input action_button_up_long
- conditions: '{{ trigger_action | string in button_up_release }}'sequence:
- event: ahb_controller_eventevent_data:
controller: '{{ controller_id }}'action: button_up_release
- choose:
- conditions: []sequence: !input action_button_up_release
- conditions: '{{ trigger_action | string in button_down_short }}'sequence:
- choose:
- conditions: '{{ button_down_double_press }}'sequence:
- choose:
- conditions: '{{ trigger_action | string in states(helper_last_controller_event) and trigger_delta | int <= helper_double_press_delay | int }}'sequence:
- service: input_text.set_valuedata:
entity_id: !input helper_last_controller_eventvalue: '{{ {"a":"double_press","t":as_timestamp(now())} | to_json }}'
- event: ahb_controller_eventevent_data:
controller: '{{ controller_id }}'action: button_down_double
- choose:
- conditions: []sequence: !input action_button_down_doubledefault:
- delay:
milliseconds: '{{ adjusted_double_press_delay }}'
- event: ahb_controller_eventevent_data:
controller: '{{ controller_id }}'action: button_down_short
- choose:
- conditions: []sequence: !input action_button_down_shortdefault:
- event: ahb_controller_eventevent_data:
controller: '{{ controller_id }}'action: button_down_short
- choose:
- conditions: []sequence: !input action_button_down_short
- conditions: '{{ trigger_action | string in button_down_long }}'sequence:
- event: ahb_controller_eventevent_data:
controller: '{{ controller_id }}'action: button_down_long
- choose:
- conditions: '{{ button_down_long_loop }}'sequence:
- repeat:
while: '{{ repeat.index < button_down_long_max_loop_repeats | int }}'sequence: !input action_button_down_longdefault: !input action_button_down_long
- conditions: '{{ trigger_action | string in button_down_release }}'sequence:
- event: ahb_controller_eventevent_data:
controller: '{{ controller_id }}'action: button_down_release
- choose:
- conditions: []sequence: !input action_button_down_release
To Reproduce
Create automation using Zigbee2MQTT
Locate the created automation in 'Automations and Scenes"
Right Click on 'Traces'
Click on 'Step Details' tab or 'Trace Timeline' tab.
See error in Trace Timeline tab:
'Stopped because a condition failed at Month, Date, Year at time (runtime: 0.00 seconds)'
Or see error in Step Details tab:
Executed: August 2, 2023 at 10:52:46 PM
Result:
result: false
conditions/0
Executed: August 2, 2023 at 10:52:46 PM
Result:
result: false
entities: []
Expected behavior
When a button is pressed on the controller, the action as prescribed in the automation made from the blueprint should activate.
Actual Behaviour
When a button is pressed on the controller, it is accepted and logged within the device, and the automation, but does not activate the command.
Additional Details
I'd like to help developing a fix for this issue.
Screenshots
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
Blueprint name
24131092621
Home Assistant Core Version
2023.7.3
Home Assistant Installation Type
Home Assistant Operating System
Description
When using this BP with Zigbee2MQTT, the automation never gets past the first condition, as shown in the automation's trace page. I am not skillful enough to determine the exact cause when looking at the code.
Automation YAML config
To Reproduce
Expected behavior
When a button is pressed on the controller, the action as prescribed in the automation made from the blueprint should activate.
Actual Behaviour
When a button is pressed on the controller, it is accepted and logged within the device, and the automation, but does not activate the command.
Additional Details
Screenshots
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: