I want to automate cleaning a pond filter at different time intervals dependant on the time of year,
in summer more frequent cleans are required than in winter.
I have a shelly 2pm that starts the clean using channel 1 momentary on and channel 2 switches to active during the clean and inactive when its finished
to summarise,
in summer the clean starts
once it ends (channel 2 off), the automation waits 4 hours and starts the clean again
until autumn then the wait time changes to 6 hours
until winter, then the timer changes to 12 hours
until spring then the timer changes to 8 hours
then back to summer
if the clean is operated manually then the next scheduled clean is skipped.
I hope someone can please assist me with this as its far too complicated for me.
thanks
First, create your date/time helper Next Clean Time.
Now, automations:
First automation has following:
Trigger:
State: Next Clean Time is On.
Actions:
Activate your Shelly channels as you need for the cleaning to happen.
Wait for a time, until the cleaning needs to stop.
Deactivate your Shelly channels to end the cleaning.
Second automation has:
Trigger: Shelly Channel 1 changed from Off to On (or Channel 2 changed to Off).
Action: Using a “Choose one” action, create four options in i, one per season. In the condition of each option you can use a sensor for the season, and in the action use a Call service: set the right time in the future on the date/time helper (4, 6 or 8 hours). A template {{now + 4 *3600}} will work for summer e.g.
The net effect is that either manual or automatic cleaning end up pushing the next clean date into the future, and therefore Next Clean Time always keeps on firing.
One caveat is that I don’t know how this would happen if there is an extended outage of HA, and when HA finally restarts the Next Clean Time sensor is already on. You must test this theory somehow, on your own. If the automation doesn’t fire, you might have to extend it such that there is a second trigger “Home Assistant Started” + condition Next Clean Time = On, to cover that case.
You could conceivably combine both into a single automation, but then the mode of the automation must be changed from Single to Parallel.
Hello Rudd-O
Thanks so much for helping, would you mind explaining the following in more detail ?
and in the action use a Call service: set the right time in the future on the date/time helper (4, 6 or 8 hours). A template {{now + 4 *3600}} will work for summer e.g.
and in the action use a Call service: set the right time in the future on the date/time helper (4, 6 or 8 hours). A template {{now + 4 *3600}} will work for summer e.g.
Hello Rudd-O
Sorry to be a pain, I created the automation and all runs ok when I test run. The helper updates the time but I can’t get the helper to run
Can you help me with getting the helper to trigger the clean please
Not sure why you have the wait for trigger at the end. It does nothing.
The trigger for the automation is probably not going to for because you have selected a “to” value of “true”, which is almost certainly wrong (it’s normally “on”).
What you have there triggers when next_clean_time has arrived. Then it turns on a switch (whose ID I don’t know), and it waits for a light (whose ID I don’t know) to turn off. At no point in time is next_clean_time updated.
This doesn’t at all sound like what you wanted to do.
I made 2 automations and a helper like you said
The first automation (this one) triggers the clean
The second updates the helper time
Here’s the second automation