11.02.2020, 17:26
Hello,
As a "newcomer" to LM5 as well as Lua scripting, I am struggling with a script, that features kind of a staircase function and that could be parametrised separately to implement a time-controlled lighting of a staircase or similar applications.
- The script would be triggered by a “1 bit object” originating from a motion-sensor
- The script would then dim-on the corresponding lights by sending a “1 byte object” to the dimmer
- Then the script would wait a delay time, after that it would dim down the lights by sending several decreasing values, also with some short delay in between
Well, so far, this was straight forward to implement.
Only, there would be some “extra features” needed:
a) When an another 1 bit object = 1, originating from a motion-sensor would be received during the script-execution, it should reset the initial delay time —> “staircase function” (means, restarting the script immediately)
b) When an object = 1 originating from a wall-switch would be received during the script-execution, it should stop the script, dim up the lights and disable the motion-sensor
c) When an object = 0 originating from a wall-switch would be received during the script-execution, it should stop the script, dim down the lights and disable the motion-sensor
Thank you very much.
As a "newcomer" to LM5 as well as Lua scripting, I am struggling with a script, that features kind of a staircase function and that could be parametrised separately to implement a time-controlled lighting of a staircase or similar applications.
- The script would be triggered by a “1 bit object” originating from a motion-sensor
- The script would then dim-on the corresponding lights by sending a “1 byte object” to the dimmer
- Then the script would wait a delay time, after that it would dim down the lights by sending several decreasing values, also with some short delay in between
Well, so far, this was straight forward to implement.
Code:
value = event.getvalue()
if value==true then
grp.write('9/1/3',100)
sleep(90)
grp.write('9/1/3',50)
sleep(15)
grp.write('9/1/3',30)
sleep(3)
grp.write('9/1/3',15)
sleep(3)
grp.write('9/1/1',false)
end
Only, there would be some “extra features” needed:
a) When an another 1 bit object = 1, originating from a motion-sensor would be received during the script-execution, it should reset the initial delay time —> “staircase function” (means, restarting the script immediately)
b) When an object = 1 originating from a wall-switch would be received during the script-execution, it should stop the script, dim up the lights and disable the motion-sensor
c) When an object = 0 originating from a wall-switch would be received during the script-execution, it should stop the script, dim down the lights and disable the motion-sensor
Thank you very much.