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.