On System#Boot do //When the ESP boots, do gpio,14,0 timerSet,1,4 //Set Timer 1 for the next event in 30 seconds endon On Rules#Timer=1 do //When Timer1 expires, do if [Pomp#state]=1 gpio,14,0 if [out#t] > [in#t]//abs function TaskValueSet,verschil,1,[out#t]-[in#t] else TaskValueSet,verschil,1,[in#t]-[out#t] endif // SendToHTTP api.thingspeak.com,80,/update?api_key=NKVTONNH0NRQAD2T&field1=[in#t]&field2=[out#t] // Publish domoticz/in,{"idx":144,"nvalue":[verschil#t],"svalue":"[verschil#t]"} // Publish domoticz/in,{"idx":143,"nvalue":[out#t],"svalue":"[out#t]"} // Publish domoticz/in,{"idx":142,"nvalue":[in#t],"svalue":"[in#t]"} //SendToHttp 85.148.156.144,8080,/json.htm?type=command¶m=udevice&idx=144&svalue=[verschil#t] //SendToHttp 85.148.156.144,8080,/json.htm?type=command¶m=udevice&idx=143&svalue=[out#t] //SendToHttp 85.148.156.144,8080,/json.htm?type=command¶m=udevice&idx=142&svalue=[in#t] //LCD 2,1,[verschil#t] else gpio,14,1 // gpio,2,1 // LCD 2,1,%uptime% endif // TaskValueSet,11,1,[E1SW1#Switch] // TaskValueSet,dummy,2,[out#t]-[in#t] // TaskValueSet,11,3,5678 // TaskValueSet,11,4,9012 timerSet,1,4 //Resets the Timer 1 for another 30 seconds endon