Pool auto filtration based on temperature

ha-pool-auto-filtration

note :
I am not an pool specialist, neither an IT developper, all informations i used is based on public pool information from specialist and homeasssitant examples .
if you see any mistakes or better way to do this , please let me know

1.purpose

Your mechanical pool programmer (like this one below ) need to be manually adapated seasonally
2022-01-09_11-49-41

the purpose of this package is to remove this re-programation task by adding an automatic filtration duration based on temperature :

why not :

  • raspipool ? :
    I started at first, by trying to implement this project , but the reliability and the cost of the probes scared me, so i preferred to start from scratch with something simple and not intrusive, that wil not play with the water alchimy.
    (the switch.pool_pump can be in parrallel with existing mechanical pool programmer)

  • only one automation for start and stop (using delay) ?
    i used this first , but the cycle can last hours, and “delay” don’t survive a reboot of HA,

  • custom component from oncleben31 : use this one, it’s better than mine, if I had know it sooner I wouldn’t have done mine :smile:

2.what it does

  • each day at input_datetime.pump_auto_start if input_boolean.auto_filtration is ON an automation will start the pump
  • as the pump is ON a sensor will be incremented , and when it reachs the duration defined by the chart , a second automation will stop the pump
  • the filtration duration is recalculated each time the temperature changes.
    so , when the temperature rease during the day, it will adapt the filtration duration

lovelace card screenshot

3.installation

3.1 prerequisites

  • activate the package mode in your configuration.yaml
homeassistant:
  packages:  !include_dir_named packages

3.2 install package

  • from my github copy pool.yaml (and eventually pool_dummy.yaml to test it ) to your config/packages folder

  • replace switch.tz3000_pompe_piscine by your switch in pool.yaml

  • replace sensor.pool_water_temp_kalman by your water temperature sensor in pool.yaml and lovelace-card.yaml

  • restart HA

  • copy the two .Png images from www/IMG/ to your folder config/www/IMG

  • in a lovelace dashboard, add a card with the content of lovelace-card.yaml

    • edit dashboard
    • add a manual card
    • show code editor
    • paste the content of pool-lovelace-card.yaml and save

if you don’t want to use your real switch and/or sensor, you can also install the pool_dummy.yaml package that will add :

  • input_number.dummy_temp_piscine : a dummy temperature input.
  • sensor.pool_water_kalman : a temperature sensor set by input_number.dummy_temp_piscine
  • switch.tz3000_pompe_piscine : a virtual pump switch.

4. usage

  • choose your mode

    • standard :
      linear ratio based on oklyn reccomandations

    • abacus :
      more complex equation based on jeedom plugin
      tips: click or long click on abacus graph to change ratio to 100 or 120 ( i use 120 )

  • select the pump filtration start hour

  • check if it works as expected

in addition you can also set the manual mode on and choose manually the filtration duration

hardware used and wiring the idea was to keep the existing system and to add an automated switch. so i wired my zigbee switch as an additional relay like this

4 Likes

Hello
Is it possible to recalculate during the day the “ input_datetime.pump_auto_stop”, because the temperature of my pool at start (temperature taken from my pool heater) is not relevant? Only few minutes after my pump pool starts, the temperature is good. And this temperature increases during the day. The auto filtration duration is good, but the time of the pump auto stop is not recalculate.

For example, this morning, the pool temperature was 9degrees =filtration 3hours. After pump pool start, the temperature increases to 14degrees, duration changes to 7,2hours (normal), but pump auto stop time has not changed (11:27)

hi,
actually i changed a little bit my automation, i order to stop the filtration when a duration is reached.
and the duration is calculated in real time, depending of the temperature, by a daily sensor

here is my new code ( i will update the github soon)

here is the new automation and sensor

  - platform: history_stats
    name: pompe_piscine_on_today
    entity_id: switch.tz3000_pompe_piscine
    state: 'on'
    type: time
    start: '{{ now().replace(hour=0, minute=0, second=0) }}'
    end: '{{ now() }}'

 -  alias: '[Pool] manual filtration cycle stop'
    description: ''
    trigger:
      - platform: numeric_state
        entity_id: sensor.pompe_piscine_on_today
        above: input_number.manual_duration
    condition:
      - condition: state
        entity_id: input_boolean.manual_filtration
        state: 'on'

