Timer/Schedule based control

Hi all,
What would be the easiest way to set a device on a timer? For example, you turn on a light or a socket but then you want it to turn off after 30 minutes or you want to run something for 15 minutes ad-hoc rather than on a daily/weekly basis etc?

I can’t be the only one with this use case!

Thanks in advance

Is there a reason you tagged it with matter? Do you expect it to be matter functionality? This would not depend on the protocol involved, would it?

You’d create an automation, but what it would look like depends on how you intend to start the timeout. Should it be universal, always, or just when started a certain way? Are there circumstances where the action should not happen, or the delay be extended? Concrete examples work beter than generic questions, because there are no generic answers for most things.

As for the way to do it: timer entities would work for longer delays, you could also set an input helper with the desired time to have something done. Shorter pauses could use a delay, but they get cancelled when automations reload. A for statement in a trigger is also always good.

Here’s a simple example of a motion controlled light with a 2 minute delay for off:

Sorry. I don’t know how I put it under Matter. I have edited it now to change that.

Thank you very much @Edwin_D

For my use case, I want it to be as simple as possible. If I turn a power socket for example to run a fan to dry something quickly and I only want it to run for 15 minutes.

Another use case is turning on a lamp knowing that I’m going to only need it for 5 minutes then it can turn itself off (I know I’m being extremely lazy)

The most recent case was when I ran my dehumidifier to dry clothes. It is costly to keep running for a long time so I only wanted it to run for 30 minutes. I had to go back and turn it off. I would like to be able to run a timer on any light or power entity to turn it off after a set period of time.

I hope this gives a better idea of what I’m looking for.

As regards the Motion Activated automation, I’m not looking at a delay in that sense. More the ability to turn something on and then set a timer for it to turn off after whatever time I want. Like turn the light off after 5 minutes or turn off the lamp after 15 minutes

This is the key part. Then? You can easily create an automation so a specific device always turns off after a fixed time when you turned it on, but it unlikely you want that. So how do you expect to set the timer for all these use cases? How would Home Assistent know when to set it, for what device, for how long? Home Assistant is versatile, but not psychic. So your examples are still too vague.

In an ideal world, the switch/socket will have an additional option after you power on a light/device so that once turned on, you could click on a clock icon and set a countdown timer for when the device/light will turn off.

I’m thinking, perhaps once I’ve turned a device on, I could then have something in the UI where I can select the entity and then set a timer and hit OK and that would trigger the countdown to when the device would turn off. Would that be possible?

If the list of devices is small, you could create an input select with an list of things you’d want a timer for, and another input number with the minutes you want it to remain on. The automation could then turn it on, and off after a while. It would not make sense to need you to turn it on by hand first.

There is nu entity picker input that I know of for the gui, so adding an extra device would always take some work to expnd the list and link it to an entity. but that could be done.

@Edwin_D
I’ve been thinking about this. Thank you very much for the great ideas. Is there a way to populate the input select dynamically?

Assuming that’s not possible, say I’ve got a list in the input-select and another one for the time i.e. 5,10,15,20,30,40,50 and 60 minutes.

I select entity x from the input select and 10 from the timer input-select. How would one trigger the automation for each entity i.e. I hit go and it takes the values from the entity input-select and the time from the timer input-select. The go button triggers the automation providing it with the two values and then that somehow goes into a queue? I am not that advanced with automations :slight_smile:

It would be something like that. The best way to learn automations is to sink your teath into a situation like this. start small, and then once you get more aquainted with the way things work, expand in it.

Populating the input select might be possible, but that would require more advanced tempating skills and knowing how to automatically get the entities you want and making sure you have nice names that can be related back to the right entites, so’d start with a few and see how you like it.