Sensors automation

A question for automation experts

I have one door sensor at the entrance gate and a door sensor on the main door, to this day I received alerts that the gate or door opens, yesterday I decided to start working with Alexa and TTS, I installed the integration and managed to send voice commands according to text I choose to Alexa, I want once the gate sensor Entrance opens and within 10 seconds of it the main door opens, Alexa will say take off shoes. Is it possible to automate with 2 sensors that once one is opened there is a time of 10 seconds until the other is also opened and then the automation will work?

I want to prevent Alexa from saying every time I open the door to take off my shoes, this automation should actually differentiate between who enters and who leaves the house.
I tried to do with WAIT FOR TRIGGER I did not really succeed, and I note that I have no experience in NODE RED but yesterday I installed it and if there is no choice then I will use it

Thank you!

Maybe a Timer? Timer - Home Assistant

2 automation:

Garage door opened → start timer(10s)
Door opened → is timer “active” → “Take off tour shoes”

You definitely don’t need Node Red for this: there are a variety of solutions, and wait_for_trigger should work. This (untested) should trigger on the gate opening, wait up to ten seconds for the door to open, check if is actually is open (i.e. that the trigger has happened rather than the timeout), then send the TTS command.

trigger:
  - platform: state
    entity_id: binary_sensor.gate_open
    to: 'on'
action:
  - wait_for_trigger
    - platform: state
      entity_id: binary_sensor.door_open
      to: 'on'
      timeout:
        seconds: 10
  - condition: state
    entity_id: binary_sensor.door_open
    state: 'on'
  - service: [your TTS stuff here]
2 Likes

Maybe continue_on_timeout: false, then the condition is not needed?

i tried to to this

  • id: ‘1621336455166’
    alias: New Automation
    description: ‘’
    trigger:
    platform: state
    entity_id: binary_sensor.openclose_25
    to: ‘on’
    action:
    • wait_for_trigger:
      platform: state
      entity_id: binary_sensor.openclose_15
      to: ‘on’
      timeout:
      seconds: 10
    • service: notify.alexa_media_noy_s_echo_dot
      data:
      message: bla bla bla
      data:
      type: tts
      target: media_player.noy_s_echo_dot
      mode: single

but its run the action always i open the gate

Do the condition as in @Troon example, or continue_on_timeout: false, but doing neither won’t work.

Exactly. wait_for_trigger waits for the trigger, but then carries on unless you specify continue_on_timeout: false.

My version lets the code carry on but then checks if the door is open with an extra condition.

@Noy1122 — please format your code with the </> button.

i did it. its works now!
thank you very much!! :blush:

1 Like