coming from this thread:
since we now can end an action block with
- delay: 60
to prevent an automation from triggering within that timeframe, it would be very nice if we could do that also for automations with more than 1 triggering trigger in the trigger block (not trying to be funny here, sorry)
example:
- alias: Daughters presence
id: Daughters presence
initial_state: false
trigger:
platform: state
entity_id:
- group.daughter_1
- group.daughter_2
- device_tracker.daughter_3
- device_tracker.daughter_4
condition:
- condition: state
entity_id: input_boolean.notify_presence
state: 'on'
# - condition: template
# value_template: >
# {{is_state('input_boolean.notify_presence','on')}}
- condition: template
value_template: >
{{trigger.to_state is not none and
trigger.from_state is not none and
trigger.to_state.state in ['home','not_home'] and
trigger.to_state.state != trigger.from_state.state}}
- condition: template
value_template: >
{% set last = trigger.from_state.last_changed %}
{{last is none or (now() - last).total_seconds() > 120}}
# {{(now() - trigger.from_state.last_changed).total_seconds() > 120}}
action:
service: notify.notify
data_template:
title: >
Daughter {{'arrived at' if is_state(trigger.entity_id,'home') else 'left'}} home
message: >-
{{as_timestamp(now())|timestamp_custom('%X')}}
{{trigger.to_state.name}} {{'arrived at' if is_state(trigger.to_state,'home') else 'left'}} home.
still needs the condition:
- condition: template
value_template: >
{% set last = trigger.from_state.last_changed %}
{{last is none or (now() - last).total_seconds() > 120}}
because the delay at the end would prevent multiple executions from multiple triggers.
introducing a new delay per trigger would solve that. Ive called it trigger_delay in the linked post, but that was flagged by Phil Not really important what its named, as long as we can use a delay_per_trigger.
thanks!
coming to think of it: maybe we don’t even need a new delay, but simply have the delay respect multiple triggers? So it all happens in the backend?