hello,
it same approach of this ?

Pool Pump Manager

Wow,
If i have found the custom component from oncleben31 sooner , in wouldn’t did mine :grinning_face_with_smiling_eyes:
Thanks for the notice foxace

For people starting from scratch, I would recommend to install oncleben31’s custom component instead then my yaml.
It look really more elaborated

avec plaisir :grin:

maybe merge the two projects

@froggy.laurent
Salut, personnellement j’utilise ton projet car impossible de trouver celui de oncleben31 sur hacs et je ne comprends pas tout dans son installation manuelle.
Juste une question, stp. J’ai tout installĂ©, carte, etc
 Tout Ă  l’air bon.
Du coup, pour lancer la filtration automatiquement en fonction de la tempĂ©rature, je n’ai qu’à juste cochĂ© la case (automatic mode) et mettre l’heure dont je veux que ça le prend en compte dans (auto start time)? Et c’est tout?
Merci

Oui c’est tout :slightly_smiling_face:
Content de voir que ça sert à quelqu’un :grin:

1 Like

En tout cas, ça à l’air de fonctionner parfaitement.
Je l’ai mĂȘme fait installer a une personne sur le groupe Home assistant francophone Facebook et Idem, ça fonctionne bien.
Si tu fais d’autres mises à jour, je suis preneur :grin:

oui je maintiendrai le github, si je vois des améliorations ou des errerus

1 Like

hello
Je n’arrive pas a creer le capteur de temperature de piscine moyenne (sensor.pool_water_temp_avg).

Sachant que mon capteur s’appelle comme ceci:
sensor.piscine_temperature

Voici le code rentré:

sensor:
  - platform: template
    sensors:
      pool_water_temp_avg:
        friendly_name: "pool water"
        unique_id: sensor.pool_water_temp_avg
        unit_of_measurement: "°C"
        icon_template: mdi:coolant-temperature
        value_template: >
          {{ ((float(states('sensor.piscine_temperature')) 
          + float(states('sensor.piscine_temperature_2'))) / 2) | round(1, default=0)
          }}

Je pense qu’il bute sur ce sensor qui n’existe pas : ‘sensor.piscine_temperature_2’

ah oui, c’est un peu spĂ©cifique Ă  ma config.
j’ai 2 thermomùtres ( un dans chaque skimmer)
et je fais la moyenne des deux avec le sensor.pool_water_temp_avg
tu peux complĂštement supprimer ou commenter les lignes 2 Ă  12 et remplacer sensor.pool_water_temp_avg par sensor.piscine_temperature dans tout le reste de pool.yaml

Merci;
Du coup, a quoi sert le sensor:

   
  - platform: statistics
    name: "pool water temp avg"
    entity_id: sensor.pool_water_temp_avg
    state_characteristic: mean
    max_age:
      hours: 24 

Autre question: peux t on trouver quelque part, l’heure à laquelle va s’arreter la filtration en mode auto? Plutot que de n’avoir que l’information sous forme : 7h de filtration

Hello
Pas de rĂ©ponse Ă  ma derniĂšre question? A savoir rĂ©cupĂ©rer l’heure de fin de filtration?

I thought this was an English speaking forum! Please act accordingly!

Hello
How to retrieve the end off pump like this : 14:45:23 instead of the pump time duration line this : 7,3 hours?

I’ve found :slight_smile:

   {{ strptime(states('input_datetime.pump_auto_start'), '%H:%M:%S') 
       + timedelta( hours = states('sensor.auto_cycle_duration')|float(4) ) }}

Hello
I am interested in automating my pool pump and light. I am at the very beginning of my research.
Can you post a picture or shema of your wiring @froggy.laurent ?

c’était une erreur ( doublon) .
en fait c’est 2 mĂ©thode diffĂ©rentes pour obtenir une moyenne

ihave added a picture of the wiring on the first post.