Re:Making my dumb A/C smart with Elixir and Nerves
by Nextgrid on Saturday May 25, 2024 @11:04PM
(#40479506)
Don't rely on this for any kind of interlocking or complex logic. They will get into an inconsistent/broken state sooner or later.
I believe the "how long since a state change" only starts counting from the state change and within the same session. If the server restarts, the counter stops and will restart from scratch only from the next state change.
This means if an automation relies on such timers to reset itself back to its idle state, a server restart will forever leave it in that state.
Automations are nice for quick one-off actions but for anything that lasts more than a few seconds I'd suggest looking for alternatives. Something as complex as managing multiple devices with interdependent states is way too complex and is bound to go wrong even if you actually manage to express it in an automation (and don't give up because of the absolutely awful automation editor UI).
Home Assistant is great as a proxy/aggregator to connect many different devices/protocols and expose them under a single, consistent API, but it's terrible at logic. For any kind of complex task I'd suggest making a stand-alone app that interacts with the Home Assistant API to observe device states and control them.
I believe the "how long since a state change" only starts counting from the state change and within the same session. If the server restarts, the counter stops and will restart from scratch only from the next state change.
This means if an automation relies on such timers to reset itself back to its idle state, a server restart will forever leave it in that state.
Automations are nice for quick one-off actions but for anything that lasts more than a few seconds I'd suggest looking for alternatives. Something as complex as managing multiple devices with interdependent states is way too complex and is bound to go wrong even if you actually manage to express it in an automation (and don't give up because of the absolutely awful automation editor UI).
Home Assistant is great as a proxy/aggregator to connect many different devices/protocols and expose them under a single, consistent API, but it's terrible at logic. For any kind of complex task I'd suggest making a stand-alone app that interacts with the Home Assistant API to observe device states and control them.