Added IKEA Zigbee button blueprint/automation, changed automations for xmas.

This commit is contained in:
Marcus Scholz 2023-12-14 14:36:09 +01:00
parent 0dff2d90ff
commit 2cf58f3f34
2 changed files with 834 additions and 65 deletions

View File

@ -51,9 +51,17 @@
- service: light.turn_off
target:
area_id:
- kuche
- wohnzimmer
- schlafzimmer
device_id:
- 53a27edf581fcf40f3bc8b253b1ee369
- 4e8211f6c1ad515c79d7a26f3d7c9a27
- c64e7c3dcda7f1c23e456959f2c60f39
- 4edd9b9df7d1f6f2fe7dcc2e5c0eb968
- 6dcbd87b459412144bddc42af3ae8b83
- 98a9eef603f8c8ae6200c4834a3dbf4f
- 32d15eec63fe68d5770813d47da53657
- 9f42805af5b7e423023595390342b9ac
- 063e41329df7b29bbaa8df2f508ee6cb
data:
transition: 2
mode: single
@ -98,6 +106,10 @@
media_content_id: media-source://tts
- media_content_type: provider
media_content_id: media-source://tts/tts.piper?message=Gute+Nacht%2C+schlaf+gut.
- type: turn_off
device_id: c4ead7f6227e2ee4c43c4b0df829cd84
entity_id: 7f7284b11f2bf50ae2f0ebeeb35411c0
domain: switch
- service: media_player.turn_off
target:
area_id:
@ -258,7 +270,9 @@
- service: light.turn_off
data: {}
target:
entity_id: light.awtrix_b8658c_indicator_1
entity_id:
- light.awtrix_desk_indicator_1
- light.awtrix_kitchen_indicator_1
mode: single
- id: '1625481640348'
alias: 'Anruf: Beim Telefonieren Musik pausieren'
@ -346,7 +360,9 @@
- service: light.turn_on
data: {}
target:
entity_id: light.awtrix_b8658c_matrix
entity_id:
- light.awtrix_desk_matrix
- light.awtrix_kitchen_matrix
mode: single
- id: '1630914505161'
alias: Beim Verlassen der Wohnung alles abschalten
@ -365,6 +381,7 @@
- schlafzimmer
- kuche
- kinderzimmer
data: {}
- type: turn_off
device_id: 6d1be741876624a70ab5b01b54c6fd6f
entity_id: switch.kuche_musik
@ -373,11 +390,16 @@
device_id: 5a08ac4c3b3893b540a9934fa92dccfa
entity_id: switch.flur_raumduft
domain: switch
- type: turn_off
device_id: c4ead7f6227e2ee4c43c4b0df829cd84
entity_id: 7f7284b11f2bf50ae2f0ebeeb35411c0
domain: switch
- service: media_player.turn_off
target:
area_id:
- schlafzimmer
- wohnzimmer
data: {}
mode: single
- id: '1632477389492'
alias: Licht beim Heimkommen einschalten
@ -405,6 +427,10 @@
- 32d15eec63fe68d5770813d47da53657
- 53a27edf581fcf40f3bc8b253b1ee369
data: {}
- type: turn_on
device_id: c4ead7f6227e2ee4c43c4b0df829cd84
entity_id: 7f7284b11f2bf50ae2f0ebeeb35411c0
domain: switch
mode: single
- id: '1648485179021'
alias: Schalte den Fernseher mit WoL ein
@ -415,66 +441,6 @@
- service: wake_on_lan.send_magic_packet
data:
mac: a8:23:fe:5d:4c:f8
- id: '1670088470265'
alias: Licht beim Heimkommen einschalten (XMas)
description: Nur während Dunkelphase
trigger:
- platform: state
entity_id: person.marcus_scholz
to: home
from: not_home
condition:
- condition: or
conditions:
- condition: sun
before: sunrise
before_offset: '+1'
- condition: sun
after_offset: '-1'
after: sunset
action:
- service: light.turn_on
target:
device_id:
- 32d15eec63fe68d5770813d47da53657
- 53a27edf581fcf40f3bc8b253b1ee369
- 1ee1168af484d17fe81b226ac1c5d2ae
- c64e7c3dcda7f1c23e456959f2c60f39
data: {}
- device_id: c64e7c3dcda7f1c23e456959f2c60f39
domain: select
entity_id: select.kuche_preset
type: select_option
option: X-Mas
mode: single
- id: '1670088606575'
alias: Licht bei Sonnenuntergang einschalten (XMas)
description: Nur wenn jemand zuhause ist
trigger:
- platform: sun
event: sunset
offset: '-1:00'
condition:
- condition: state
entity_id: person.marcus_scholz
state: home
action:
- service: light.turn_on
data: {}
target:
device_id:
- c64e7c3dcda7f1c23e456959f2c60f39
- 1ee1168af484d17fe81b226ac1c5d2ae
- type: turn_on
device_id: c64e7c3dcda7f1c23e456959f2c60f39
entity_id: light.kuche
domain: light
- device_id: c64e7c3dcda7f1c23e456959f2c60f39
domain: select
entity_id: select.kuche_preset
type: select_option
option: X-Mas
mode: single
- id: '1675778284738'
alias: Stündliche Zeitansage
description: ''
@ -508,7 +474,11 @@
enabled: true
- service: mqtt.publish
data:
topic: awtrix_b8658c/notify
topic: awtrix_desk/notify
payload: '{"text": "{{message}}", "icon": "clockcolor", "duration": 16}'
- service: mqtt.publish
data:
topic: awtrix_kitchen/notify
payload: '{"text": "{{message}}", "icon": "clockcolor", "duration": 16}'
variables:
message: '{% set t = now().hour %} {% set m = ''Morgen'' if t < 12 else ''Nachmittag''
@ -742,3 +712,98 @@
- Fireworks
- BrickBreaker
- Radar
- id: '1699969052661'
alias: 'Awtrix: Matrix einschalten'
description: ''
trigger:
- platform: state
entity_id: person.marcus_scholz
to: home
from: not_home
condition: []
action:
- service: light.turn_on
data: {}
target:
entity_id:
- light.awtrix_desk_matrix
- light.awtrix_kitchen_matrix
mode: single
- id: '1700482951854'
alias: Licht bei Sonnenuntergang einschalten (XMas)
description: ''
trigger:
- platform: sun
event: sunset
offset: '-1:00'
condition:
- condition: state
entity_id: person.marcus_scholz
state: home
action:
- service: script.moodlight_xmas
data: {}
- type: turn_on
device_id: c4ead7f6227e2ee4c43c4b0df829cd84
entity_id: 7f7284b11f2bf50ae2f0ebeeb35411c0
domain: switch
mode: single
- id: '1700483035319'
alias: Licht bei Sonnenaufgang ausschalten (XMas)
description: ''
trigger:
- platform: sun
event: sunrise
offset: '+1:00'
condition: []
action:
- service: light.turn_off
target:
area_id:
- schlafzimmer
device_id:
- 53a27edf581fcf40f3bc8b253b1ee369
- 4e8211f6c1ad515c79d7a26f3d7c9a27
- c64e7c3dcda7f1c23e456959f2c60f39
- 4edd9b9df7d1f6f2fe7dcc2e5c0eb968
- 6dcbd87b459412144bddc42af3ae8b83
- 98a9eef603f8c8ae6200c4834a3dbf4f
- 32d15eec63fe68d5770813d47da53657
- 9f42805af5b7e423023595390342b9ac
- 063e41329df7b29bbaa8df2f508ee6cb
data:
transition: 2
- type: turn_off
device_id: c4ead7f6227e2ee4c43c4b0df829cd84
entity_id: 7f7284b11f2bf50ae2f0ebeeb35411c0
domain: switch
mode: single
- id: '1701774106609'
alias: Wohnzimmer STYRBAR Moodlight Remote control
description: ''
use_blueprint:
path: EPMatt/ikea_e2001_e2002.yaml
input:
integration: ZHA
controller_device: f3b032ad1f3ccc658a7d4588cc0e5c0c
helper_last_controller_event: input_text.styrbar_wohnzimmer_moodlight_letztes_event
action_button_up_short:
- service: light.turn_on
data: {}
target:
device_id:
- 4edd9b9df7d1f6f2fe7dcc2e5c0eb968
- 6dcbd87b459412144bddc42af3ae8b83
action_button_down_short:
- service: light.turn_off
data: {}
target:
device_id:
- 6dcbd87b459412144bddc42af3ae8b83
- 4edd9b9df7d1f6f2fe7dcc2e5c0eb968
action_button_left_short:
- service: script.wled_random_effect
data: {}
action_button_right_short:
- service: script.wled_random_palette
data: {}

View File

@ -0,0 +1,704 @@
blueprint:
name: Controller - IKEA E2001/E2002 STYRBAR Remote control
description: "# Controller - IKEA E2001/E2002 STYRBAR Remote control\n\nController
automation for executing any kind of action triggered by the provided IKEA E2001/E2002
STYRBAR Remote control. 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/ikea_e2001_e2002#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/ikea_e2001_e2002).\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/ikea_e2001_e2002/ikea_e2001_e2002.yaml
domain: automation
input:
integration:
name: (Required) Integration
description: Integration used for connecting the remote with Home Assistant.
Select one of the available values.
selector:
select:
options:
- deCONZ
- ZHA
- Zigbee2MQTT
sort: false
multiple: false
custom_value: false
controller_device:
name: (deCONZ, ZHA) Controller Device
description: The controller device to use for the automation. Choose a value
only if the remote is integrated with deCONZ, ZHA.
default: ''
selector:
device: {}
controller_entity:
name: (Zigbee2MQTT) Controller Entity
description: 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:
- sensor
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
multiple: false
action_button_left_short:
name: (Optional) Left button short press
description: Action to run on short left button press.
default: []
selector:
action: {}
action_button_left_long:
name: (Optional) Left button long press
description: Action to run on long left button press.
default: []
selector:
action: {}
action_button_left_release:
name: (Optional) Left button release
description: Action to run on left button release after long press.
default: []
selector:
action: {}
action_button_left_double:
name: (Optional) Left button double press
description: Action to run on double left button press.
default: []
selector:
action: {}
action_button_right_short:
name: (Optional) Right button short press
description: Action to run on short right button press.
default: []
selector:
action: {}
action_button_right_long:
name: (Optional) Right button long press
description: Action to run on long right button press.
default: []
selector:
action: {}
action_button_right_release:
name: (Optional) Right button release
description: Action to run on right button release after long press.
default: []
selector:
action: {}
action_button_right_double:
name: (Optional) Right button double press
description: Action to run on double right 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) 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) Down button double press
description: Action to run on double down button press.
default: []
selector:
action: {}
button_left_long_loop:
name: (Optional) Left button long press - loop until release
description: Loop the left button action until the button is released.
default: false
selector:
boolean: {}
button_left_long_max_loop_repeats:
name: (Optional) Left 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.0
max: 5000.0
mode: slider
step: 1.0
button_right_long_loop:
name: (Optional) Right button long press - loop until release
description: Loop the right button action until the button is released.
default: false
selector:
boolean: {}
button_right_long_max_loop_repeats:
name: (Optional) Right 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.0
max: 5000.0
mode: slider
step: 1.0
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.0
max: 5000.0
mode: slider
step: 1.0
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.0
max: 5000.0
mode: slider
step: 1.0
button_left_double_press:
name: (Optional) Expose left button double press event
description: Choose whether or not to expose the virtual double press event
for the left button. Turn this on if you are providing an action for the left
button double press event.
default: false
selector:
boolean: {}
button_right_double_press:
name: (Optional) Expose right button double press event
description: Choose whether or not to expose the virtual double press event
for the right button. Turn this on if you are providing an action for the
right 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: {}
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.0
max: 5000.0
unit_of_measurement: milliseconds
mode: box
step: 10.0
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.0
max: 1000.0
unit_of_measurement: milliseconds
mode: box
step: 10.0
variables:
integration: !input integration
button_left_long_loop: !input button_left_long_loop
button_left_long_max_loop_repeats: !input button_left_long_max_loop_repeats
button_left_double_press: !input button_left_double_press
button_right_long_loop: !input button_right_long_loop
button_right_long_max_loop_repeats: !input button_right_long_max_loop_repeats
button_right_double_press: !input button_right_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: '{{ integration | lower }}'
adjusted_double_press_delay: '{{ [helper_double_press_delay - helper_debounce_delay,
100] | max }}'
actions_mapping:
deconz:
button_left_short:
- '3002'
button_left_long:
- '3001'
button_left_release:
- '3003'
button_right_short:
- '4002'
button_right_long:
- '4001'
button_right_release:
- '4003'
button_up_short:
- '1002'
button_up_long:
- '1001'
button_up_release:
- '1003'
button_down_short:
- '2002'
button_down_long:
- '2001'
button_down_release:
- '2003'
zha:
button_left_short:
- press_257_13_0
button_left_long:
- hold_3329_0
button_left_release:
- release_1365
button_right_short:
- press_256_13_0
button_right_long:
- hold_3328_0
button_right_release:
- release_-27903
button_up_short:
- 'on'
button_up_long:
- move_with_on_off_0_83
button_up_release:
- stop
button_down_short:
- 'off'
button_down_long:
- move_1_83
button_down_release:
- stop
zigbee2mqtt:
button_left_short:
- arrow_left_click
button_left_long:
- arrow_left_hold
button_left_release:
- arrow_left_release
button_right_short:
- arrow_right_click
button_right_long:
- arrow_right_hold
button_right_release:
- arrow_right_release
button_up_short:
- 'on'
button_up_long:
- brightness_move_up
button_up_release:
- brightness_stop
button_down_short:
- 'off'
button_down_long:
- brightness_move_down
button_down_release:
- brightness_stop
button_left_short: '{{ actions_mapping[integration_id]["button_left_short"] }}'
button_left_long: '{{ actions_mapping[integration_id]["button_left_long"] }}'
button_left_release: '{{ actions_mapping[integration_id]["button_left_release"]
}}'
button_right_short: '{{ actions_mapping[integration_id]["button_right_short"] }}'
button_right_long: '{{ actions_mapping[integration_id]["button_right_long"] }}'
button_right_release: '{{ actions_mapping[integration_id]["button_right_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"]
}}'
integrations_with_prev_event_storage:
- zha
- zigbee2mqtt
controller_entity: !input controller_entity
controller_device: !input controller_device
controller_id: '{% if integration_id=="zigbee2mqtt" %}{{controller_entity}}{% else
%}{{controller_device}}{% endif %}'
mode: restart
max_exceeded: silent
trigger:
- platform: event
event_type: state_changed
event_data:
entity_id: !input controller_entity
- platform: event
event_type:
- deconz_event
- zha_event
event_data:
device_id: !input controller_device
condition:
- condition: and
conditions:
- '{%- 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 }}{{"_" if trigger.event.data.args|length
> 0}}{{ trigger.event.data.args|join("_") }} {%- 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 }}{{"_" if trigger.event.data.args|length
> 0}}{{ trigger.event.data.args|join("_") }} {%- 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 }}'
last_controller_event: '{{ (states(helper_last_controller_event) | from_json).a
if helper_last_controller_event is not none and (states(helper_last_controller_event)
| regex_match("^\{((\"a\": \".*\"|\"t\": \d+\.\d+)(, )?){2}\}$")) else "" }}'
- service: input_text.set_value
data:
entity_id: !input helper_last_controller_event
value: '{{ {"a":trigger_action,"t":as_timestamp(now())} | to_json }}'
- choose:
- conditions: '{{ trigger_action | string in button_left_short }}'
sequence:
- choose:
- conditions: '{{ button_left_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_value
data:
entity_id: !input helper_last_controller_event
value: '{{ {"a":"double_press","t":as_timestamp(now())} | to_json
}}'
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_left_double
- choose:
- conditions: []
sequence: !input action_button_left_double
default:
- delay:
milliseconds: '{{ adjusted_double_press_delay }}'
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_left_short
- choose:
- conditions: []
sequence: !input action_button_left_short
default:
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_left_short
- choose:
- conditions: []
sequence: !input action_button_left_short
- conditions: '{{ trigger_action | string in button_left_long }}'
sequence:
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_left_long
- choose:
- conditions: '{{ button_left_long_loop }}'
sequence:
- repeat:
while: '{{ repeat.index < button_left_long_max_loop_repeats | int }}'
sequence: !input action_button_left_long
default: !input action_button_left_long
- conditions:
- '{{ trigger_action | string in button_left_release }}'
- '{{ not integration_id in integrations_with_prev_event_storage or last_controller_event
| string in button_left_long }}'
sequence:
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_left_release
- choose:
- conditions: []
sequence: !input action_button_left_release
- conditions: '{{ trigger_action | string in button_right_short }}'
sequence:
- choose:
- conditions: '{{ button_right_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_value
data:
entity_id: !input helper_last_controller_event
value: '{{ {"a":"double_press","t":as_timestamp(now())} | to_json
}}'
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_right_double
- choose:
- conditions: []
sequence: !input action_button_right_double
default:
- delay:
milliseconds: '{{ adjusted_double_press_delay }}'
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_right_short
- choose:
- conditions: []
sequence: !input action_button_right_short
default:
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_right_short
- choose:
- conditions: []
sequence: !input action_button_right_short
- conditions: '{{ trigger_action | string in button_right_long }}'
sequence:
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_right_long
- choose:
- conditions: '{{ button_right_long_loop }}'
sequence:
- repeat:
while: '{{ repeat.index < button_right_long_max_loop_repeats | int }}'
sequence: !input action_button_right_long
default: !input action_button_right_long
- conditions:
- '{{ trigger_action | string in button_right_release }}'
- '{{ not integration_id in integrations_with_prev_event_storage or last_controller_event
| string in button_right_long }}'
sequence:
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_right_release
- choose:
- conditions: []
sequence: !input action_button_right_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_value
data:
entity_id: !input helper_last_controller_event
value: '{{ {"a":"double_press","t":as_timestamp(now())} | to_json
}}'
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_up_double
- choose:
- conditions: []
sequence: !input action_button_up_double
default:
- delay:
milliseconds: '{{ adjusted_double_press_delay }}'
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_up_short
- choose:
- conditions: []
sequence: !input action_button_up_short
default:
- event: ahb_controller_event
event_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_event
event_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_long
default: !input action_button_up_long
- conditions:
- '{{ trigger_action | string in button_up_release }}'
- '{{ not integration_id in integrations_with_prev_event_storage or last_controller_event
| string in button_up_long }}'
sequence:
- event: ahb_controller_event
event_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_value
data:
entity_id: !input helper_last_controller_event
value: '{{ {"a":"double_press","t":as_timestamp(now())} | to_json
}}'
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_down_double
- choose:
- conditions: []
sequence: !input action_button_down_double
default:
- delay:
milliseconds: '{{ adjusted_double_press_delay }}'
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_down_short
- choose:
- conditions: []
sequence: !input action_button_down_short
default:
- event: ahb_controller_event
event_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_event
event_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_long
default: !input action_button_down_long
- conditions:
- '{{ trigger_action | string in button_down_release }}'
- '{{ not integration_id in integrations_with_prev_event_storage or last_controller_event
| string in button_down_long }}'
sequence:
- event: ahb_controller_event
event_data:
controller: '{{ controller_id }}'
action: button_down_release
- choose:
- conditions: []
sequence: !input action_button_down_release