scripitng - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: scripitng (/showthread.php?tid=5832) |
scripitng - VoltTech - 10.01.2025 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 RE: scripitng - admin - 10.01.2025 You are missing quotes around group addresses. It should look like this: Code: grp.write('0/3/6', value) Other issues: - Use os.sleep(1) for all delays - In OFF branch you need to put group addresses in reverse order (from '0/3/10' to '0/3/6') - Last address in ON branch is incorrect (should be '0/3/10' instead of '0/3/6') RE: scripitng - VoltTech - 10.01.2025 (8 hours ago)admin Wrote: You are missing quotes around group addresses. It should look like this:Thank you Very much RE: scripitng - Danny - 10.01.2025 Hi Volttech, you must also use true and false instead of a 1 or 0, If you use scenes then it is fine. RE: scripitng - admin - 10.01.2025 You can use 1/0 when writing to objects. But you can't compare booleans against 1/0. |