24.08.2020, 14:31
Event script attached to 1/1/1
cycle_scriptname replace with a name of resident script.
Resident script of interval 60s
BR
Code:
value = event.getvalue()
if value then
script.enable('cycle_scriptname')
else
script.disable('cycle_scriptname')
end
Resident script of interval 60s
Code:
timerOn = grp.getvalue('1/1/2')
timerOff = grp.getvalue('1/1/3')
onCounter = storage.get('onCounter', 0)
offCounter = storage.get('offCounter', 0)
onCounter = onCounter +1
offCounter = offCounter +1
log(onCounter,offCounter)
if onCounter >= timerOn then
grp.write('1/1/4', true)
storage.set('onCounter', 0)
else
storage.set('onCounter', onCounter)
end
if offCounter >= timerOff then
grp.write('1/1/4', false)
storage.set('offCounter', 0)
else
storage.set('offCounter', offCounter)
end
BR
------------------------------
Ctrl+F5
Ctrl+F5