18.08.2021, 06:57
This will send OFF command when a fault is detected:
Code:
stop_1 = event.getvalue()
stop_2 = grp.getvalue('5/0/20')
on_1 = grp.getvalue('5/0/1') and not stop_1
on_2 = grp.getvalue('5/0/2') and not stop_2
-- switch to the second pump
if stop_1 then
grp.write('5/0/1', false)
if not stop_2 and not on_2 then
grp.write('5/0/2', true)
storage.set('pump_time', 0)
end
-- fault is removed and no pump is running
elseif not on_1 and not on_2 then
grp.write('5/0/1', true)
storage.set('pump_time', 0)
end
Code:
stop_1 = grp.getvalue('5/0/10')
stop_2 = event.getvalue()
on_1 = grp.getvalue('5/0/1') and not stop_1
on_2 = grp.getvalue('5/0/2') and not stop_2
-- switch to the first pump if it's not in a fault state
if stop_2 then
grp.write('5/0/2', false)
if not stop_1 and not on_1 then
grp.write('5/0/1', true)
storage.set('pump_time', 0)
end
-- fault is removed and no pump is running
elseif not on_1 and not on_2 then
grp.write('5/0/2', true)
storage.set('pump_time', 0)
end