Created
February 10, 2018 09:11
-
-
Save acidjunk/3e6dbc50e0faf11146b2b43287e63d75 to your computer and use it in GitHub Desktop.
Revisions
-
acidjunk created this gist
Feb 10, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ -------------------------------- ------ Start of edit section ------ -------------------------------- local desired_temp = 14.0 --Desired temp local hysteresis = 0.03 --Marge local sensor = 'Temperatuur' --Name of sensor local thermostat = 'cv_master' --Master switch (virtuel) local radiateur = 'cv_switch' --Device to switch on/off -------------------------------- -- End of edit section -- -------------------------------- commandArray = {} if (devicechanged[sensor]) then print('Temperatuur updated from sensor.') local temperature = devicechanged[string.format('%s_Temperature', sensor)] print(temperature) if (otherdevices[thermostat]=='On') then print('Master switch is "On"') if (temperature < (desired_temp - hysteresis) ) then print('Switched CV On') commandArray[radiateur]='On' elseif (temperature > (desired_temp + hysteresis)) then print('Switched CV Off') commandArray[radiateur]='Off' else print ('No change needed') end else print('Master switch is "Off"; ignoring current and desired temperature') end end return commandArray