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.

Remaining time or counter
#57
Hi guys, I'm using Erwin's script.
But recently I've been getting this error message in the script log.
I use the script to operate an EnOcean switching module. It sends a short button signal to my garage door opener.
Everything still works, only this error message is new.
What could it be?

Thanks for the help
David

Code:
-- ** Staircase logic with external time object and retriggering on input object Version 3.1 ** --
-- ****************************** Created by Erwin van der Zwart **************************** --
-- ************************************** SET PARAMETERS ************************************ --
-- Set input address
AddressInput = '32/1/80'
-- Set output address
AddressOutput = '32/1/71'
-- Set unique name for staircase timer (to avoid same storage name usage)
StaircaseName = 'PIR_TR2_1'
-- Set external time address (optional)
AddressExternalTime = '4'
-- Use time left indication
UseTimeLeft = false -- Set to true if time left indication will be used
-- Set feedback adress of time left indication (optional)
AddressTimeLeft = ''
-- Set time delay (Used when external time is not available)
SetDelay = 2
-- Seconds or Minutes
SetSec = true-- Set to false for Minutes
-- Set factor delay (Multiplies Delay)
SetFac = 2
-- Logic can be turned of by value 0
Off_by_Value_Zero = false
-- ************************************** END PARAMETERS ************************************ --
-- *************************** DON'T CHANGE ANYTHING UNDER THIS LINE ************************ --
inputvalue = event.getvalue
if Off_by_Value_Zero == false and (event.getvalue() == false or event.getvalue() == 0) then
  -- Exit script
  return
end
ValueInput = grp.getvalue(AddressInput)
ValueOutput = grp.getvalue(AddressOutput)
ValueExternalTime = grp.getvalue(AddressExternalTime)
if SetSec == true then
  SetSeconds = 1
else
  SetSeconds = 60
end
if ValueExternalTime == nil then
ValueExternalTime = 0
end
if ValueExternalTime > 0 then
  StairCaseTime = ValueExternalTime * SetSeconds * SetFac
else
  StairCaseTime = SetDelay * SetSeconds * SetFac
end
if ValueInput == true then
  --check for earlier started scrips
  --check storage for stpid value
  stpid = storage.get(StaircaseName) 
  --check if stpid has a value
  if stpid == nil then
    pid = os.getpid()
    storage.set(StaircaseName, pid)
  else
    -- kill earlier running script   
    os.kill(stpid, signal.SIGKILL)
    -- create new pid for next time to kill
    pid = os.getpid() 
    storage.set(StaircaseName, pid)
  end
  if ValueOutput == false then
    grp.write(AddressOutput, true)
    ValueOutput = true
  end
  -- Check time left indication is used
  if UseTimeLeft == true then
    if StairCaseTime > 0 then
        grp.update(AddressTimeLeft, StairCaseTime)
        repeat
          StairCaseTime = StairCaseTime - 1
          grp.update(AddressTimeLeft, StairCaseTime)
          os.sleep(1)
        until StairCaseTime == 0
    end   
  else
    os.sleep(StairCaseTime)
  end
  ValueOutput = grp.getvalue(AddressOutput)
  if ValueOutput == true then
    ValueInput = grp.getvalue(AddressInput)
    if ValueInput == true then
        grp.write(AddressInput, false)
      ValueInput = false
    end
    if Off_by_Value_Zero == false then
      if ValueOutput == true then
            grp.write(AddressOutput, false)
        ValueOutput = false
          end
    else
      -- Do nothing, this will trigger else condition below on next run
    end
  end 
else
  --check for earlier started scrips
  --check storage for stpid value
  stpid = storage.get(StaircaseName) 
  --check if stpid has a value
  if stpid == nil then
  else
    -- kill earlier running script   
    os.kill(stpid, signal.SIGKILL)
    grp.update(AddressTimeLeft, 0)
    pid = nil
    storage.set(StaircaseName, pid)
  end
  if ValueOutput == true then
    grp.write(AddressOutput, false)
  end
end

Attached Files Thumbnail(s)
   
Reply


Messages In This Thread
Remaining time or counter - by Tokatubs - 15.12.2018, 21:29
RE: Remaining time or counter - by Tokatubs - 16.12.2018, 00:51
RE: Remaining time or counter - by AlexLV - 16.12.2018, 16:09
RE: Remaining time or counter - by AlexLV - 16.12.2018, 20:59
RE: Remaining time or counter - by Tokatubs - 18.12.2018, 19:35
RE: Remaining time or counter - by AlexLV - 19.12.2018, 22:14
RE: Remaining time or counter - by Thomas - 20.12.2018, 10:13
RE: Remaining time or counter - by admin - 20.12.2018, 10:54
RE: Remaining time or counter - by Tokatubs - 20.12.2018, 22:27
RE: Remaining time or counter - by Daniel - 21.12.2018, 08:42
RE: Remaining time or counter - by Tokatubs - 21.12.2018, 09:28
RE: Remaining time or counter - by Daniel - 21.12.2018, 12:18
RE: Remaining time or counter - by Daniel - 21.12.2018, 13:11
RE: Remaining time or counter - by Tokatubs - 21.12.2018, 22:54
RE: Remaining time or counter - by AlexLV - 24.12.2018, 17:00
RE: Remaining time or counter - by CHOUAIBOU - 25.12.2018, 13:24
RE: Remaining time or counter - by AlexLV - 26.12.2018, 09:05
RE: Remaining time or counter - by AlexLV - 06.01.2019, 23:05
RE: Remaining time or counter - by admin - 29.01.2020, 11:28
RE: Remaining time or counter - by admin - 29.01.2020, 13:34
RE: Remaining time or counter - by AlexLV - 30.01.2020, 07:14
RE: Remaining time or counter - by AlexLV - 30.01.2020, 12:41
RE: Remaining time or counter - by admin - 09.08.2022, 08:20
RE: Remaining time or counter - by admin - 09.08.2022, 10:09
RE: Remaining time or counter - by Novodk - 26.05.2023, 19:46
RE: Remaining time or counter - by Novodk - 27.05.2023, 07:02
RE: Remaining time or counter - by admin - 27.05.2023, 06:59
RE: Remaining time or counter - by admin - 27.05.2023, 07:06
RE: Remaining time or counter - by Novodk - 27.05.2023, 07:18
RE: Remaining time or counter - by admin - 29.05.2023, 08:29
RE: Remaining time or counter - by Novodk - 29.05.2023, 08:52
RE: Remaining time or counter - by FatMax - 29.05.2023, 09:04
RE: Remaining time or counter - by Novodk - 01.06.2023, 16:26
RE: Remaining time or counter - by Tee_Trinker - 11.09.2024, 13:03
RE: Remaining time or counter - by admin - 11.09.2024, 13:40

Forum Jump: