Lights and Motion detector


#1

1) Give a description of the problem
I need help determining the best way to have lights turn off and on from a motion detector

2) What is the expected behavior?
When someone walks into the room turn on the light and then turn them off after 8 minutes if there isn’t anyone moving in the room.

3) What is happening/not happening?
I’ve tried putting the time wait in different sections of the loop and can’t figure out what is best. I’ve had too many times to be a coincident that when I walk into the room that the light is on in it turns off instantly.

**4) Post a Green Snapshot


#2

I suggest you look into the Example Pistons section of the forum. There are literally dozens of ways to do what you’re asking and they are all outlined there. But what you have is definitely not one of them. First question…what is the timeout for your motion sensor? When tripped, how long does it stay active if no new motion is detected. This is called the timeout. Most sensors have them. If so, set yours to 8 and eliminate the wait period in your piston and move the turning off to the else of the motion active.


#3

Personally I like “stays” as the trigger for turning off the light.

So you can keep your first block as is…but the second one would be:

IF motion sensor stays inactive for X minutes
Then
Turn off light

I say X there because as was stated, you can do this from the motion sensor itself by adjusting the time before it goes back to inactive…or you can factor in the value it’s set to and add the number of minutes you need to get up to 8.


#4

Most efficient and reliable way is actually to use ELSE and WAIT.

IF
motion is active
THEN
turn on light
ELSE
wait x minutes
turn off.

The wait in the else part of the piston will be cancelled every time motion returns.


#5

Thanks for the input the issue is that it is a Bosch motion sensor that I don’t think you can adjust the timeout it is set at 3 minutes I believe


#6

I cant figure out where to put the wait in the else statement. Can you show an example?


#7

All commands need to be inside of a “container”.

I usually place WAITS inside the default “Location” block.

  • Add a new statement
  • Add an action
  • Add a Task
  • Select a command
  • Choose WAIT
  • Adjust duration
  • Add