Logic Machine Forum
Humidity hysteresis - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Humidity hysteresis (/showthread.php?tid=1667)



Humidity hysteresis - Domoticatorino - 22.10.2018

Hi all,
what is wrong with this script below? It is a hysteresis for umidity value. Hence hysteresis value is 3 %.

Code:
value1 = grp.getvalue('2/4/4')
value2 = grp.getvalue('2/4/55')
isteresi = 3
    if value1 >= value2 then
     grp.write('0/0/6', true)
    else if value2 >= value1 - isteresi
   then
     grp.write('0/0/6', false)
 end
    end


Claudio


RE: Humidity hysteresis - admin - 22.10.2018

It should be value1 + isteresi
If value1 is smaller than value2 (first if does not pass) then value1 - 3 will allways be smaller than value2 (second if).