16.10.2019, 13:21 
		
	
	
		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.
	
	
	
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)
endBest regards, Jørn.
 
 

 

