Created
February 26, 2026 12:17
-
-
Save janek26/1c35d7f0103b532feb9029fe5b743f8f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Blueprint metadata | |
| blueprint: | |
| name: Controller - Philips 929002398602 Hue Dimmer switch v2 | |
| description: | | |
| # Controller - Philips 929002398602 Hue Dimmer switch v2 | |
| Controller automation for executing any kind of action triggered by the provided Philips 929002398602 Hue Dimmer switch v2. Allows to optionally loop an action on a button long press. | |
| Supports ZHA, Zigbee2MQTT. | |
| Automations 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. | |
| Hooks allow to easily create controller-based automations for interacting with media players, lights, covers and more. | |
| See the list of [Hooks available for this controller](https://epmatt.github.io/awesome-ha-blueprints/docs/blueprints/controllers/philips_929002398602#available-hooks) for additional details. | |
| ## More Info | |
| ℹ️ Version 2025.04.19 | |
| 📝 [Changelog](https://epmatt.github.io/awesome-ha-blueprints/docs/blueprints/controllers/philips_929002398602/#changelog) | |
| 📕 Full documentation regarding this blueprint is available [here](https://epmatt.github.io/awesome-ha-blueprints/docs/blueprints/controllers/philips_929002398602). | |
| 🚀 This blueprint is part of the **[Awesome HA Blueprints](https://epmatt.github.io/awesome-ha-blueprints) project**. Please consider **[leaving a star on GitHub](https://github.com/EPMatt/awesome-ha-blueprints)**! 🌟 | |
| source_url: https://github.com/EPMatt/awesome-ha-blueprints/blob/main/blueprints/controllers/philips_929002398602/philips_929002398602.yaml | |
| domain: automation | |
| homeassistant: | |
| min_version: 2024.10.0 | |
| input: | |
| integration: | |
| name: (Required) Integration | |
| description: Integration used for connecting the remote with Home Assistant. Select one of the available values. | |
| selector: | |
| select: | |
| options: | |
| - ZHA | |
| - Zigbee2MQTT | |
| controller_device: | |
| name: (ZHA, Zigbee2MQTT Required) Controller Device | |
| description: The controller device to use for the automation. Choose a value only if the remote is integrated with deCONZ, ZHA, Zigbee2MQTT. | |
| default: '' | |
| selector: | |
| device: | |
| filter: | |
| # source: https://www.zigbee2mqtt.io/devices/929002398602.html#philips-929002398602 | |
| - integration: mqtt | |
| manufacturer: Philips | |
| model: Hue dimmer switch | |
| # For backwards compatability with z2m 1.x. model_id is added to end of model rather than a seperate attribute in z2m 2.x | |
| - integration: mqtt | |
| manufacturer: Philips | |
| model: Hue dimmer switch (929002398602) | |
| # source: https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/Supported-Devices | |
| - integration: zha | |
| manufacturer: Philips | |
| # **TBConfirmed** model: | |
| - integration: zha | |
| manufacturer: Signify | |
| - integration: zha | |
| manufacturer: Signify Netherlands B.V. | |
| - integration: deconz | |
| manufacturer: Philips | |
| # **TBConfirmed** model: | |
| multiple: false | |
| helper_last_controller_event: | |
| name: (Required) Helper - Last Controller Event | |
| description: 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 read the blueprint Additional Notes for more info. | |
| default: '' | |
| selector: | |
| entity: | |
| domain: input_text | |
| # inputs for custom actions | |
| action_button_on_short: | |
| name: (Optional) On button short press | |
| description: Action to run on short on button press. | |
| default: [] | |
| selector: | |
| action: | |
| action_button_on_long: | |
| name: (Optional) On button long press | |
| description: Action to run on long on button press. | |
| default: [] | |
| selector: | |
| action: | |
| action_button_on_release: | |
| name: (Optional) On button release | |
| description: Action to run on on button release after long press. | |
| default: [] | |
| selector: | |
| action: | |
| action_button_on_double: | |
| name: (Optional) (Virtual) On button double press | |
| description: Action to run on double on button press. | |
| default: [] | |
| selector: | |
| action: | |
| action_button_off_short: | |
| name: (Optional) Off button short press | |
| description: Action to run on short off button press. | |
| default: [] | |
| selector: | |
| action: | |
| action_button_off_long: | |
| name: (Optional) Off button long press | |
| description: Action to run on long off button press. | |
| default: [] | |
| selector: | |
| action: | |
| action_button_off_release: | |
| name: (Optional) Off button release | |
| description: Action to run on off button release after long press. | |
| default: [] | |
| selector: | |
| action: | |
| action_button_off_double: | |
| name: (Optional) (Virtual) Off button double press | |
| description: Action to run on double off button press. | |
| default: [] | |
| selector: | |
| action: | |
| action_button_up_short: | |
| name: (Optional) Up button short press | |
| description: Action to run on short up button press. | |
| default: [] | |
| selector: | |
| action: | |
| action_button_up_long: | |
| name: (Optional) Up button long press | |
| description: Action to run on long up button press. | |
| default: [] | |
| selector: | |
| action: | |
| action_button_up_release: | |
| name: (Optional) Up button release | |
| description: Action to run on up button release after long press. | |
| default: [] | |
| selector: | |
| action: | |
| action_button_up_double: | |
| name: (Optional) (Virtual) Up button double press | |
| description: Action to run on double up button press. | |
| default: [] | |
| selector: | |
| action: | |
| action_button_down_short: | |
| name: (Optional) Down button short press | |
| description: Action to run on short down button press. | |
| default: [] | |
| selector: | |
| action: | |
| action_button_down_long: | |
| name: (Optional) Down button long press | |
| description: Action to run on long down button press. | |
| default: [] | |
| selector: | |
| action: | |
| action_button_down_release: | |
| name: (Optional) Down button release | |
| description: Action to run on down button release after long press. | |
| default: [] | |
| selector: | |
| action: | |
| action_button_down_double: | |
| name: (Optional) (Virtual) Down button double press | |
| description: Action to run on double down button press. | |
| default: [] | |
| selector: | |
| action: | |
| # inputs for looping custom actions on long button press events until the corresponding release event is received | |
| button_on_long_loop: | |
| name: (Optional) On button long press - loop until release | |
| description: Loop the on button action until the button is released. | |
| default: false | |
| selector: | |
| boolean: | |
| button_on_long_max_loop_repeats: | |
| name: (Optional) On button long press - Maximum loop repeats | |
| description: >- | |
| Maximum number of repeats for the custom action, when looping is enabled. | |
| Use it as a safety limit to prevent an endless loop in case the corresponding stop event is not received. | |
| default: 500 | |
| selector: | |
| number: | |
| min: 1 | |
| max: 5000 | |
| mode: slider | |
| step: 1 | |
| button_off_long_loop: | |
| name: (Optional) Off button long press - loop until release | |
| description: Loop the off button action until the button is released. | |
| default: false | |
| selector: | |
| boolean: | |
| button_off_long_max_loop_repeats: | |
| name: (Optional) Off button long press - Maximum loop repeats | |
| description: >- | |
| Maximum number of repeats for the custom action, when looping is enabled. | |
| Use it as a safety limit to prevent an endless loop in case the corresponding stop event is not received. | |
| default: 500 | |
| selector: | |
| number: | |
| min: 1 | |
| max: 5000 | |
| mode: slider | |
| step: 1 | |
| button_up_long_loop: | |
| name: (Optional) Up button long press - loop until release | |
| description: Loop the up button action until the button is released. | |
| default: false | |
| selector: | |
| boolean: | |
| button_up_long_max_loop_repeats: | |
| name: (Optional) Up button long press - Maximum loop repeats | |
| description: >- | |
| Maximum number of repeats for the custom action, when looping is enabled. | |
| Use it as a safety limit to prevent an endless loop in case the corresponding stop event is not received. | |
| default: 500 | |
| selector: | |
| number: | |
| min: 1 | |
| max: 5000 | |
| mode: slider | |
| step: 1 | |
| button_down_long_loop: | |
| name: (Optional) Down button long press - loop until release | |
| description: Loop the down button action until the button is released. | |
| default: false | |
| selector: | |
| boolean: | |
| button_down_long_max_loop_repeats: | |
| name: (Optional) Down button long press - Maximum loop repeats | |
| description: >- | |
| Maximum number of repeats for the custom action, when looping is enabled. | |
| Use it as a safety limit to prevent an endless loop in case the corresponding stop event is not received. | |
| default: 500 | |
| selector: | |
| number: | |
| min: 1 | |
| max: 5000 | |
| mode: slider | |
| step: 1 | |
| # inputs for enabling double press events | |
| button_on_double_press: | |
| name: (Optional) Expose on button double press event | |
| description: Choose whether or not to expose the virtual double press event for the on button. Turn this on if you are providing an action for the on button double press event. | |
| default: false | |
| selector: | |
| boolean: | |
| button_off_double_press: | |
| name: (Optional) Expose off button double press event | |
| description: Choose whether or not to expose the virtual double press event for the off button. Turn this on if you are providing an action for the off button double press event. | |
| default: false | |
| selector: | |
| boolean: | |
| button_up_double_press: | |
| name: (Optional) Expose up button double press event | |
| description: Choose whether or not to expose the virtual double press event for the up button. Turn this on if you are providing an action for the up button double press event. | |
| default: false | |
| selector: | |
| boolean: | |
| button_down_double_press: | |
| name: (Optional) Expose down button double press event | |
| description: Choose whether or not to expose the virtual double press event for the down button. Turn this on if you are providing an action for the down button double press event. | |
| default: false | |
| selector: | |
| boolean: | |
| # helpers used to properly recognize the remote button events | |
| helper_double_press_delay: | |
| name: (Optional) Helper - Double Press delay | |
| description: Max delay between the first and the second button press for the double 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 triggered properly. | |
| default: 500 | |
| selector: | |
| number: | |
| min: 100 | |
| max: 5000 | |
| unit_of_measurement: milliseconds | |
| mode: box | |
| step: 10 | |
| helper_debounce_delay: | |
| name: (Optional) Helper - Debounce delay | |
| description: | |
| Delay used for debouncing RAW controller events, by default set to 0. A value of 0 disables the debouncing feature. Increase this value if you notice custom actions or linked Hooks running multiple times when interacting with the device. When the controller needs to be debounced, | |
| usually a value of 100 is enough to remove all duplicate events. | |
| default: 0 | |
| selector: | |
| number: | |
| min: 0 | |
| max: 1000 | |
| unit_of_measurement: milliseconds | |
| mode: box | |
| step: 10 | |
| # Automation schema | |
| variables: | |
| ahb_version: 2025.11.04 | |
| ahb_maintainers: [EPMatt] | |
| # convert input tags to variables, to be used in templates | |
| integration: !input integration | |
| button_on_long_loop: !input button_on_long_loop | |
| button_on_long_max_loop_repeats: !input button_on_long_max_loop_repeats | |
| button_on_double_press: !input button_on_double_press | |
| button_off_long_loop: !input button_off_long_loop | |
| button_off_long_max_loop_repeats: !input button_off_long_max_loop_repeats | |
| button_off_double_press: !input button_off_double_press | |
| button_up_long_loop: !input button_up_long_loop | |
| button_up_long_max_loop_repeats: !input button_up_long_max_loop_repeats | |
| button_up_double_press: !input button_up_double_press | |
| button_down_long_loop: !input button_down_long_loop | |
| button_down_long_max_loop_repeats: !input button_down_long_max_loop_repeats | |
| button_down_double_press: !input button_down_double_press | |
| helper_last_controller_event: !input helper_last_controller_event | |
| helper_double_press_delay: !input helper_double_press_delay | |
| helper_debounce_delay: !input helper_debounce_delay | |
| # integration id used to select items in the action mapping | |
| integration_id: '{{ integration | lower }}' | |
| # adjusted debounce delay so that the resulting double press delay is exactly as specified by the user when running the action, taking also account of debouncing | |
| # make sure it never goes below the minimum double press delay | |
| adjusted_double_press_delay: '{{ [helper_double_press_delay - helper_debounce_delay, 100] | max }}' | |
| # mapping between actions and integrations | |
| actions_mapping: | |
| zha: | |
| button_on_short: [on_press, on_press_release] | |
| button_on_long: [on_hold] | |
| button_on_release: [on_long_release] | |
| button_off_short: [off_press, off_press_release] | |
| button_off_long: [off_hold] | |
| button_off_release: [off_long_release] | |
| button_up_short: [up_press] | |
| button_up_long: [up_hold] | |
| button_up_release: [up_long_release] | |
| button_down_short: [down_press] | |
| button_down_long: [down_hold] | |
| button_down_release: [down_long_release] | |
| zigbee2mqtt: | |
| # source: https://www.zigbee2mqtt.io/devices/929002398602.html#philips-929002398602 | |
| button_on_short: [on_press, on_press_release] | |
| button_on_long: [on_hold] | |
| button_on_release: [on_hold_release] | |
| button_off_short: [off_press, off_press_release] | |
| 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] | |
| # 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"] }}' | |
| 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"] }}' | |
| # build data to send within a controller event | |
| controller_id: !input controller_device | |
| mode: restart | |
| max_exceeded: silent | |
| triggers: | |
| # triggers for zigbee2mqtt mqtt device action | |
| - trigger: device | |
| domain: mqtt | |
| device_id: !input controller_device | |
| type: action | |
| subtype: on_press | |
| - trigger: device | |
| domain: mqtt | |
| device_id: !input controller_device | |
| type: action | |
| subtype: on_press_release | |
| - trigger: device | |
| domain: mqtt | |
| device_id: !input controller_device | |
| type: action | |
| subtype: on_hold | |
| - trigger: device | |
| domain: mqtt | |
| device_id: !input controller_device | |
| type: action | |
| subtype: on_hold_release | |
| - trigger: device | |
| domain: mqtt | |
| device_id: !input controller_device | |
| type: action | |
| subtype: off_press | |
| - trigger: device | |
| domain: mqtt | |
| device_id: !input controller_device | |
| type: action | |
| subtype: off_press_release | |
| - trigger: device | |
| domain: mqtt | |
| device_id: !input controller_device | |
| type: action | |
| subtype: off_hold | |
| - trigger: device | |
| domain: mqtt | |
| device_id: !input controller_device | |
| type: action | |
| subtype: off_hold_release | |
| - trigger: device | |
| domain: mqtt | |
| device_id: !input controller_device | |
| type: action | |
| subtype: up_press | |
| - trigger: device | |
| domain: mqtt | |
| device_id: !input controller_device | |
| type: action | |
| subtype: up_hold | |
| - trigger: device | |
| domain: mqtt | |
| device_id: !input controller_device | |
| type: action | |
| subtype: up_hold_release | |
| - trigger: device | |
| domain: mqtt | |
| device_id: !input controller_device | |
| type: action | |
| subtype: down_press | |
| - trigger: device | |
| domain: mqtt | |
| device_id: !input controller_device | |
| type: action | |
| subtype: down_hold | |
| - trigger: device | |
| domain: mqtt | |
| device_id: !input controller_device | |
| type: action | |
| subtype: down_hold_release | |
| # triggers for other integrations | |
| - trigger: event | |
| event_type: | |
| - zha_event | |
| event_data: | |
| device_id: !input controller_device | |
| conditions: | |
| - condition: and | |
| conditions: | |
| # check that the button event is not empty | |
| - >- | |
| {%- set trigger_action -%} | |
| {%- if integration_id == "zigbee2mqtt" -%} | |
| {{ trigger.payload }} | |
| {%- elif integration_id == "deconz" -%} | |
| {{ trigger.event.data.event }} | |
| {%- elif integration_id == "zha" -%} | |
| {{ trigger.event.data.command }} | |
| {%- endif -%} | |
| {%- endset -%} | |
| {{ trigger_action not in ["","None"] }} | |
| actions: | |
| # debouncing - when automation is triggered multiple times, the last automation run is the one which completes execution, due to mode restart | |
| # therefore previous runs must wait for the debounce delay before executing any other action | |
| # if the delay expires and the automation is still running it means it's the last run and execution can continue | |
| - delay: | |
| milliseconds: !input helper_debounce_delay | |
| # extract button event from the trigger | |
| # provide a single string value to check against | |
| - variables: | |
| trigger_action: >- | |
| {%- if integration_id == "zigbee2mqtt" -%} | |
| {{ trigger.payload }} | |
| {%- elif integration_id == "deconz" -%} | |
| {{ trigger.event.data.event }} | |
| {%- elif integration_id == "zha" -%} | |
| {{ trigger.event.data.command }} | |
| {%- endif -%} | |
| deserialized_state: '{{ (states(helper_last_controller_event) | from_json) if helper_last_controller_event is not none and (states(helper_last_controller_event) | regex_match("^\{\s*?((\"a\":\s*?\".*\"|\"t\":\s*?\d+\.\d+)(,\s*?)?){2}\s*?\}$")) else {} }}' | |
| trigger_delta: '{{ (as_timestamp(now()) - (deserialized_state.t | default(0))) * 1000 }}' | |
| # update helper | |
| - action: input_text.set_value | |
| data: | |
| entity_id: !input helper_last_controller_event | |
| value: '{{ {"a":trigger_action,"t":as_timestamp(now())} | to_json }}' | |
| # choose the sequence to run based on the received button event | |
| - choose: | |
| - conditions: '{{ trigger_action | string in button_on_short }}' | |
| sequence: | |
| - choose: | |
| # if double press event is enabled | |
| - conditions: '{{ button_on_double_press }}' | |
| sequence: | |
| - choose: | |
| # if previous event was a short press | |
| - conditions: '{{ trigger_action | string == last_controller_event and trigger_delta | int <= helper_double_press_delay | int }}' | |
| sequence: | |
| # store the double press event in the last controller event helper | |
| - action: input_text.set_value | |
| data: | |
| entity_id: !input helper_last_controller_event | |
| value: '{{ {"a":"double_press_on","t":as_timestamp(now())} | to_json }}' | |
| # run the double press action | |
| # fire the event | |
| - event: ahb_controller_event | |
| event_data: | |
| controller: '{{ controller_id }}' | |
| action: button_on_double | |
| # run the custom action | |
| - choose: | |
| - conditions: [] | |
| sequence: !input action_button_on_double | |
| # previous event was not a short press | |
| default: | |
| # wait for the double press event to occur, within the provided delay | |
| # if the second press is received, automation is restarted | |
| - delay: | |
| milliseconds: '{{ adjusted_double_press_delay }}' | |
| # if delay expires, no second press was received, therefore run the short press action | |
| # run the short press action | |
| # fire the event | |
| - event: ahb_controller_event | |
| event_data: | |
| controller: '{{ controller_id }}' | |
| action: button_on_short | |
| # run the custom action | |
| - choose: | |
| - conditions: [] | |
| sequence: !input action_button_on_short | |
| # if double press event is disabled run the action for the single short press | |
| default: | |
| # fire the event | |
| - event: ahb_controller_event | |
| event_data: | |
| controller: '{{ controller_id }}' | |
| action: button_on_short | |
| # run the custom action | |
| - choose: | |
| - conditions: [] | |
| sequence: !input action_button_on_short | |
| - conditions: '{{ trigger_action | string in button_on_long }}' | |
| sequence: | |
| # fire the event only once before looping the action | |
| - event: ahb_controller_event | |
| event_data: | |
| controller: '{{ controller_id }}' | |
| action: button_on_long | |
| - choose: | |
| # if looping is enabled, loop the action for a finite number of iterations | |
| - conditions: '{{ button_on_long_loop }}' | |
| sequence: | |
| - repeat: | |
| while: '{{ repeat.index < button_on_long_max_loop_repeats | int }}' | |
| sequence: !input action_button_on_long | |
| # if looping is not enabled run the custom action only once | |
| default: !input action_button_on_long | |
| - conditions: '{{ trigger_action | string in button_on_release }}' | |
| sequence: | |
| # fire the event | |
| - event: ahb_controller_event | |
| event_data: | |
| controller: '{{ controller_id }}' | |
| action: button_on_release | |
| # run the custom action | |
| - choose: | |
| - conditions: [] | |
| sequence: !input action_button_on_release | |
| - conditions: '{{ trigger_action | string in button_off_short }}' | |
| sequence: | |
| - choose: | |
| # if double press event is enabled | |
| - conditions: '{{ button_off_double_press }}' | |
| sequence: | |
| - choose: | |
| # if previous event was a short press | |
| - conditions: '{{ trigger_action | string == last_controller_event and trigger_delta | int <= helper_double_press_delay | int }}' | |
| sequence: | |
| # store the double press event in the last controller event helper | |
| - action: input_text.set_value | |
| data: | |
| entity_id: !input helper_last_controller_event | |
| value: '{{ {"a":"double_press_off","t":as_timestamp(now())} | to_json }}' | |
| # run the double press action | |
| # fire the event | |
| - event: ahb_controller_event | |
| event_data: | |
| controller: '{{ controller_id }}' | |
| action: button_off_double | |
| # run the custom action | |
| - choose: | |
| - conditions: [] | |
| sequence: !input action_button_off_double | |
| # previous event was not a short press | |
| default: | |
| # wait for the double press event to occur, within the provided delay | |
| # if the second press is received, automation is restarted | |
| - delay: | |
| milliseconds: '{{ adjusted_double_press_delay }}' | |
| # if delay expires, no second press was received, therefore run the short press action | |
| # run the short press action | |
| # fire the event | |
| - event: ahb_controller_event | |
| event_data: | |
| controller: '{{ controller_id }}' | |
| action: button_off_short | |
| # run the custom action | |
| - choose: | |
| - conditions: [] | |
| sequence: !input action_button_off_short | |
| # if double press event is disabled run the action for the single short press | |
| default: | |
| # fire the event | |
| - event: ahb_controller_event | |
| event_data: | |
| controller: '{{ controller_id }}' | |
| action: button_off_short | |
| # run the custom action | |
| - choose: | |
| - conditions: [] | |
| sequence: !input action_button_off_short | |
| - conditions: '{{ trigger_action | string in button_off_long }}' | |
| sequence: | |
| # fire the event only once before looping the action | |
| - event: ahb_controller_event | |
| event_data: | |
| controller: '{{ controller_id }}' | |
| action: button_off_long | |
| - choose: | |
| # if looping is enabled, loop the action for a finite number of iterations | |
| - conditions: '{{ button_off_long_loop }}' | |
| sequence: | |
| - repeat: | |
| while: '{{ repeat.index < button_off_long_max_loop_repeats | int }}' | |
| sequence: !input action_button_off_long | |
| # if looping is not enabled run the custom action only once | |
| default: !input action_button_off_long | |
| - conditions: '{{ trigger_action | string in button_off_release }}' | |
| sequence: | |
| # fire the event | |
| - event: ahb_controller_event | |
| event_data: | |
| controller: '{{ controller_id }}' | |
| action: button_off_release | |
| # run the custom action | |
| - choose: | |
| - conditions: [] | |
| sequence: !input action_button_off_release | |
| - conditions: '{{ trigger_action | string in button_up_short }}' | |
| sequence: | |
| - choose: | |
| # if double press event is enabled | |
| - conditions: '{{ button_up_double_press }}' | |
| sequence: | |
| - choose: | |
| # if previous event was a short press | |
| - conditions: '{{ trigger_action | string == last_controller_event and trigger_delta | int <= helper_double_press_delay | int }}' | |
| sequence: | |
| # store the double press event in the last controller event helper | |
| - action: input_text.set_value | |
| data: | |
| entity_id: !input helper_last_controller_event | |
| value: '{{ {"a":"double_press_up","t":as_timestamp(now())} | to_json }}' | |
| # run the double press action | |
| # fire the event | |
| - event: ahb_controller_event | |
| event_data: | |
| controller: '{{ controller_id }}' | |
| action: button_up_double | |
| # run the custom action | |
| - choose: | |
| - conditions: [] | |
| sequence: !input action_button_up_double | |
| # previous event was not a short press | |
| default: | |
| # wait for the double press event to occur, within the provided delay | |
| # if the second press is received, automation is restarted | |
| - delay: | |
| milliseconds: '{{ adjusted_double_press_delay }}' | |
| # if delay expires, no second press was received, therefore run the short press action | |
| # run the short press action | |
| # fire the event | |
| - event: ahb_controller_event | |
| event_data: | |
| controller: '{{ controller_id }}' | |
| action: button_up_short | |
| # run the custom action | |
| - choose: | |
| - conditions: [] | |
| sequence: !input action_button_up_short | |
| # if double press event is disabled run the action for the single short press | |
| default: | |
| # fire the event | |
| - event: ahb_controller_event | |
| event_data: | |
| controller: '{{ controller_id }}' | |
| action: button_up_short | |
| # run the custom action | |
| - choose: | |
| - conditions: [] | |
| sequence: !input action_button_up_short | |
| - conditions: '{{ trigger_action | string in button_up_long }}' | |
| sequence: | |
| # fire the event only once before looping the action | |
| - event: ahb_controller_event | |
| event_data: | |
| controller: '{{ controller_id }}' | |
| action: button_up_long | |
| - choose: | |
| # if looping is enabled, loop the action for a finite number of iterations | |
| - conditions: '{{ button_up_long_loop }}' | |
| sequence: | |
| - repeat: | |
| while: '{{ repeat.index < button_up_long_max_loop_repeats | int }}' | |
| sequence: !input action_button_up_long | |
| # if looping is not enabled run the custom action only once | |
| default: !input action_button_up_long | |
| - conditions: '{{ trigger_action | string in button_up_release }}' | |
| sequence: | |
| # fire the event | |
| - event: ahb_controller_event | |
| event_data: | |
| controller: '{{ controller_id }}' | |
| action: button_up_release | |
| # run the custom action | |
| - choose: | |
| - conditions: [] | |
| sequence: !input action_button_up_release | |
| - conditions: '{{ trigger_action | string in button_down_short }}' | |
| sequence: | |
| - choose: | |
| # if double press event is enabled | |
| - conditions: '{{ button_down_double_press }}' | |
| sequence: | |
| - choose: | |
| # if previous event was a short press | |
| - conditions: '{{ trigger_action | string == last_controller_event and trigger_delta | int <= helper_double_press_delay | int }}' | |
| sequence: | |
| # store the double press event in the last controller event helper | |
| - action: input_text.set_value | |
| data: | |
| entity_id: !input helper_last_controller_event | |
| value: '{{ {"a":"double_press_down","t":as_timestamp(now())} | to_json }}' | |
| # run the double press action | |
| # fire the event | |
| - event: ahb_controller_event | |
| event_data: | |
| controller: '{{ controller_id }}' | |
| action: button_down_double | |
| # run the custom action | |
| - choose: | |
| - conditions: [] | |
| sequence: !input action_button_down_double | |
| # previous event was not a short press | |
| default: | |
| # wait for the double press event to occur, within the provided delay | |
| # if the second press is received, automation is restarted | |
| - delay: | |
| milliseconds: '{{ adjusted_double_press_delay }}' | |
| # if delay expires, no second press was received, therefore run the short press action | |
| # run the short press action | |
| # fire the event | |
| - event: ahb_controller_event | |
| event_data: | |
| controller: '{{ controller_id }}' | |
| action: button_down_short | |
| # run the custom action | |
| - choose: | |
| - conditions: [] | |
| sequence: !input action_button_down_short | |
| # if double press event is disabled run the action for the single short press | |
| default: | |
| # fire the event | |
| - event: ahb_controller_event | |
| event_data: | |
| controller: '{{ controller_id }}' | |
| action: button_down_short | |
| # run the custom action | |
| - choose: | |
| - conditions: [] | |
| sequence: !input action_button_down_short | |
| - conditions: '{{ trigger_action | string in button_down_long }}' | |
| sequence: | |
| # fire the event only once before looping the action | |
| - event: ahb_controller_event | |
| event_data: | |
| controller: '{{ controller_id }}' | |
| action: button_down_long | |
| - choose: | |
| # if looping is enabled, loop the action for a finite number of iterations | |
| - conditions: '{{ button_down_long_loop }}' | |
| sequence: | |
| - repeat: | |
| while: '{{ repeat.index < button_down_long_max_loop_repeats | int }}' | |
| sequence: !input action_button_down_long | |
| # if looping is not enabled run the custom action only once | |
| default: !input action_button_down_long | |
| - conditions: '{{ trigger_action | string in button_down_release }}' | |
| sequence: | |
| # fire the event | |
| - event: ahb_controller_event | |
| event_data: | |
| controller: '{{ controller_id }}' | |
| action: button_down_release | |
| # run the custom action | |
| - choose: | |
| - conditions: [] | |
| sequence: !input action_button_down_release |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment