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.

Resident script stops working
#1
What would stop a resident script from running`?
I've got several resident scripts that sometimes just stop running, it shows active in script listing, but according to Processes app it does not run.
Works like normal after turning it off and on again.
Nothing appears in error logs.

This is the script most commonly to stop working, i've checked many times that all all GA's have set values like they should etc.
Code:
Output = 'scene mainbedroom'
outputvalue = 13
countdown = 'cd time mainbedroom'
mode = grp.getvalue('lightmode mainbedroom')
updatetime = storage.get('movement_mb', 0)
delta = os.time() - updatetime
pir_active = grp.getvalue('pir mainbedroom')

if pir_active == false then
  script.disable(_SCRIPTNAME)
end

cdactive = false
if mode == 1 then
  runtime = grp.getvalue('rt_m_mainbedroom')
elseif mode == 2 then
  runtime = grp.getvalue('rt_d_mainbedroom')
elseif mode == 3 then
  runtime = grp.getvalue('rt_e_mainbedroom')
elseif mode == 4 then
  runtime = grp.getvalue('rt_l_mainbedroom')
elseif mode == 5 then
  runtime = 5
end

if outputvalue == grp.getvalue(output) then
  if cdactive == true then
    grp.update(countdown, 0)
  end
  script.disable(_SCRIPTNAME)
end

if cdactive == true then
  timeleft = (runtime * 60) - delta
  grp.update(countdown, timeleft)
end

-- turn off when timer expires
if delta >= (runtime * 60) then
  grp.write(output, outputvalue)
  if cdactive == true then
    grp.update(countdown, 0)
  end
  script.disable(_SCRIPTNAME)
end

if pir_active == false then
  script.disable(_SCRIPTNAME)
end

Best regards, Jørn.
Reply


Messages In This Thread
Resident script stops working - by Jørn - 16.10.2019, 13:21
RE: Resident script stops working - by Jørn - 16.10.2019, 13:57
RE: Resident script stops working - by admin - 16.10.2019, 14:23
RE: Resident script stops working - by Jørn - 16.10.2019, 15:02

Forum Jump: