06.10.2017, 08:41
That's what the script is already doing, except that it expects at least one telegram from setpoint or feedback object in 30 minutes. You can set poll interval for one of these objects to ensure that timer is updated via event script. grp.checkwrite ensures that only new value is sent to the bus.
Or you can use a single resident script (set sleep interval to at least 5 seconds or more) without event scripts. This way some status feedback can be missed, but I don't think that it will make much difference.
Or you can use a single resident script (set sleep interval to at least 5 seconds or more) without event scripts. This way some status feedback can be missed, but I don't think that it will make much difference.
Code:
setpoint = grp.getvalue('1/1/1')
feedback = grp.getvalue('1/1/2')
value = setpoint * feedback / 100
if value <= 10 then
timer = nil
if out then
out = false
grp.write('14/2/1', false)
end
else
if timer then
delta = os.time() - timer
if delta >= 1800 and not out then
out = true
grp.write('14/2/1', true)
end
else
timer = os.time()
end
end