Hi,
-
I have a pool pump that I can control via Tasmota
-
a solar panel that reports:
- how much power it’s generating
- how much power I’m using
- how much it is drawing from (positive number) or “exporting” back to the grid (negative number, i.e. the excess usage).
-
I live in a mild 4 season area. In winter we are told to run the pump only for 3 hrs a day, but in summer 8hrs a day
-
As much as possible, I want to run the pool pump only when my solar panels are generating enough excess power.
Additionally, I have set Tasmota:
- Not to power on automatically:
PowerOnState 0
- As a fail safe, to turn on the pool pump at 10am every day. I assume that openhab rule will turn it on before this time and not turn it off before this time
- With “PulseTime” of 8 hours, so the maximum amount of time the pump will run is 8 hours and it will automatically turn off by itself even if Openhab happens to be down.
- Another fail safe, have another schedule to turn off the pump at 6pm. This is because when the pump is turned off due to cloudy conditions and turned back on, pulsetime will reset for another 8hrs. This is just in the event of openhab losing connection with Tasmota after turning off/on. Thanks to @powerpolly for pointing this out.
Note:
- Don’t forget to set the time on your Tasmota:
NtpServer1 pool.ntp.org
Time 0
TimeZone +10
TimeDST / TimeSTD as appropriate
So for now I’m using the following simple rules to turn the pump on/off:
sun_elevation_threshold = 34
solar_grid_threshold = -2000
@rule("Pool pump ON")
# don't want to turn it on too early regardless of solar power / sun elevation
@when("Time cron 0 */30 8-16 ? * * *")
def pool_pump_on(event):
if items.Pool_Pump == ON:
return
if items.Sun_Elevation.intValue() < sun_elevation_threshold:
return
# Solar_Grid_Power is negative when exporting the excess power
if items.Solar_Grid_Power.intValue() < solar_grid_threshold or isinstance(items.Solar_AC_Power, UnDefType):
pool_pump_on.log.info("Turning on the Pool Pump via cron rule")
events.sendCommand("Pool_Pump", "ON")
@rule("Pool pump OFF")
@when("Time cron 0 */30 14-18 ? * * *")
def pool_pump_off(event):
if items.Pool_Pump == OFF:
return
# Turn it off when the solar power is low (cloudy?) or the sun is low
if items.Solar_Grid_Power.intValue() > solar_grid_threshold or items.Sun_Elevation.intValue() < sun_elevation_threshold:
pool_pump_off.log.info("Turning off the Pool Pump via cron rule")
events.sendCommand("Pool_Pump", "OFF")
This is a very simplistic rule, and I haven’t really tested how it goes. No doubt it will need some tweaking.
- Even in summer, the pump won’t turn on when it’s very cloudy that the solar panels aren’t generating much power. At the latest, Tasmota will turn it on at 10am.
- Even in summer, if it gets cloudy at 2pm, it will turn it off. However, what if it happens to be cloudy just when the cron rule kicked in but otherwise not cloudy after that? The “Pump ON” rule will kick in 30 minutes later.
- The power threshold of 2000 (2kW) is arbitrary and it would depend on how much your system normally generates of course. It would need tweaking.
- I’ve chosen the sun elevation threshold of 34 which seems to be suitable for my location. I derived this number by experimentation with the help of https://planetcalc.com/4270/
Comments / Suggestions?