I have a heating system and a simple thermostat setup with espeasy. It logs to my linux server when the heater turns on and off, but I would like to have a daily report about the total amount of time while the heater was ON. So I think I would start counting seconds when the HeaterON event happens, pause it when HeaterOFF event happens, and finally send the summarized value to my linux server and reset the counter at midnight. How would you do it in a simple way? Thank you!! Here is my code:
Code: Select all
on DS1#Temperature do
if [DS1#Temperature] < 40
GPIO,5,0
Event,HeaterON
endif
if [DS1#Temperature] > 55
GPIO,5,1
Event,HeaterOFF
endif
endon
On HeaterON Do
If [Dummy#LoggingON] = 1
PostToHTTP,192.168.1.20,8080,/receiver.php,'','%lcltime% !!! Temp = [DS1#Temperature] -> Heater ON'
TaskValueSet,12,1,0
TaskValueSet,12,2,1
TaskRun,12
Endif
Endon
On HeaterOFF Do
If [Dummy#LoggingOFF] = 1
PostToHTTP,192.168.1.20,8080,/receiver.php,'','%lcltime% !!! Temp = [DS1#Temperature] -> Heater OFF'
TaskValueSet,12,1,1
TaskValueSet,12,2,0
TaskRun,12
Endif
Endon