Trigger an automation when a device is in reach, and the state was unavailable in the last x time

Hi,

I’m trying to build an automation for my electric gate. I want to trigger the gate to open when one of our cars connects to Wifi (each car has an esp32 in it which connects to wifi when in range).

I don’t want that trigger when the wifi has an hickup when at home, so i want to check the state of the car.

Ex: When car (esp32) is available (home, so has connection with wifi) AND the former state was unavailable for xxx time then open gate.

I’m stuck in the former state part…

Anybody?

You should set the automation trigger as esp32 unavailable for xxx time and then in actions, you should create an action of type wait until with trigger esp32 is available. This should do what you intend for.

By this way the automation will be triggered only when esp32 is unavailable for xxx times and then wait for it to be available to complete the action.

Hello. In automation triggers, I do not see available / unavailable trigger. How do I trigger?