Jump to content

Which is a better way to program a motion sensor?


Recommended Posts

I have a 2 motion sensors (one upstairs and other downstairs) and depending on specific conditions, I'd like to perform multiple actions .. wanted to get your thoughts on what might be a better way:



1. Continue to turn downstairs lights on for 5 min when detect motion downstairs between sunset and 8 pm

2. Continue to turn upstairs lights on for 20 min when detect motion upstairs between sunset and 10 pm

3. Continue to turn downstairs thermostat on for 15 min when detect motion downstairs between 4 pm - 7 pm

4. Continue to turn upstairs thermostat on for 30 min when detect motion downstairs between 4 pm - 9 pm

5. Turn few other lights on when motion detected both upstairs and downstairs (under certain conditions)

6. Few other requirements on similar lines ..


Approach A:

Each requirement becomes a set of programs of it's own, for example

-- when detect motion downstairs between sunset and 8pm, call a program to turn downstairs lights on for 5 min

-- when detect motion upstairs between <conditions> , call a program to <take action>

-- similar set of programs


Approach B:

Create a program to detect motion downstairs and yet another one to detect motion upstairs. Any every time a motion is detected it calls sub programs that evaluate conditions and take action, for example:

-- when detect motion downstairs, call the following programs:

    --- if between sunset and 8pm, turn downstairs lights on for 5 min

    --- if between 4pm - 7pm, turn downstairs thermostat on

    --- similar set of programs


The key difference in the 2 approaches is that first one fires when the all conditions are true and will fire only during few hours in the evening. However, in approach B, the main program will fire all the time (even if there is motion detected in the morning hours), but the sub programs will evaluate whether or not the condition is true to take an action.


What are your thoughts on which might be better? Or if there is yet another more elegant way to achieve this?


Thanks so much for your inputs.

Link to comment

Kids come back from school at different times in the afternoon and are in & out during the late afternoon period. The goal is to have at least certain lights and thermostat turned on, while the home is occupied during that "in & out" period.


My real question however, is what would be a more efficient way to write this kind of program?


Thanks and sorry about not being explicit about the question.

Link to comment

In the end you will probably end up writing an occupancy program using a variable to keep track if anybody is home or not.


I have any Insteon action to trigger a "Home" varible and it times off with different stimuli.


20 minutes after I leave by my usual door.

Immediately if I set the alarm system

4 hours if I trigger any other MS in the house.

Never after bedtime until 7:00 AM again then 4 hours


After creating this variable programs can use the variable to test for people home. If the variable is a state variable it can also trigger programs to run by itself or with other logic combined.


Now you stop you furnace fan from cycling, ventilation off, temperature down or up, lock the doors after X minutes.etc..etc..

Link to comment

Either option seems viable. The question that goes through my min is whic option introduces the least delay between motion and response. I suspect that might be option A.


Consider, however, option C. What about creating four program folders, each enabled by one of the time ranges. In each folder, add a program: if motion sensed, turn light on, wait x, turn light off. The only uncertainty I have are whether the program wait would be interrupted if the folder is disabled during a wait state.

Link to comment
  • 2 weeks later...

Any documented, robust methods of occupancy detection using variables?  I have several occupancy sensors but have had limited use.  I think that I should explore the use of occupancy variables and then using those as part of my logic... rather than trying to incorporate the motion sensing into programs.

Link to comment


This topic is now archived and is closed to further replies.

  • Create New...