Component developed by using the amazing development template blueprint.
This custom component for Home Assistant can be used to automatically control a pool pump that is turned on/off by a switch that Home Assistant can control.
This component is based on the work of @exxamalte.
On top of the original version by @exxamalte, this version can be installed by HACS and you can use the blueprint feature to quickly fork this repo and have a working development environment in a container.
I will adapt it to my needs. At completion this plugin will compute the filtering schedule taking into account the pool water temperature.
pool_pump.schedule
) that shows the current or next
run of the pool pump.install
.configuration.yaml
as explain below.configuration.yaml
).custom_components
directory (folder) there, you need to create it.custom_components
directory (folder) create a new folder called pool_pump
.custom_components/pool_pump/
directory (folder) in this repository.configuration.yaml
as explain belowIn the following examples we are assuming that you have a switch that is
connected to your pool pump and can turn that on/off already. That switch
is already integrated into Home Assistant with entity id switch.pool_pump_switch
.
The following configuration wraps the switch into a tri-state switch which supports 3 modes - Auto, On, Off. The automation are required to translate each state into an action on the actual switch connected to the pool pump.
The last two automation are the ones that actually checks the pool pump state. The first is triggered at regular intervals (5 minutes) from shortly before sunrise to shortly after sunset. And the second automation is triggered by certain events - the start of Home Assistant, immediately when you put the pool pump into 'Auto' mode, and whenever several key levers and sensors change.
input_select:
pool_pump_mode:
name: Pool Pump mode
options:
- 'Auto'
- 'On'
- 'Off'
initial: 'Auto'
icon: mdi:water-pump
automation:
- alias: 'Pool Pump On'
trigger:
- platform: state
entity_id: input_select.pool_pump_mode
to: 'On'
action:
service: homeassistant.turn_on
entity_id: switch.pool_pump_switch
- alias: 'Pool Pump Off'
trigger:
- platform: state
entity_id: input_select.pool_pump_mode
to: 'Off'
action:
service: homeassistant.turn_off
entity_id: switch.pool_pump_switch
- alias: 'Check Pool Pump Periodically'
trigger:
- platform: time_pattern
minutes: '/5'
seconds: 00
action:
service: pool_pump.check
- alias: 'Check Pool Pump on Event'
trigger:
- platform: homeassistant
event: start
- platform: state
entity_id:
- sensor.pool_water_temperature
- input_select.pool_pump_mode
- binary_sensor.pool_water_level_critical
action:
service: pool_pump.check
The total duration of the pool pump is computed using the pool water temperature.
You can use a sensor (like in the example below: sensor.pool_water_temperature
) or you can
use an input_number
replacing the sensor to manually set the water temperature .
Currently this integration is using an Abacus algorithm. You can go to py_pool_pump for detailed information.
If the pool pump is fed through a skimmer then there is typically a minimum water level under which the pool pump does not receive enough water anymore and starts pulling in air which is not ideal.
The Pool Pump manager supports specifying an entity id using parameter
water_level_critical_entity_id
. If that entity is on
the pool pump will
not turn on, and if it is off
then the manager will just follow its time/sun
based algorithm to turn the pool pump on or off.
Setting thin entity dedicated to critical water level is optional.
The pool pump component needs all the above entities as input to be able to make the right decision and turn the pool pump on or off automatically.
pool_pump:
switch_entity_id: switch.pool_pump_switch
pool_pump_mode_entity_id: input_select.pool_pump_mode
pool_temperature_entity_id: sensor.pool_water_temperature
# optional:
water_level_critical_entity_id: binary_sensor.pool_water_level_critical
schedule_break_in_hours: 1.0
Default value for schedule_break_in_hours
is 0 hours.
If you want to contribute to this please read the Contribution guidelines