#Is it ok to check every minute "is it between 6am and 8am" instead of triggering on 6am ?
1 messages · Page 1 of 1 (latest)
Why not trigger at 6am and then again at HA restart?
triggers:
- at 6 AM
- on HA start
conditions: - is time between 6-8AM
- has the automation NOT run today - you can use an input boolean or something OR you can take this out if you rely on the
last_triggeredattribute of the automation if it didn't need to run a certain number of steps
actions: - whatever needs to be done
- (optional) mark that the automation has run today if you don't want to rely on
last_triggered
if you do set an input boolean, make sure to have another automation turn it off some time after 8AM and before the next 6AM
it would work but what if just the device was down and not HA? it would trigger but not take action. then the device will be up and not in the expected state at 6:15am lets say. the solution I imagined takes all possible scenarios into account and actually worked for a couple of switches, but I wanted to be sure it's not "bending" HA in a way, because I was planning to use it on more devices.
to summarize, the question is more like "can HA reliably handle dozens of automations every seconds?" 😄
(or every minute, i'm flexible)
Then add a trigger for the entity state changing from unavailable too
Home assistant will not run well if you are trying to run dozens of automations a second, and while reducing that to a minute would probable be OK, it's better to just set up your automations in a robust way that you don't need to spam automations constantly.
Even better is setting up your network and devices to minimise issues though