29.12.2022, 11:08
(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