Fully Automated pump management for water pool

The goal of this automation is to control the pump of a pool all around a year and with the best practice of my pool resealler.

For this we need 4 sensors :
1. a binary sensor to indicate if pool is in winter or summer mode (true equal summer)
2. a temperature sensor for the water
3. a switch to control the pump
4. a binary sensor to indicate if you want to be notified of pump activity (should be useful for debug)

If pool is in winter, of course we do nothing !
Then if the pool temperature is >= 24 °C the pump run for 24 hours. Otherwise it’s running the half time of the temperature balance around 14:00.

i.e : water temperature is 14.5 °C, the pump will start at 10:23, run for 7 hours and 15 mintues and so stop at 17:37

blueprint:
  name: Control Pool Pump
  description: define how long the pool pump should run based on water temperature
  domain: automation
  input:
    pool_summer_season:
      name: Pool Summer Season
      description: Switch to indentify if pool is in summer mode or in winter mode (true equal summer)
      selector:
        entity:
          filter:
            - domain: input_boolean
    pool_temperature:
      name: Pool Temperature Sensor
      description: Sensor that read pool temperature. We use it to calculate running duration
      selector:
        entity:
          filter:
            - domain: sensor
              device_class: temperature
    pool_pump:
      name: Pump sensor
      description: Sensor that control the pool pump
      selector:
        entity:
          filter:
            - domain: switch
    pool_pump_notification:
      name: Notify activity
      description: Notify in HA pump activity (when it start and how long)
      selector:
        entity:
          filter:
            - domain: input_boolean
alias: Pool pump control
description: >-
  The goal of this automation is to control the pump of a pool. For this we need 4 sensors :
    1. a binary sensor to indicate if pool is in winter or summer mode (true equal summer)
    2. a temperature sensor for the water
    3. a switch to control the pump
    4. a binary sensor to indicate if you want to be notified of pump activity (should be useful for debug)
  
  If pool is in winter, of course we do nothing !
  Then if the pool temperature is >= 24 °C the pump run for 24 hours. Otherwise it's running the half time of the temperature balance around 14:00.
  i.e : water temperature is 14.5 °C, the pump will start at 10:23, run for 7 hours and 15 mintues and so stop at 17:37
trigger:
  - platform: time
    at: "00:00:00"

variables:
  pool_temperature: !input 'pool_temperature'

condition:
  - condition: state
    entity_id: !input pool_summer_season
    state: "on"
action:
  - choose:
      - conditions:
          - condition: template
            value_template: >-
              {{ states(pool_temperature)|float >= 24 }}
        sequence:
          - service: switch.turn_on
            entity_id: !input pool_pump
            enabled: false
          - service: notify.persistent_notification
            data:
              message: >-
                Pool pump will run 24 hours as temperature {{ states(pool_temperature)}} is above 24°C
              title: Pool Pump Control
      - conditions:
          - condition: template
            value_template: >-
              {{ states(pool_temperature)|float < 24 }}
        sequence:
          - if:
              - condition: state
                entity_id: !input pool_pump_notification
                state: "on"
            then:
              - service: notify.persistent_notification
                data:
                  title: Pool Pump Control
                  message: >-
                    Pool pump will start at {{ as_timestamp(now().replace(hour=14, minute=0) - timedelta(hours=states(pool_temperature)
                    | float / 4)) | timestamp_custom('%H:%M') }} as water temperature is {{states(pool_temperature)}} °C
          - delay:
              seconds: >-
                {{ (14*3600) - (states(pool_temperature) | float / 4 * 3600) | round(0) }}            
          - service: switch.turn_on
            entity_id: !input pool_pump
          - if:
              - condition: state
                entity_id: !input pool_pump_notification
                state: "on"
            then:
              - service: notify.persistent_notification
                data:
                  title: Pool Pump Control
                  message: >-
                    Pool pump will stop at {{ (as_timestamp(now().replace(hour=14, minute=0)) + (states(pool_temperature) |
                    float / 4 * 3600) | round(0)) | timestamp_custom('%H:%M') }} as water temperature is {{states(pool_temperature)}} °C
          - delay:
              seconds: >-
                {{ (states(pool_temperature) |  float / 2 * 3600) | round(0) }}
          - service: switch.turn_off
            entity_id: !input pool_pump
2 Likes

Here’s how you add that fancy link. The UI only crowd will need it & bug you until they have it…
Create a link – My Home Assistant.

1 Like

What do you use as a pool temperature sensor ?

Hi,
I’m using the BLE-YC01 chineese tool : https://www.aliexpress.com/item/1005005714956657.html

And i’m planning to add a DIY ph and temperature kit : UN ANALYSEUR d'eau de PISCINE CONNECTÉ – GammaTroniques
It’s a french DIY but schema speak all language :slight_smile:

2 Likes

Hi @sybux2000 , I was looking exactly this kind of automation (pump time calculated autmatically on time)
but weirdly nothing triggers
I will try with debug mode

Is there a way to modify the behavior of the winterized mode to half an hour of filtering every 4hours , my pool vendor (Desjoyaux) recommended this mode for winterizing with salinizer?

thank you very much !

Hello,

I did add the Ph sensor using the guide from GammaTroniques. Also I use a DS18B20 for water temp.

I manage my pool based on 3 modes, Summer, Winter, offseason. Based on thoses 3 modes my pump is activated mostly at the peak of solar production, and 2 little times every nights when the electricity cost is at lowest.
between thoses mode, only the duration change.

Also while in summer, the pump activate when someone is detected onthe pool, using frigate. On winter the pump activate when the temp drop below 1°C to avoid the pool to frost and damage the pump (it is active wintering)

I think thoses modes would be some good adding on your blueprint. My automation don’t use the water temp to adjust pumping time, but would implement it after reading this post !