我有一个用于恒温器的Domoticz LUA脚本,我想在IF语句中实现容差。
目前的代码如下:
if (current < target) then
debuglog('Heating - Turning Physical Heater On: '.. physicalheater)
else debuglog('Heating - Turning Physical Heater OFF: '.. physicalheater)
我想要达到的目标是:
if (current < target +-2 ) then
debuglog('Heating - Turning Physical Heater On: '.. physicalheater)
else debuglog('Heating - Turning Physical Heater OFF: '.. physicalheater)