Add wait for event function

The trigger function could be expanded to include await for event function. This would then allow a sequential series of events to initiate and action.

e.g. I want home assistant to say hello when i arrive home. I can trigger off the front door contact sensor, but wish then to wait until the IR sensor is triggered, so I know that the person is in the correct room to hear the message.

Have the PIR be the trigger for the automation and have a condition that the door sensor was ‘on’ in the last min/30sec. ect.

That way the person is in the room as they tripped the IR sensor but only after the door was very recently opened.

You can also try adding a delay before the TTS event. The delay function is documented under scripts but I have it working under automations also.

Just two suggestions in case this never gets done.

You could just trigger off the IR sensor with a template_condition such that the door was triggered recently. Something like the following would require the door being triggered within the last minute.

`trigger:

  • platform: state
    entity_id: sensor.ir
    state: ‘on’
    condition
  • tempate_condition:
    value_template: ‘{{} (as_timestamp(now()) - as_timestamp(states.sensor.door.last_changed)) < 60}’`

Also, I think AppDaemon may be able to do what you want.

My method involves toggling the “welcome home” automation off after it executes one time. Then when I leave home, an automation event turns the “welcome home” automation back on, so that when the front door is opened, it waits a few seconds for you to get your shoes off and then executes. At the end of it’s execution, it again turns itself off until leaving home turns it back on again.

This could work for your motion sensor, so the first time it sees motion in your front room, it executes.

+1 from me.
Need a wait for a folder watcher event functionality in my scripts