How can I trigger something a time after the automation started

Hello!

I’m trying to get some actions to work a specific time after an automation starts.

In my example, my trigger is a calendar entry. A light comes on and it will change colour several times over the next hour.

I know I can use the delay/wait option, but this is for a time since the last action, so it will get quite messy for me rather fast as I add actions beyond lights.

Instead I am looking for a way to set an action off at a certain time past activation. So instead of saying wait 15 minutes since the last action, it is 15 minutes since being triggered.

Is the possible? I have searched and tried myself and I can’t see a way.

Thanks

Hi Lewis1247,

Maybe think about it different.
You don’t really want a automation running for an hour. If something interrupts it, it is ended and the end will never happen.

Have an automation with your trigger to start it, another trigger that happens some time or event later. Then do your thing ans later it triggers again and changes the color, etc.

Think of automations as best handled as events. There’s a trigger, a thing happens, automation ends. That has the best chance of working without issues.

Hi @Lewis1247

Whilst everything that @Lewis1247 has said is correct, a quick and dirty solution is to use the parallel: action. Then you can add two sequence: actions. The first sequence can do your lighting effects. The second sequence can be an hour wait.

Things run in parallel run at the same time.

parallel:
  - sequence:
    ... (lighting effects)
  - sequence:
    ... (wait for an hour)

Adding to what @Lewis1247 has said:

Create a timer entity
The first action in your automation should set the timer to count down from 1 hour.
Another automation should be triggered by the timer reaching zero and do whatever

The timer ebtity should be set to survive restarts if needed

You can trigger on the attribute color [255, 255, 255] and use the for to say 15 minutes.

To echo @Sir_Goodenough - why does it have to one automation?

Automations, even complex ones, are not software. Think of them more as rules. There’s nothing much to be gained by cramming everything into a single one, and this can make them much harder to update later.

1 Like

Thank you all for your responses, it is appreciated.

@Sir_Goodenough That’s a very valuable point about automations being interrupted. I have had unrelated automations that have something turn on, and turn off several hours later, in the same thing. I clearly need to split out the turning on and off in to seperate automations.

For this specific item, thank you @templeton_nash , that suggestion works perfectly. This automation is not important and doesn’t run for long so I don’t care if this one gets interrupted or otherwise doesn’t complete, the worst that will happen is a light gets left on. In this case this works well, being able to put a wait action in the top of each sequence. Thanks!

Certainly lots more exploring for me to do! Thanks all!