State change delay

TL;DR Is it possible to set a delay before a state change actually takes place?
I have Person entities for everyone in my household, and I use the Home and Away states as triggers for automations. My problem is that when we go down to the basement to take out the car, HA changes state to Away because we appear out of reach. But as soon as we exit from the underground garage in the car, the state changes back to Home again for a short while, before again changing to Away when we turn around the nearest corner.
These state changes causes unwanted triggering of automations.
Thus a delay setting would be desirable so that the state doesn’t change until it’s been stable in the new state for, say - at least 30 minutes.

trigger:
  - platform: state
    entity_id: whatever.whatever
    to: whatever
    for: 
      minutes: 30

Thanks for your reply, but that doesn’t work.
See this: State History as condition in automations

That a condition. This is a trigger. It does work. See https://www.home-assistant.io/docs/automation/trigger/#state-trigger

The entity has to be in the desired state for a continuous period of 30 minutes before the automation will trigger. Just like you asked for.

Well, mayby I was somewhat imprecise. What I need is comparable to what is described her: State History as condition in automations
The previous state of the entity must have lasted for more than 30 minutes. Not the current state.

You do not need that to prevent the false triggering you described. The trigger shown will prevent this.

Well, then there’s something I do not understand here. If I add that trigger, the automation runs (triggers) only when (after) the light has been on for 30 minutes. That’s not what I want.

You’re not triggering on the state of the light you’re triggering state of the person, according to your first post.

So if you go down to the garage and it changes to away for a short amount of time it will have no effect.

30 minutes is probably a bit long. Make it about 1.5 times longer than it takes you go there and get the car out (1.5x the length of the away state). That way it does not take too long to register that you really are away when you drive off.

1 Like

First of all - Many thanks for being so patient with me🌞
The Light was just a metaphor from the other post. Please see it as the same as the Car
The trigger in this scenario, is: on = home (be it light or person). But it should not trigger if the previous off = away state was relatively short (shorter than 30 min).

How does your system know when you are away? Wi-Fi or GPS?
Try GPS with a zone config, works better.

That is exactly what the for: will do. Try it.

I just added my Galaxy S21 cellphone as a tracking device for my Person

This requirement:

and this requirement:

are different.

Which one do you want? Or do you want both?

Well both would work, but I agree, it looks weird when you pull things out of context. However, I think the template I was given, will solve my case (if I only could understand the calculation)

{{ now()|as_timestamp - states.group.persons.last_changed|as_timestamp(0) > 1800 }}

You mean the answer Troon gave you in another topic that effectively duplicates the question you posed in this topic?

Yes, the second post was clearly more effective. :+1::slightly_smiling_face: