is there a way to define time periods for a switch to be on our off? Like 11am to 8pm on and 8pm to 11am off. I only found on_time, which seems to act just cron like, which is okay in most situations, but not every.
Background: I want to use a 16 relay ESP32 to run my salt water tank. If something is up like power loss, reboot of the ESP, time sync problem or whatever I want to make sure that a switch e.g. for the lights is also turned on or off after the switching time like in my example at 11am or 8pm. Everything else is an additional risk I want to avoid.
If it is important you should create and run the automation on the ESP32. HA can call the automation and the esp32 can run the automation at startup. Time could be an issue but I dont know about that.
Basically make the action function independent of HA state.
Make it fail into the safest position to prevent damage until problem fixed.
I want. And will. The idea was only having HA as a logging component and for changing switches manually. Maybe running the same automations and setting switches to bei 200% sure. But the ESP should run completely without HA and/or network. I also have a RTC1307 attached.
Yes. I also noticed that I can set restore options for the switches. But yet I do not have an idea if the hardware is capable. I need to check/test.
Anyway, the question remains: Can I set a time period for switches which also triggers when it is after the time the switch should turn on or off?
I’m not sure if the most elegant way to achieve your goal, but you could look at combining a interval trigger with a lamda based time condition and the switch action.