14.01.2016, 13:18
I´m getting an error with this script:
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..?
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..?