So, im new to HA automations. I keep seeing people say automations (and template sensors) that trigger every X seconds/minutes is bad as if the world would end. But i havent yet found much documentation around HOW BAD this is.
Using proper triggers seem easy enough, but i cant shake the idea of how unreliable any important automation would be if HA happen to restart or any hiccup that would cause the trigger to not fire. Instead, if i use sort of a state based template or a trigger based automation with an additional trigger every X minutes/seconds as a fallback, it would ensure what ever automation or template gets execute regurdless of any hiccups or HA restarts (as the template would trigger the next time the state becomes available or next time the time based trigger executes).
Doing what im suggesting is a HUGE waste of resources if i assume no hiccups and no HA restarts etc. But the main point is that, does it make that huge of a difference? Its simply that the template re evaluates lot more often, but its not like any template/automation actually uses up any meaningful amount of system resources - right? If im correct then, it would be such an insignificant cost to pay for a slight bit more reliability and fallback logic.
Am i somehow completely wrong to assume that? Am i missing something?
Example automation:
V1. Automation without fallback:
If sensor is on => turn on light
if sensor is off for 5 minutes => turn off light
V2. Automation with fallback:
If sensor is on => turn on light
if sensor is off for 5 minutes => turn off light
Every 30 seconds => if sensor is on => turn on light; if sensor is off for 5 minutes (using templates and sensor.last_changed
comparing with now()
) turn off light.
Not the best example, but in this, the V2 will recover from a HA restart eventhough now()
only evaluates every minute, it would still EVENTUALLY turn off the light.
1 post - 1 participant