5 hours ago
Hello guys need your help with a event based script
I have made a event based on group address of the movement of a motion sensor
My client want to when movement is trigger to turn on the lights of the corridor 1 by 1 with 1 sec delay deference
here is the script that i made but doesnt work and i dont get any error logs
--event base off the movement the motion detecor
if event.getvalue(1)
then
--light 1 without time delay when its on
value = 1
grp.write(0/3/6, value)
--light 2 with time delay 1 sec when its on
value = 1
os.sleep(1)
grp.write(0/3/7, value)
--light 3 with time delay 2 sec when its on
value = 1
os.sleep(2)
grp.write(0/3/8, value)
--light 4 with time delay 3 sec when its on
value = 1
os.sleep(3)
grp.write(0/3/9, value)
--light 5 with time delay 4 sec when its on
value = 1
os.sleep(4)
grp.write(0/3/6, value)
else
--light 1 with time delay 4 when its off
value = 0
os.sleep(4)
grp.write(0/3/6, value)
--light 2 with time delay 3 sec when its off
value = 0
os.sleep(3)
grp.write(0/3/7, value)
--light 3 with time delay 2 sec when its on
value = 0
os.sleep(2)
grp.write(0/3/8, value)
--light 4 with time delay 1 sec when its off
value = 0
os.sleep(1)
grp.write(0/3/9, value)
--light 2 without time delay when its off
value = 0
grp.write(0/3/10, value)
end
I have made a event based on group address of the movement of a motion sensor
My client want to when movement is trigger to turn on the lights of the corridor 1 by 1 with 1 sec delay deference
here is the script that i made but doesnt work and i dont get any error logs
--event base off the movement the motion detecor
if event.getvalue(1)
then
--light 1 without time delay when its on
value = 1
grp.write(0/3/6, value)
--light 2 with time delay 1 sec when its on
value = 1
os.sleep(1)
grp.write(0/3/7, value)
--light 3 with time delay 2 sec when its on
value = 1
os.sleep(2)
grp.write(0/3/8, value)
--light 4 with time delay 3 sec when its on
value = 1
os.sleep(3)
grp.write(0/3/9, value)
--light 5 with time delay 4 sec when its on
value = 1
os.sleep(4)
grp.write(0/3/6, value)
else
--light 1 with time delay 4 when its off
value = 0
os.sleep(4)
grp.write(0/3/6, value)
--light 2 with time delay 3 sec when its off
value = 0
os.sleep(3)
grp.write(0/3/7, value)
--light 3 with time delay 2 sec when its on
value = 0
os.sleep(2)
grp.write(0/3/8, value)
--light 4 with time delay 1 sec when its off
value = 0
os.sleep(1)
grp.write(0/3/9, value)
--light 2 without time delay when its off
value = 0
grp.write(0/3/10, value)
end