I have devices that are automated to be turned on and off based on sensors such as motion, humidity etc but some family members just turn them on manually and forget to turn them off. Or the time period built into these automations does not survive a restart.
Is there a way to create automations that turn off these devices after a certain time period of being on as sensed by HA regardless of how they were turned on?
Any automation won’t survive a restart, you could have an action that fires when HA starts to toggle the lights if they are on so they stay on X minutes more before auto off.
Otherwise, the automation you just need to put a Delay in your automation between turn on and turn off, I usually also set the automation to restart if retriggered so it doesn’t go out while someone is still in the room.
I did no know that there are actions that can be taken on HA (re)start. What is the trigger for HA starting?
Also, I am familiar with using delays in automations for when the automation is turning the device on. If it was turned on manually, is the trigger the device turning on which then starts a delay measurement?
On should be on, so it detects on and it gets fired. As for manual turn on, you have to see if your device reports that since not all differentiate between turned on at the paddle versus turned on via HA.
The restart is just how you configure your automation, by default it’s single but you can set it via the elipsis menu in the upper right.