Dear all.
I’m trying to implement a simple scheduled switch automation to control a water heater.
For now I just want to turn on the water heater at a given time. For this I’m using a input_datetime. This is working fine. My problem is to turn off the heater. I want to use an input_select to let the user choose a delay (in hours) to turn off the heater. I can’t get this to work. With my above code I get the heater on at the desired time but it doesn’t turn off one hour later.
What I’m doing wrong?
Thank you for your help.
Please read the docs, especially the Warning (and some more here).
Your template trigger only reacts on change in your input_datetime’s state, which is not enough for it to work.
If you simply add something like
Hi. I always read the docs, but I definetively missed that warning on using now() in templates. It its working fine now. Thank you.
Here’s the code working fine:
Yes it is more reasonable to put all conditions in the template. Thank you.
I’m using initial_state: true because I want to manually disable the automation from time to time, but I want it to be activated by default when restarting hass.
And yes hide_entity is deprecated and I used them before lovelace existed and I somehow managed to keep them uselessly in my code. I’m deleting those…
Fair enough, but do you know that you can add your automation to a Lovelace card and enable/disable it from there? It’ll keep its state after HA restart.
Maybe it’ll suit your needs?