Jump to content

Detecting activity using light switches


rodtoll

Recommended Posts

I have an ISY-99i and a large number of Insteon switches. I would like to automatically detect when there is no one home. The easiest way to do this is when someone sets the alarm system and I have that setup. However, my family doesn't always remember to do that so I would like to provide an automatic option.

 

To do this I am monitoring all the sensors I can and if any of them trigger the system realizes that someone is home. For example, if someone opens a door or triggers one of the Insteon motion sensors I know someone is there. Then I can do a timeout for inactivity.

 

My question is -- is there a way in an ISY program to trigger a program to run if the state of a switch changes? I know I can trigger an action if the light is turned on or off but building a program which checks for on or off state changes for every switch in the house is going to result in a lot of programs or a very large if statement. Is there an easier way?

Link to comment

Hello rodtoll,

 

Is your questions whether or not ISY can trigger a program in case of change in status of "any" switch or one switch. If one switch then the following should work:

If
  Status device_a is not off
Then
....

 

If you want to add more devices, then you can Or them together

If
  Status device_a is not off
Or Status device_b is not off
Or ...
Then
....

 

If you want to sense actual button presses, then what you need to do is to use Control instead of status.

 

With kind regards,

Michel

Link to comment
My question is -- is there a way in an ISY program to trigger a program to run if the state of a switch changes?

 

Much depends on what you want to do based upon the state. If you want your program to trigger at any status change, and always evaluate as true, then you may try:

 

if
status 'device A' is not off
or status 'device A' is not on
or status 'device B' is not off
or status 'device B' is not on
.
.
.
then
wait timeout period
run this program (else path) <<else

 

This program would be true if sees any activity within timeout period and false if otherwise.

Link to comment
I think what he was trying to say is

 

does the following exist"

 

Agreed

 

Sadly, No. You would need to have a gigantic if clause including every switch.

 

Agreed. If not every switch, certainly all that are of interest. I believe this is consistent with the two examples suggested so far.

Link to comment

I don't know how many switches you have, even if it was 100 it still wouldn't take that long to set up the program.

Here is an example of a way to shorten it a little.

 

If
       Status  'Furnace Room / Furnace Room SL' >= Off
    Or Status  'Ensuite / Ensuite SL' >= Off

Then
  - No Actions - (To add one, press 'Action')

Else
  - No Actions - (To add one, press 'Action')


Link to comment

As others have said, you need to have all of your lights listed in the If section.

 

However, you can shorten your list by listing them only once, using this approach.

 

Program Giant_If

If
       Status  'RC / Cuisine' is On
    Or Status  'RC / Luminaire SAD' is On
    Or Status  'RC / Spot salon' is On
    .....

Then
  - No Actions - (To add one, press 'Action')

Else
  - No Actions - (To add one, press 'Action')

 

If
       Program 'Giant_If' is False
    Or Program 'Giant_If' is True

Then
       ... This will run whenever there is any change of status of your lights listed in the Giant_If...

Else
  - No Actions - (To add one, press 'Action')

 

Benoit.

Link to comment

These were very useful. Here's what I ended up doing..

 

I used a big if statement using status. I then made a number of additions:

 

1) I created a state variable to keep track of the number of minutes since the last activity

2) I grouped the switches into programs grouped by area of the house.

3) I created a state variable to tell me if anyone was home.

4) Created a program to drive the state variable based on the set of inactivity.

 

Example of what I used to detect activity:

 

If
       Status  'Interior Lights / Basement Rec Room Back Door' is On
    Or Status  'Interior Lights / Basement Rec Room Back Door' is Off
    Or Status  'Interior Lights / Basement Stairs Top - Main' is Off
    Or Status  'Interior Lights / Basement Stairs Top - Main' is On
    Or Status  'Interior Lights / Server Room' is On
    Or Status  'Interior Lights / Server Room' is Off

Then
       $MinutesSinceLastDownstairsLightEvent  = 0
       Repeat 1440 times
          Wait  1 minute 
          $MinutesSinceLastDownstairsLightEvent += 1

Else
  - No Actions - (To add one, press 'Action')

 

I then reset the timeouts to a large number at midnight. I then combine these sub-programs with a master program which looks for activity on any of the timeouts like this:

 

If
       (
            $MinutesSinceLastDoorEvent < 21
         Or $MinutesSinceLastUpstairsLightEvent < 21
         Or $MinutesSinceLastDownstairsLightEvent < 21
         Or $MinutesSinceLastGarageEvent < 21
         Or $MinutesSinceLastMainFloorLightEvent < 21
         Or $MinutesSinceLastMainFloorMotionEvent < 21
         Or $AlarmStayModeActive is 1
       )
   And $SomeoneHome is 0

Then
       $SomeoneHome  = 1
       Send Notification to 'EmailToRod' content 'SomeoneHomeReport'
       Set Scene 'Home Buttons' On

Else
  - No Actions - (To add one, press 'Action')

 

This gives me an e-mail every time the ISY determines that someone is home because there was activity or because the alarm system is set to "Stay" because I will always know we are home if the Alarm is armed to "Stay".

 

For those curious this has done a relatively good job although it tends to timeout artificially during the day because people don't open the doors or turn on and off lights a whole bunch during the day.

 

My next attempt is going to be to create a state machine that changes state of home or not based on activity detection + door changes. For example, if I detect activity then I know someone is home and someone is home until I detect a door event. Then I go into a timeout mode like above to see if the door event resulted in someone leaving.

Link to comment

Would it be helpful to adjust the timeout period for different periods of the day as a means to account for the amount of activity that may occcur in the home when someone is present? The best example of this is late night, when everyone is sleeping, vs. early morning or early evening, when there might be more activity, where a shorter timeout might be in order.

Link to comment
  • 1 year later...

Archived

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


×
×
  • Create New...