Logic Machine Forum
Air conditioning - 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: Air conditioning (/showthread.php?tid=4096)



Air conditioning - Danny - 17.06.2022

Dear readers,

I am looking for the following:
I have an air conditioning control but when the desired temperature is reached the fan continues to run.
now I want to switch off the air conditioning completely on the basis of the desired temperature and the current temperature and also on again with a hysteresis.

Desired temperature 5/2/14
Current temperature 5/1/14
air conditioning on off 6/1/0 1 byte object and must have a 0 for off and a 3 for heating and 9 for cooling

Can someone please help?


RE: Air conditioning - RomansP - 17.06.2022

Hello, here is a script, you can make it resident.

Code:
summer = grp.getvalue('6/1/1') -- boolean if '0' is winter, if '1' is summer
winter = not summer
 
current = grp.getvalue('5/1/14')
setpoint = grp.getvalue('5/2/14')
running = grp.getvalue('6/1/0') ~= 0

hysteresis = 0.5

value = nil

if (running and summer) then
  if current < (setpoint - hysteresis) then
    value = 0 -- off
  end
elseif (summer and current > (setpoint + hysteresis) ) then
  value = 9 -- cooling
end

if(running and winter) then
  if current > (setpoint + hysteresis) then
    value = 0 -- off
  end
elseif (winter and current < (setpoint - hysteresis) ) then
  value = 3 -- heating
end

if value then
  grp.write('6/1/0', value)
end