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.

Time dependent script
#4
I´m getting an error with this script:

Code:
-- Changes light depending on time of day
date = os.date('*t')
hour = date.hour
--PIR
addr1 = '1/3/3'
--Lights val
addr2 = '1/1/74'
obj = grp.find(addr1)
if obj and obj.data and 1 <= hour and hour <= 7 then
 grp.write(addr2, 20)
    else
 grp.write(addr2, 80)
end
 if not obj.data then
 grp.write(addr2, 0)
end

The error reads: Attempt to index global ' grp'(a nil value)

Shouldn't the system check the group database for correct datatype and act accordingly..? Or am I misinterpreting the error..?
Reply


Messages In This Thread
Time dependent script - by FatMax - 18.11.2015, 13:21
RE: Time dependent script - by admin - 19.11.2015, 07:23
RE: Time dependent script - by FatMax - 19.11.2015, 08:33
RE: Time dependent script - by FatMax - 14.01.2016, 13:18
RE: Time dependent script - by admin - 14.01.2016, 13:36
RE: Time dependent script - by FatMax - 14.01.2016, 13:39
RE: Time dependent script - by KoBra - 12.09.2023, 18:34
RE: Time dependent script - by admin - 13.09.2023, 07:44
RE: Time dependent script - by KoBra - 13.09.2023, 13:16
RE: Time dependent script - by admin - 13.09.2023, 14:16
RE: Time dependent script - by KoBra - 14.09.2023, 09:25

Forum Jump: