I would say this is a very rare edge case that you are trying to fix - the problem will only occur of you restart HA at a minute or so before 9. I would put in a time condition testing it is before 9:05 to catch that scenario if you don’t want every reboot to mess with the device.
okay, this would solve the problem and I am happy about this solution as well.
but it is not what I was searching or asking for. it is more like a work arround.
Keep mind this will turn on the switch if you reboot at 22:00 also.
Yup. Put another time check in there.
Or… Just use a binary sensor that handles it all…
I don’t know why you are complicating things.
If there is a need to change the start and end times then that can be handled also using datetimes or a schedule entity
your solution is nearly perfect and exactly what I was asking for.
the only thing that I miss to be perfect, is a switch to toggle this timer on and off.
edit: this is my reply to you @Hellis81
Then just add a condition with a boolean in the automation.
It’s a lot better if you post your complete requirements in the first post and don’t add stuff along the way.
I think my question was clear since beginning.
You can turn off an automation.
action: homeassistant.turn_off
target:
entity_id: automation.xxx
data: {}
You could put that (and the turn on) action to buttons if you want. There is also a toggle.
Or, like Hellis said, create a boolean and turn that on and off while adding it to your automation.
it’s about turning on/off the helper template by switch or button.
So where does it say you need to turn it off?
Just a few posts later it seems the time is not 12, but actually 17:00.
edit; and now that I look at the automation, it seems this is a heater automation.
This is good stuff to include in the question.
Could this become a thermostat instead?
Is the heater supposed to be on even if it’s hot already?
You can’t ever change the output of a sensor.
You shouldn’t.
But as posted, you can add a boolean that can hinder the automation from running, or turn on/off the automation itself
But you kept adding to it. Stuff like wanting it to work when HA is not running or rebooting.
Basically you want a built in automation that makes sure a switch is on between a start time and an end time then shut it off. That automation would have to check the switch status every minute between start and end.
No one is going to put that into a home automation system.
The tools are here for you to have the outcome you want and we have shown you several.
These are not ‘workarounds’. They are the tools made available to us to do nearly anything we want in HA.
comon, don’t… like I allready sayd I’m happy for your help
every simple old style timeswitch has got a on and off switch. sorry that i didn’t additionally mentioned it.
But if this is a heater and it can be a thermostat then this part will handle itself just by creating a thermostat.
Of course the thermostat needs to turn on, but once the thermostat is on then even if a restart happens the thermostat will turn on the switches if they by some reason goes off (not immediately, but eventually)
We can’t read your mind…
“automation as a old fashion timeswitch like” how to, if possible?
that was my question. I didn’t expect someone reading my mind. we are not in a esotheric club here, aren’t we?
