This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

cyclic time generator
#7
Code:
value = event.getvalue()

if value then
  script.enable('cycle_scriptname')
else
  script.disable('cycle_scriptname')
end



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

Thanks Daniel, I'm testing it but I can't get it to work properly. I have set 1 minute on and 2 minute off.

I have temporarily changed 1/1/4 to 0/5/3.

   
Reply


Messages In This Thread
cyclic time generator - by davidchispas - 24.08.2020, 06:42
RE: cyclic time generator - by Daniel - 24.08.2020, 07:10
RE: cyclic time generator - by davidchispas - 24.08.2020, 10:48
RE: cyclic time generator - by Daniel - 24.08.2020, 10:50
RE: cyclic time generator - by davidchispas - 24.08.2020, 13:56
RE: cyclic time generator - by Daniel - 24.08.2020, 14:31
RE: cyclic time generator - by davidchispas - 24.08.2020, 16:25
RE: cyclic time generator - by Daniel - 24.08.2020, 16:40
RE: cyclic time generator - by davidchispas - 25.08.2020, 09:07

Forum Jump: