Hello! I'm building one big lights automation that does an additional action on double click.
My triggers are device "toggle" action (cannot use the switch entity because the switches are in detached relay mode).
I have multiple triggers and I'd like to detect whether the same trigger was pressed again within 300ms.
My triggers look like this:
triggers:
- domain: mqtt
device_id: 7d261e9fcde1fa4dfc4926fb2a6dde67
type: action
subtype: toggle
metadata: {}
trigger: device
id: toilette_light
variables:
trigger_device_id: 7d261e9fcde1fa4dfc4926fb2a6dde67
actions_entity_id: light.toilette_light
- domain: mqtt
device_id: 4f0bf0afa2ab19ce76c5aee10f73ac6f
type: action
subtype: toggle
trigger: device
id: hallway_lights
enabled: true
variables:
trigger_device_id: 4f0bf0afa2ab19ce76c5aee10f73ac6f
actions_entity_id: light.hallway_lights
In the actions I'm using
- wait_for_trigger:
- domain: mqtt
device_id: 4f0bf0afa2ab19ce76c5aee10f73ac6f <--- this shouldn't be hard coded
type: action
subtype: toggle
trigger: device
timeout:
hours: 0
minutes: 0
seconds: 0
milliseconds: 300
continue_on_timeout: false
I tried using templates for dynamically setting the device_id in the wait_for_trigger but it's not supported. I'm out of ideas on how to handle this without adding a massive Choose block. What's a good way to handle this? Thanks!
-> Events and listening for