A swimming pool has to be filtered more time depending on temperature of the water. I.e in my case the rule is:
“filter 25 minutes more for each ºC above 16ºC”
I have a google calendar binary sensor that define the minimum filtering cicle. Start at a time and stop i.e 8 hours after.
I want to dinamically configure the stop time in function of the temperature water. I.e if temp=28ºC => (28-16)*25 = 300 min more than minimum.
I have reached this, based on a dinamic calculated delay inside the action (before the stop), but (HERE IS MY BIG PROBLEM:) If I restart HA inside this period delay (between this 300 minutes), the stop action is lost, and the swimming pool dont stop filtering until next day.
I want to increase the time where an action is triggered, dinamically based on data of a sensor, so this automation timer could be survive to HA restarts. I supose that this could be simple as change the value of the “at” hour of a timer, but I cant found how to make this.
I have similar proyect, based on a raspberry pi runing pilight.
You can see my (outdated) project here: http://www.hablemosdepiscinas.com/foro/viewtopic.php?f=11&t=3906
Its a very very specialized spanish forum (probably the “best of the world” in this theme)
Thanks lolouk44
You give me the clue to how to make persistent count
What I was searching is “History Statistics Sensor”, that give you the time some sensor has been up, from history.
With this, I can “stop” the filtering when this sensor has reached some value (minutes running), defining the cicle of history statistics period for 24 hours starting at the time of cicle filtering.
I personally stepped away from the History Statistics Sensor because it was just taking too long: I store my data in a MySQL DB and until I recently set up InfluxDB / Grafana I was not purging to keep the data for (manual) reporting. This mean huge DB (>10GB) and massive latency on HA…
I guess you could still try that indeed…