Simplifying Motion based lighting piston with many sensors and lights


#1

Hi guys,

I have a pretty simple piston that I find challenging to simplify due to me being new to webcore and not knowing its full functionality

1) Give a description of the problem
I have a bunch of motion sensors controlling my lighting switches. IF (motion 1 changes) THEN (turn on switch A) ELSE (wait x minutes, turn off). Problem is, I have many repeated IFs THENs ELSEs for every motion sensors.

2) What is the expected behavior?
How can I simplify such a long piston using variables or anything else that can be used? Arrays?

3) What is happening/not happening?
Everything is happening fine, it’s a simple piston but needs simplifying.

4) Post a Green Snapshot of the pistonimage
(UPLOAD YOUR IMAGE HERE)

5) Attach any logs (From ST IDE and by turning logging level to Full)
(PASTE YOUR LOGS HERE BETWEEN THE MARKS THEN HIGHLIGHT ALL OF THE LOGS SND CLICK ON THE </> ICON TO FORMAT THEM)


#2

You could try an array. You would need to pair them in two different lists. Then use the array stuff to return which switch needs to be turned on. I personally have not tried that, but this sounds interesting.

This might help you get started. I used this simple script to change state short names into state long names.

If you would put your motions in the short name variable and your switches in the long name variable… theoretically it should work. As long as you only have one switch for each motion detector.


#3

Maybe something like this.

Only thing is you can’t use wait commands to turn the lights off. They will over write each other each time one of the motion sensors triggers…


#4

Thanks for the quick help. I’ll give this a try and report back. Instead of wait to turn off, maybe I have a seperate piston just for turning off lights.


#5

Instead of using a Wait for turn off, I usually employ this method:

temp

Although it would require some work to convert this into an array.
(I usually split the pistons for motion detectors into a room by room basis)