Jump to content

Motion sensor question for occupancy


Blackbird

Recommended Posts

Posted

How do you use a motion sensor to turn a light on in a room when you walk past a motion sensor but turn off the light the next time you walk back?  Basically use the motion sensor to toggle the light on off every time you pas by.

 

Thanks

Posted (edited)

You would have to ensure no Insteon links are made between the lamp module and the MS. The MS will need to have options set so that there is very little delay between trigger reports. Send On only.

The MS cannot detect direction and this would toggle the lamp on/off only.

Use an ISY program like this.

xxxxxx

XXXXXX

xxxxxxx

Sorry bad logic removed to avoid future confusion.

Thanks to @Goose66

Edited by larryllix
  • Like 1
Posted

Instead of using a single motion sensor, you can use two for attempting to detect detection. The sequence of motion sensor triggers will provide the direction one is walking.

I say "attempting" because in real life, people walk back and forth before the sensor times out for detecting the next event. You can set each motion sensor to have a short timeout cycle to address this.

  • Like 1
Posted (edited)
4 hours ago, larryllix said:

You would have to ensure no Insteon links are made between the lamp module and the MS. The MS will need to have options set so that there is very little delay between trigger reports. Send On only.

The MS cannot detect direction and this would toggle the lamp on/off only.

Use an ISY program like this.

If
      MS control is switched ON
   AND
      Lamp status is OFF
Then
      Turn Lamp ON
Else
      Turn Lamp OFF

This solution won't work, IMO, and reveals a weakness in the ISY programming model that has been debated for years now. The problem with this simple solution is if the Lamp is ever turned on by, e.g., a switch or another program, it will just turn off again. This is because the change in Lamp Status will cause the program to run, and the Else branch will be executed because there has been no motion. 

This problem needs the two program solution that has been discussed extensively, with numerous examples in this forum and in the wiki. Basically, the first program is ENABLED, checks for motion ("If MS control is switched On") and runs the second program in the Then branch. The second program is DISABLED and toggles the state of the Lamp ("If Lamp status is OFF Then Turn Lamp ON Else Turn Lamp Off.")

Edited by Goose66
  • Like 2
Posted
1 hour ago, Goose66 said:

This solution won't work, IMO, and reveals a weakness in the ISY programming model that has been debated for years now. The problem with this simple solution is if the Lamp is ever turned on by, e.g., a switch or another program, it will just turn off again. This is because the change in Lamp Status will cause the program to run, and the Else branch will be executed because there has been no motion. 

This problem needs the two program solution that has been discussed extensively, with numerous examples in this forum and in the wiki. Basically, the first program is ENABLED, checks for motion ("If MS control is switched On") and runs the second program in the Then branch. The second program is DISABLED and toggles the state of the Lamp ("If Lamp status is OFF Then Turn Lamp ON Else Turn Lamp Off.")

Nice catch!

Yeah I forgot about the Else section running when status logic is Anded with a switched control event. A switched control event is always False if it wasn't the trigger for the program's own If secton.

Marking my post as such.

Posted

I would use variables for this to create a counter that resets whenever the light is off. 

If the variable is 0 and the light is off then set it to 1 (and turn on light) when motion is triggered. 

If variable is 1 and light is on, then turn the light off.

If the light is off then set the variable back to 0. 

With that said, you'd need to make sure the sensor could only pick you up as you walk in or out of the room. If it picks you up anywhere in the room, it won't work since it'll keep turning the lights on and off. 

As mentioned earlier, you'll want to put the motion sensor in only on mode. You'll also need to position the sensor in such a way (such as a doorway) that it cant pick up any additional movement. You may need to cover parts of it to make sure that you have as narrow of a beam as possible as well. You'll also want to ensure a single command goes out as additional commands could cause the lights to go out.  There will be some trial and error. 

 

Posted

With a single motion sensor I'd use a modification to the @larryllix method and use 2 programs. 

If
               Motion is True
     AND  light is off
then
          Turn light on
Else
          (none)
 

If
               Motion is True
     AND  light is on
then
          Turn light off
Else
          (none)

 

If there's two motion sensors to determine direction of travel it gets more complex.

Posted
30 minutes ago, MrBill said:

With a single motion sensor I'd use a modification to the @larryllix method and use 2 programs. 

If
               Motion is True
     AND  light is off
then
          Turn light on
Else
          (none)
 

If
               Motion is True
     AND  light is on
then
          Turn light off
Else
          (none)

 

If there's two motion sensors to determine direction of travel it gets more complex.

This looks like the way to go for 1 motion.  What about handling direction of travel?  And if two people walk 1 direction, im guessing there is no work around for that.  

Posted
8 minutes ago, Blackbird said:

This looks like the way to go for 1 motion.  What about handling direction of travel?  And if two people walk 1 direction, im guessing there is no work around for that.  

Not with a single motion detector.

Posted
14 hours ago, Blackbird said:

Basically use the motion sensor to toggle the light on off every time you pas by.

Hopefully you're not doing this in a room that is naturally dark at night. Kind of safety issue to turn the light off as walking into/through a room.

You'd be wise to add a delay to turning it off once motion was triggered so you could completely clear the room/area in question. 

 

  • Like 1
Posted

I use a program shift register to record the last three events into a variable. Now when a certain pattern is found and triggers various programs I know which way things went.  Each room and device has a designated two digit number based on variable constants dedicated to this, and a few other jobs. Text messages and emails are sent using these variables along with a chart of room/device numbers so the reader can interpret where the action is happening, all from one notification message.

IOW: no need for a message from each room or device. One message does it all for each function. I have used the same setup for motion sequence (break-ins), leak detection and other functions where the location in the house is important. The common variable used for each function and multiple rooms also allows one program responses that can handle every room, instead of a separate program for each room x (times) a separate bank of programs for each function.

Anybody interested in this I can post my programs that handle this. However using three devices in a series is not without it's occasional failures. I do think using only two devices in a sequence would be much more accurate and successful.

Guest
This topic is now closed to further replies.

×
×
  • Create New...