26.10.2020, 11:43
Create a scheduled scripts that runs every minute.
Change group addresses as needed:
1/1/1 - mode (2 = auto)
1/1/2 - forecast (true/false)
1/1/3 - temperature value
1/1/4 - output control
To simplify things the output will turn on at 0 minutes of every hour if needed and will turn off after X minutes depending on the current temperature.
Change group addresses as needed:
1/1/1 - mode (2 = auto)
1/1/2 - forecast (true/false)
1/1/3 - temperature value
1/1/4 - output control
To simplify things the output will turn on at 0 minutes of every hour if needed and will turn off after X minutes depending on the current temperature.
Code:
mode = grp.getvalue('1/1/1')
if mode ~= 2 then
return
end
forecast = grp.getvalue('1/1/2')
temperature = grp.getvalue('1/1/3')
if not forecast or temperature > 4 then
offtime = 0
-- 0..4
elseif temperature >= 0 then
offtime = 25
-- -4..0
elseif temperature >= -4 then
offtime = 35
-- -8..-4
elseif temperature >= -8 then
offtime = 50
-- lower than -8
else
offtime = 60
end
min = os.date('*t').min
value = min < offtime
grp.checkwrite('1/1/4', value)