I installed a Sonoff POW R316 switch to turn on or off my pool pump. My idea was to integrate the pump into Home Assistant to create a schedule for the water pump and do it in a way to avoid load-shedding times here in South Africa. (South Africa has a thing called Load-Shedding, where the electricity gets turned on or off at a scheduled time.)
I integrated the Sonoff switch with SonoffLAN, through HACS.
I also integrated the load-shedding schedule with HA-Eskom-Loadshedding.
My plan is to create an automation with triggers for the times I want the pump to turn on, then I thought to maybe insert an if statement to check if the trigger time (in hours) is between load-shedding start time and end time, and if it is to change a boolean switch to later when the electricity turns back on, continue turning on the pump, by maybe using a when HA starts and the boolean is switched on. If the trigger time is not between the load-shedding start time and end time the pump should just continue turning on for one hour.
Some NB notes: We do not have solar or a battery solution, so if it is load-shedding our power is out. The load-shedding schedule from the integration shows up as a calendar entity, but I know too little of Home Assistant to know how to utilize it. Basically a lot of the elements I want to do and use I know too little of, but I would really want to learn from this. I am also currently going on vacation but will be back in two weeks to further try this automation.
Some pictures of the entities I have configureded:
I was looking to solve for the same problem (over the last week my pool went slightly murky from not having the filter on for long enough, loadshedding has been spot on when my pump usually runs)
Instead of looking at when loadshedding is I just set a number of hours the pump should run per day, then after sunrise I keep turning the pump on until the desired run time is met. If there is no power to the pump then runtime does not get added.
I created a variable to measure how long my pump had been on for the day using history_stats. Then created another variable that I could be as the setpoint for how many hours a day I want to pump to run, and added a numeric input box to the dashboard to that I can easily change that setpoint.
Added an automation that runs every 30s to check if the pump should be turned on, and another automation the check if the pump should be turned off.
So far so good - will see if any errors come through during load shedding when HA cannot find the pool switch (HA Pi is connected to an inverter)
#automations.yaml additions
alias: Pool pump on timer
description: "Turns the pool pump on if it has not run for a set time. \nRuns every
10min \nOnly starts after sunrise "
trigger:
Oh that’s just whatever you put as the ID
It’s been running perfectly since I set it up, since then I have added geyser controllers and have the pump turning off when a geyser is on, this is 8n preparation for a solar inverter
Ive got a sonoff POW R2 running my pump and light. I have a custom python script i found on these forums. The interface has a winter and summer mode and it runs when the sun is up. It runs regardless of time set.
It runs for the hours you set it and it meets those requirements.