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 [out#t] > [in#t]//abs function
      TaskValueSet,verschil,1,[out#t]-[in#t]
    else
      TaskValueSet,verschil,1,[in#t]-[out#t]
    endif
    
    Publish domoticz/in,'{"idx":144,"nvalue":0,"svalue":"[verschil#t]"}'
    Publish domoticz/in,'{"idx":143,"nvalue":0,"svalue":"[out#t]"     }'
    Publish domoticz/in,'{"idx":142,"nvalue":0,"svalue":"[in#t]"      }'
    LCD 2,1,"[verschil#t], [out#t], [in#t]"
    //LCD 2,1,"[sw#s]"
    LCD 1,1,'[%ip%]'
  endif
 TaskValueSet,11,1,[E1SW1#Switch]
 timerSet,1,4      //Resets the Timer 1 for another 30 seconds
endon
