With help previously much appreciated from this forum i build an automation to trigger a switch only once the level of stored electricity in my battery is above a certain % and only once a Day. It is working great
Iād like to add a new rule that ensures the automation wont run before 10am, Iāve done the below. I attempted adding a condition which i think was similar yesterday but it stopped the whole thing triggering so I deleted it. Hence my question. Thank you very much in advance.
Iām not sure I understand the issue here.
Does it not work?
Just to be clear, the automation runs once per day except if you restart HA. If you restart then it can run more than once.
Not once per year as you said.
The and part is not needed, conditions are āandā by default and itās incorrectly written anyways.
But it shouldnāt make a difference even though itās wrong, it should still work as it is.
And lastly, having delays of 1.5 hours is not good.
Itās better to add a new trigger that triggers when the device has been on for 1.5 hours and turn it off.
Long delays might get killed by a restart leaving the device on forever.
Oh and devices in automations are not great.
Itās better to use the entities since that is much easier to change if something breaks.
To further expand on the excellent advice above, you should think through the logic in more detail to ensure it will do what you want, when you want.
You said you donāt want it to run before 10:00. But if the battery level goes above 97 at 9:00 (for example), what do you want to happen once 10:00 occurs? If you want the automation to then run at 10:00, you need to add that to your automation. Meaning, you need to add a time trigger for 10:00.
What if your HA server is shut down or restarting while the battery level goes above 97? HA will have missed the battery level ācrossing the thresholdā and no trigger will occur. Do you want to check the battery level upon startup of HA? If so, youāll need to add a trigger for HA startup.
Now, letās assume youāve gone ahead and added those triggers. But we have a problem: we donāt want the automation to execute on every trigger. We want it to execute when the conditions are correct. Which are: after 10:00, battery level above 97, and hasnāt ran since midnight. So all three of those conditions need to be in the conditions section.
Thank you. Helpful suggestions. Iāll now research how to create a trigger on start up and also how to embed a delay into my action such that it doesnāt take action until after say 10am
Home assistant start event is what you are looking for.
Nonoā¦ you are going about it the wrong way here.
Donāt delay an automation more than necessary. A few seconds are fine, minutes could be an issue. Hours is a big nono.
Add a time trigger at 10:00 instead.
So that gives you three triggers, start event, battery, and 10:00.
If you could change your automation to use entities instead of devices then we would happily help you redesign the automation.
Just choose the numeric (or number?) trigger and set it up.
Then I guess the actions are call service ā switch on/off.
If you post this then you will get a proper automation back probably with some explanation, but device automations are not something people like to help with generally.