fork download
  1. t1 = os.time()
  2. --s = otherdevices_lastupdate['Garagedeur']
  3. -- returns a date time like 2013-07-11 17:23:12
  4.  
  5. year = string.sub(s, 1, 4)
  6. month = string.sub(s, 6, 7)
  7. day = string.sub(s, 9, 10)
  8. hour = string.sub(s, 12, 13)
  9. minutes = string.sub(s, 15, 16)
  10. seconds = string.sub(s, 18, 19)
  11.  
  12. commandArray = {}
  13.  
  14. --t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
  15. t2 = os.time{month=month}
  16. difference = (os.difftime (t1, t2))
  17. if (otherdevices['Garagedeur'] == 'Open' and difference > 600 and difference < 700) then
  18. commandArray['SendNotification']='Garage door alert#The garage door has been open for more than 10 minutes!'
  19. end
  20.  
  21. return commandArray
Runtime error #stdin #stdout #stderr 0s 14120KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
lua5.3: prog.lua:5: bad argument #1 to 'sub' (string expected, got nil)
stack traceback:
	[C]: in function 'string.sub'
	prog.lua:5: in main chunk
	[C]: in ?