Now, let's go to the domoticz setup. Here is how it looks :

Don't look at the last sensor "Bilan Th piscine", it is irrelevant for this topic.
The pool parameters (Redox, pH and free chlorine) are in red as there are updated only when the filtration is running.
Principles are the following :
1/ Management of the filtration
- Manu : No automatic actions are taken, you're free to switch on an off the filtration pump with the button
- AutoHC : Filtration duration is calculated according to the average water temperature, and stored in the dummy "Temps de filtration". Filtration happens during "happy hours" for electricity. Mainly at night. This is usefull only in winter the the pool has its black winter cover on
- AutoHP : Filtration duration is calculated in the same way, and filtration time is centered around solar noon. This is the normal mode most of the time
In addition to this features, in auto mode, we have freezing protection : the pump turns on if the air temperature goes below 1°C and turns off if air >1.5°C and the water temperature is over 0.5°C
A flow meter is monitoring the run of the pump, as well as the filters clogging :
- If no flow is detected 2 min after the start of the pump, the pump is stopped, chlorination set to off, filtration set to manual/off and a notification is sent
- If flow is "low enough" compared to the situation where all the filters are clean, a notification is sent to clean the filters
Electricity consumption of the filtration pump is updated in the counter "Consommation piscine"
That's all for the filtration part ; the water thermometer sensor is the one described at the beginning of the post.
2/ Management of chlorination
- Off : Nothing happens ; If mode is switched to off during the chlorination, the injection stops immediatly
- Manu : One inputs the desired amount of chlorine in "Dose de chlore (ml)" and click on "Injection chlore".
If the filtration was running at the time of the click, chlorine injection takes place immediately. If not, filtration pump is started one minute and then the injection takes place. Filtration remains on at least 30min after the injection to mix the chlorine in the pool
- Auto : The chlorine injection is requested by the filtration script, after half of the filtration time has elapsed, and if at least 30min of filtration is remaining.
Domoticz is then trying to determine the right amount of chlorine to inject base on the orp reading and the orp setpoint entered in "Consigne redox (mV)"
Then the injection takes place, followed by a 30min mixing time. The process is repeating itself up to the end of the filtration time
After the injection has been done, two counters are updated : "Consommation chlore" tracks the amount of chlorine injected daily, and "Chlore restant" estimate the amount of chlorine remaining in the tank. Notification are sent if the tank runs low, and amount of chlorine to inject is limited to the amount left in the tank to avoid air intake in the chlorine pump.
After refilling tank, one indicated how much is actually in there in the setpoint "Capacité bidon chlore (ml)" and press the button "Changement bidon chlore" to reset the counter
Finally, an estimation of free chlorine
if there were no stabilizer in the water is calculated based on the orp and pH. This one is only to give an indication and shall not be considered as an accurate estimation of free chlorine, unless you really have no stab in your water !