Automation with "state" trigger: how to toggle if the state holds for some time AFTER STARTUP

I haven’t tried it, will start reading about Alerts, thank you!

Right, exactly what I needed.

I also believed so - but in my setup the automation was not triggered if the sensor was OFF after startup.

alias: test_x
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.rpi_1_integration_availability_status
    to: 'off'
    for: '00:03:00'
condition: []
action:
  - service: notify.telegram_chat_important
    data:
      message: RPi-1 off for 3 min
mode: single

The test:

  1. Let the sensor = ON.
  2. Set it = OFF.
  3. The automation triggered after 3 minutes.
  4. Restart HA.
  5. Wait for 3 minutes after start - the automation is not triggered.

Moreover - this automation is not triggered on startup if the sensor is OFF at this moment:

alias: test_x
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.rpi_1_integration_availability_status
    to: 'off'
condition: []
action:
  - service: notify.telegram_chat_important
    data:
      message: RPi-1 off for 3 min
mode: single

I do not think that the FIRST setting a sensor on startup is considered as a STATE CHANGE.

There’s no surprise to me that the automation you posted doesn’t trigger after startup. The trigger requires the binary_sensor’s state to change to off. That means from some other state to off. The binary_sensor’s initial state on startup is off.

And because of the same reason the 4th automation does not trigger too.