This is a two part Blueprint to create a ‘timer’ that is unaffected by a system restart (unless the restart happens at the exact same time as the intended action). It is triggered by a switch and turns a switch off but could easily be adapted for other entities.
It’s not really a Timer but I like to use automations like this if I have something I want to be sure is turned off, regardless of a HA restart. Taras has a solution for persistent Timers, so definitely worth checking that out, depending on your use case, but I find this a simple and great solution for my needs, so I created a blueprint based on automations I’ve read about in the community.
You need to create two automations for this - one saves the desired time to turn the switch off and the other triggers at that set time. The latter is turned off, once it completes, so it doesn’t keep triggering every day.
You need to create a few helpers for this: -
input_datetime.when_to_turn_the_switch_off
input_number.helper_hour
input_number.helper_minute
input_number.helper_second
You can display the input_numbers in a lovelace card e.g. entities card, with ‘Input Field’ selected.
You can import the first from: -
or, if you go to Configuration > Blueprints, you can import from: -
and the second from
or
I imagine it would be straightforward to include days in this automation as well but I don’t have that particular use-case.
I’m sure there’s more elegant solutions than this and so I hope someone else will create an even better version I/we can adopt.
Thanks