I’ve got a solar installation, and a pool pump.
I would like my pool pump to run during my peak solar generation hours; between 10am and 2pm.
I want the pump to run for 2 hours, and I don’t car when in that interval it runs.
I live in South Africa, and we have load shedding (power turns off). The way my pool is wired, it can’t turn on during load shedding. The schedule for when my power will be off is different every day.
I want to be able to get those two hours of pool running, within that peak solar range, and be able to have it work even if interrupted from load shedding.
I’ve played a bit with helpers and it feels like there could be a smart solution in there somewhere, but struggling to think of it.
I think a key for this automation will be a history stats sensor to track the runtime of the pump.
sensor:
- platform: history_stats
name: Pool Pump Active Hours
entity_id: switch.pool_pump
state: "on"
type: time
start: "{{ today_at() }}"
end: "{{ now() }}"
You haven’t supplied a lot of detail, but a second key part will be dealing with/detecting the load shedding. What mechanism do you have to detect when power is available for your pump? Even something like a state change of the pump from unknown/unavailable to off. Whatever that is, you will need to add that as a trigger and condition.
trigger:
- id: 'on'
platform: time
at: "10:00:00"
- id: 'on'
platform: numeric_state
entity_id: sensor.solar_production
above: ?
for: "00:02:00"
- platform: time
at: "14:00:00"
id: 'off'
- platform: numeric_state
above: 2
entity_id: sensor.pool_pump_active_hours
id: 'off'
- alias: Detect the end of load shedding
id: 'on'
platform: state
entity_id: ?
to: ?
from: ?
condition:
action:
- choose:
- conditions:
- condition: trigger
id: 'on'
- alias: Only run pump if it hasn't run for 2 hours today
condition: numeric_state
below: 2
entity_id: sensor.pool_pump_active_hours
- alias: Limit pump running when solar production is above threshold
condition: numeric_state
entity_id: sensor.solar_production
above: ?
sequence:
- service: switch.turn_on
entity_id: switch.pool_pump
- conditions:
- condition: trigger
id: 'off'
sequence:
- service: switch.turn_off
entity_id: switch.pool_pump