[Help Needed] ESP Easy Rule for Automatic Pool Filtration Management
Posted: 10 Mar 2025, 18:26
Hello everyone,
I need help creating an ESP Easy rule to automatically manage my pool filtration. Since I’m a beginner, I’m struggling to design a rule that integrates multiple essential functions. Here’s a summary of my needs:
1. How Pool Filtration Works
Filtration is crucial to keeping the water clean and preventing algae growth.
Why?
When the water temperature exceeds 12°C, the risk of algae growth increases (especially due to UV exposure).
Below 10°C, a reduced filtration time (e.g., 1h30) is sufficient to circulate the water and prevent stagnation.
Advanced Method – Abacus Curve:
Instead of using a simple formula (e.g., temperature/2), I’d like to use the "Abacus curve" method (like in Jeedom’s pool plugin) to optimize energy consumption and ensure effective filtration.
Example: A minimum duration of 1h30 at 10°C, adding 0.5 hours per degree above 10°C.
2. Hardware Setup and Devices
Here’s a breakdown of my installation, based on my JSON configuration:
Temperature Sensors:
Pool: Task “Temperature” (Name: Piscine) – Displays the pool water temperature.
Outdoor: Task “Temperature” (Name: Extérieur) – Used for display on the OLED screen.
Filtration Control and Other Features:
Filtration: Task Filtration on GPIO2 (value: EtatFiltration).
Heat Pump (PAC): Task PAC on GPIO12 (value: EtatPAC).
Lighting: Task Eclairage on GPIO4 (value: EtatEclairage).
Switches:
ModeAUTO: Task ModeAUTO (value: EtatModeAUTO) to toggle between automatic and manual mode.
InterON/InterOFF: Tasks InterOn and InterOFF (values: EtatInterON and EtatInterOFF) to force filtration ON or turn it OFF.
Filtration Duration Adjustment:
Two push buttons named boutonPlus and BoutonMoins (value: State) should allow increasing or decreasing the filtration duration in percentage (e.g., from 50% to 150%).
OLED Display (Task: OLED):
Line 1: "Pool Water: [Temperature#Piscine] °C"
Line 2: "Outdoor Temp: [Temperature#Extérieur] °C"
Line 5: "Mode: ..." (updated via a rule)
Line 6: "Filtration: ..." (ON/OFF via a rule)
Line 7: "Lighting: ..." (ON/OFF via a rule)
Line 8: "PAC: ..." (ON/OFF via a rule)
3. Desired Features
Automatic Filtration:
Filtration duration is automatically calculated based on the temperature using the Abacus curve (e.g., a minimum of 1h30 for T < 10°C, with +0.5h per degree above 10°C).
This duration, considered as 100%, should be adjustable via a multiplier.
Manual Adjustment via Buttons:
I want to increase or decrease the filtration duration in percentage (from 50% to 150%) using the boutonPlus and BoutonMoins buttons.
Anti-Freeze Protection:
If the temperature drops below a critical threshold (e.g., < 3°C), the pump must activate immediately to prevent pipes from freezing, even if it’s outside the normal filtration cycle.
Power Outage Safety:
Option 1: On restart, the ESP turns off the pump for safety and recalculates the filtration cycle if the reboot happens after the expected start time (even if it results in extra filtration, which is acceptable).
Option 2: Memory Storage – To avoid losing data during a power outage, I want to save the calculated filtration duration in non-volatile memory. The idea is to store this value once per day, so the system can resume its cycle normally after a reboot without requiring manual intervention.
Here’s my current functional code, but it lacks the ability to adjust filtration times via the Plus and Minus buttons, which I don’t know how to implement:
Any help or suggestions would be greatly appreciated. Thank you in advance!
I need help creating an ESP Easy rule to automatically manage my pool filtration. Since I’m a beginner, I’m struggling to design a rule that integrates multiple essential functions. Here’s a summary of my needs:
1. How Pool Filtration Works
Filtration is crucial to keeping the water clean and preventing algae growth.
Why?
When the water temperature exceeds 12°C, the risk of algae growth increases (especially due to UV exposure).
Below 10°C, a reduced filtration time (e.g., 1h30) is sufficient to circulate the water and prevent stagnation.
Advanced Method – Abacus Curve:
Instead of using a simple formula (e.g., temperature/2), I’d like to use the "Abacus curve" method (like in Jeedom’s pool plugin) to optimize energy consumption and ensure effective filtration.
Example: A minimum duration of 1h30 at 10°C, adding 0.5 hours per degree above 10°C.
2. Hardware Setup and Devices
Here’s a breakdown of my installation, based on my JSON configuration:
Temperature Sensors:
Pool: Task “Temperature” (Name: Piscine) – Displays the pool water temperature.
Outdoor: Task “Temperature” (Name: Extérieur) – Used for display on the OLED screen.
Filtration Control and Other Features:
Filtration: Task Filtration on GPIO2 (value: EtatFiltration).
Heat Pump (PAC): Task PAC on GPIO12 (value: EtatPAC).
Lighting: Task Eclairage on GPIO4 (value: EtatEclairage).
Switches:
ModeAUTO: Task ModeAUTO (value: EtatModeAUTO) to toggle between automatic and manual mode.
InterON/InterOFF: Tasks InterOn and InterOFF (values: EtatInterON and EtatInterOFF) to force filtration ON or turn it OFF.
Filtration Duration Adjustment:
Two push buttons named boutonPlus and BoutonMoins (value: State) should allow increasing or decreasing the filtration duration in percentage (e.g., from 50% to 150%).
OLED Display (Task: OLED):
Line 1: "Pool Water: [Temperature#Piscine] °C"
Line 2: "Outdoor Temp: [Temperature#Extérieur] °C"
Line 5: "Mode: ..." (updated via a rule)
Line 6: "Filtration: ..." (ON/OFF via a rule)
Line 7: "Lighting: ..." (ON/OFF via a rule)
Line 8: "PAC: ..." (ON/OFF via a rule)
3. Desired Features
Automatic Filtration:
Filtration duration is automatically calculated based on the temperature using the Abacus curve (e.g., a minimum of 1h30 for T < 10°C, with +0.5h per degree above 10°C).
This duration, considered as 100%, should be adjustable via a multiplier.
Manual Adjustment via Buttons:
I want to increase or decrease the filtration duration in percentage (from 50% to 150%) using the boutonPlus and BoutonMoins buttons.
Anti-Freeze Protection:
If the temperature drops below a critical threshold (e.g., < 3°C), the pump must activate immediately to prevent pipes from freezing, even if it’s outside the normal filtration cycle.
Power Outage Safety:
Option 1: On restart, the ESP turns off the pump for safety and recalculates the filtration cycle if the reboot happens after the expected start time (even if it results in extra filtration, which is acceptable).
Option 2: Memory Storage – To avoid losing data during a power outage, I want to save the calculated filtration duration in non-volatile memory. The idea is to store this value once per day, so the system can resume its cycle normally after a reboot without requiring manual intervention.
Here’s my current functional code, but it lacks the ability to adjust filtration times via the Plus and Minus buttons, which I don’t know how to implement:
Code: Select all
//Boot
On System#Boot do
oledframedcmd,6,"Filtration: OFF" // Affiche "Filtration: OFF" sur l'écran OLED
oledframedcmd,7,"Eclairage: OFF" // Affiche "Eclairage: OFF" sur l'écran OLED
oledframedcmd,8,"PAC: OFF" // Affiche "PAC: OFF" sur l'écran OLED
logentry,"Système démarré." // Log: Système démarré
endon
// Sécurité ANTI-GEL
On Temperature#Piscine do
if [ModeAUTO#EtatModeAUTO]=1 And [InterOFF#EtatInterOFF]=0 And [Temperature#Piscine]<=8
GPIO,2,1 // Active la filtration
timerSet,1,30 // Timer de 30 secondes
oledframedcmd,5,"ANTI-GEL ON" // Affiche "ANTI-GEL ON" sur l'écran OLED
logentry,"Anti-gel activé." // Log: Anti-gel activé
endif
endon
// Début journée
On Clock#Time=All,19:00 do
if [ModeAUTO#EtatModeAUTO]=1
if [Temperature#Piscine]>8 and [Temperature#Piscine]<=10
timerSet,1,30 // Timer de 30 secondes
GPIO,2,1
oledframedcmd,9,"Filtration AUTO" // Affiche "Filtration AUTO" sur la ligne 9
oledframedcmd,10,"de 9h à 11h" // Affiche "de 9h à 11h" sur la ligne 10
oledframedcmd,11,"Total:" // Affiche "Total:" sur la ligne 11
oledframedcmd,12,"30 sec" // Affiche "30 sec" sur la ligne 12
logentry,"Filtration: 30s" // Log: Filtration activée pour 30 secondes
elseif [Temperature#Piscine]<=15
timerSet,1,60 // Timer de 1 minute
GPIO,2,1
oledframedcmd,9,"Filtration AUTO" // Affiche "Filtration AUTO" sur la ligne 9
oledframedcmd,10,"de 9h à 11h" // Affiche "de 9h à 11h" sur la ligne 10
oledframedcmd,11,"Total:" // Affiche "Total:" sur la ligne 11
oledframedcmd,12,"1 min" // Affiche "1 min" sur la ligne 12
logentry,"Filtration: 1min" // Log: Filtration activée pour 1 minute
elseif [Temperature#Piscine]<=20
timerSet,1,90 // Timer de 1 minute 30
GPIO,2,1
oledframedcmd,9,"Filtration AUTO" // Affiche "Filtration AUTO" sur la ligne 9
oledframedcmd,10,"de 9h à 11h" // Affiche "de 9h à 11h" sur la ligne 10
oledframedcmd,11,"Total:" // Affiche "Total:" sur la ligne 11
oledframedcmd,12,"1 min 30" // Affiche "1 min 30" sur la ligne 12
logentry,"Filtration: 1min30" // Log: Filtration activée pour 1 minute 30
elseif [Temperature#Piscine]<=25
timerSet,1,120 // Timer de 2 minutes
GPIO,2,1
oledframedcmd,9,"Filtration AUTO" // Affiche "Filtration AUTO" sur la ligne 9
oledframedcmd,10,"de 9h à 11h" // Affiche "de 9h à 11h" sur la ligne 10
oledframedcmd,11,"Total:" // Affiche "Total:" sur la ligne 11
oledframedcmd,12,"2 min" // Affiche "2 min" sur la ligne 12
logentry,"Filtration: 2h" // Log: Filtration activée pour 2 heures
elseif [Temperature#Piscine]<=28
timerSet,1,150 // Timer de 2 minutes 30
GPIO,2,1
oledframedcmd,9,"Filtration AUTO" // Affiche "Filtration AUTO" sur la ligne 9
oledframedcmd,10,"de 9h à 11h" // Affiche "de 9h à 11h" sur la ligne 10
oledframedcmd,11,"Total:" // Affiche "Total:" sur la ligne 11
oledframedcmd,12,"2 min 30" // Affiche "2 min 30" sur la ligne 12
logentry,"Filtration: 2min30" // Log: Filtration activée pour 2 minutes 30
elseif [Temperature#Piscine]>28
timerSet,1,180 // Timer de 3 minutes
GPIO,2,1
oledframedcmd,9,"Filtration AUTO" // Affiche "Filtration AUTO" sur la ligne 9
oledframedcmd,10,"de 9h à 11h" // Affiche "de 9h à 11h" sur la ligne 10
oledframedcmd,11,"Total:" // Affiche "Total:" sur la ligne 11
oledframedcmd,12,"3 min" // Affiche "3 min" sur la ligne 12
logentry,"Filtration: 3min" // Log: Filtration activée pour 3 minutes
endif
endif
endon
// Fin du timer
On Rules#Timer=1 do
GPIO,2,0 // Désactive la filtration
oledframedcmd,5,"Mode: AUTO" // Affiche "Mode: AUTO" sur la ligne 5
oledframedcmd,9," " // Efface la ligne 9
oledframedcmd,10," " // Efface la ligne 10
oledframedcmd,11," " // Efface la ligne 11
oledframedcmd,12," " // Efface la ligne 12
logentry,"Filtration désactivée. Affichage nettoyé." // Log: Filtration désactivée et affichage nettoyé
endon
// Sécurité - Fin de journée
On Clock#Time=All,19:58 do
if [ModeAUTO#EtatModeAUTO]=1
if [Temperature#Piscine]>8
GPIO,2,0 // Désactive la filtration
logentry,"Fin de journée." // Log: Filtration désactivée en fin de journée
endif
endif
endon
Code: Select all
// Affichage Filtration sur l'ecran
On Filtration#EtatFiltration do
if [Filtration#EtatFiltration]=1
oledframedcmd,6,"Filtration: ON"
else
oledframedcmd,6,"Filtration: OFF"
endif
endon
// Affichage Eclairage sur l'ecran
On Eclairage#EtatEclairage do
if [Eclairage#EtatEclairage]=1
oledframedcmd,7,"Eclairage: ON"
else
oledframedcmd,7,"Eclairage: OFF"
endif
endon
//Affichage PAC sur l'ecran
On PAC#EtatPAC do
if [PAC#EtatPAC]=1
oledframedcmd,8,"PAC: ON"
else
oledframedcmd,8,"PAC: OFF"
endif
endon
Code: Select all
// Mode Auto/Manuel
On ModeAuto#EtatModeAUTO do
// Ne change rien si en mode Forcé ou Arrêt
if ([InterON#EtatInterON]=0 and [InterOFF#EtatInterOFF]=0)
if [ModeAuto#EtatModeAUTO]=1
oledframedcmd,5,"Mode : Auto"
else
oledframedcmd,5,"Mode : Manuel"
endif
endif
endon
// Mode Forcé (InterON)
On InterON#EtatInterON do
if [InterON#EtatInterON]=1
oledframedcmd,5,"Mode : Forcé"
gpio,2,1 // Active la filtration
endif
if [InterON#EtatInterON]=0 and [InterOFF#EtatInterOFF]=0
// Retour au mode précédent (Auto ou Manuel), mais ne désactive pas la filtration
if [ModeAuto#EtatModeAUTO]=1
oledframedcmd,5,"Mode : Auto"
else
oledframedcmd,5,"Mode : Manuel"
endif
endif
endon
// Mode Arrêt (InterOFF)
On InterOFF#EtatInterOFF do
if [InterOFF#EtatInterOFF]=1
oledframedcmd,5,"Mode : Arrêt"
gpio,2,0 // Désactive la filtration
endif
if [InterON#EtatInterON]=0 and [InterOFF#EtatInterOFF]=0
// Retour au mode précédent (Auto ou Manuel)
if [ModeAuto#EtatModeAUTO]=1
oledframedcmd,5,"Mode : Auto"
else
oledframedcmd,5,"Mode : Manuel"
endif
// Désactive la filtration uniquement en mode Arrêt
gpio,2,0 // Désactive la filtration
endif
endon