Logic Machine Forum
Thermostat Script - 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: Thermostat Script (/showthread.php?tid=4471)



Thermostat Script - mishoboss - 28.12.2022

Hi folks, can anyone suggest (or kindly give a snippet) how to create a simple thermostat script?

The idea is to have 3 GA - current temperature, setpoint temperature and control valve (1 bit output).

And turn on/off the output control valve depending on the current temperature and setpoint values with a given hysteresis (e.g. 1 degree).


RE: Thermostat Script - AEK - 29.12.2022

(28.12.2022, 22:52)mishoboss Wrote: Hi folks, can anyone suggest (or kindly give a snippet) how to create a simple thermostat script?

The idea is to have 3 GA - current temperature, setpoint temperature and control valve (1 bit output).

And turn on/off the output control valve depending on the current temperature and setpoint values with a given hysteresis (e.g. 1 degree).

create event based script, map it on tag "thermostat1", map the same tag to current and setpoint objects. paste code to script (change GA addresses to what you need)

cur = grp.getvalue('current temp address or name')
set= grp.getvalue('setpoint temp address or name')

if set > cur then
  grp.write('valve  address or name', true)
else
  grp.write( 'valve  address or name', false)
end