Event lowThSet
Fires when the temperature too low/normal threshold has been changed (when temperature monitoring is enabled).Assign a function to this event to handle it. For example
var Normal=1, TooHigh=2, TooLow=3; var kumostat = <#Kumostat_[72]_1#>; var setTime, tempToRaise, tempToCool; var averageTimeToHeatPerDeg=0, averageTimeToCoolPerDeg=0; var devices = <~devices to send estimate~>; kumostat.target.lowThSet=function(target){ if(target.tempState==TooLow && kumostat.hvacOn) { setTime=KumoApp.Tick; tempToRaise=target.th_low-target.temperature; tempToCool=0; if(averageTimeToHeatPerDeg>0){ devices.push("Expected to take " + KumoApp.UserFriendlyTimeSpan(averageTimeToHeatPerDeg*tempToRaise) + " to reach " + target.th_low); } } } kumostat.target.highThSet=function(target){ if(target.tempState==TooHigh && kumostat.hvacOn) { setTime=KumoApp.Tick; tempToCool=target.temperature-target.th_high; tempToRaise=0; if(averageTimeToCoolPerDeg>0){ devices.push("Expected to take " + KumoApp.UserFriendlyTimeSpan(averageTimeToCoolPerDeg*tempToCool) + " to reach " + target.th_high); } } } kumostat.target.temperatureCross=function(target){ if(target.tempState=Normal && kumostat.hvacOn){ if(tempToCool>0){ if(averageTimeToCoolPerDeg==0)averageTimeToCoolPerDeg=(KumoApp.Tick-setTime)/tempToCool; else averageTimeToCoolPerDeg=(KumoApp.Tick-setTime)/tempToCool/2+averageTimeToCoolPerDeg/2; } else if(tempToRaise>0){ if(averageTimeToHeatPerDeg==0)averageTimeToHeatPerDeg=(KumoApp.Tick-setTime)/tempToRaise; else averageTimeToHeatPerDeg=(KumoApp.Tick-setTime)/tempToRaise/2+averageTimeToHeatPerDeg/2; } } }