Jump to content

Motion Sensor Programming Question


GDavis01

Recommended Posts

I have an old motion sensor 2420M that I want to use in the boathouse of our vacation home. The idea being that if someone enters the boathouse while we are away then I will be notified via email (and/or text) and, if it's at night, a series of lights in the house will be turned to on to simulate our presence. Below are the 3 programs that i wrote to hopefully accomplish what I want. (Eventually I want to install an IP camera in the boathouse but I have to resolve a series of issues before I get to that)

 

I have set up the sensor with the parameters as set out in the attached file

 

I have 2 questions...

 

1 - Why, when I setup the motion sensor, does the ISY change the device type from 2420M (1312 REV:2.2) to 2842-222 INSTEON Motion Sensor v.41? Does this matter?

 

2 - Am I correct (given the parameters I set up the sensor with) in assuming that using the syntax "Control 'Motion-Sensor' is switched On And Control 'Motion-Sensor' is not switched Off", while the other conditions remain true, means that I would only receive the email notification of entry once, that is initially when someone enters? I also assume that I would receive the email notification of exit 15 minutes (timeout) after they left the boathouse. I want to confirm that I wouldn't be receiving a constant flow of notifications while someone keeps moving around in the boathouse. 

 

Here is the code...

 

Boathouse Sensor Night - [iD 002A][Parent 0001]

 

If

        (

             From    Sunset 

             To      Sunrise (next day)

        )

    And (

             Control 'Motion-Sensor' is switched On

         And Control 'Motion-Sensor' is not switched Off

        )

    And $GMD's_iPhone5_Cottage is 0      [populated from Mobilinc - meaning I am away}

 

Then

        Send Notification to 'GaryD' content 'Someone has entered the Boathouse'

        Run Program 'Boathouse Late Entry' (Then Path)

 

Else

        Send Notification to 'GaryD' content 'Whoever was in the Boathouse has now Left'

        Run Program 'Boathouse Late Entry' (Else Path)

 

 

 

This program only starts at night when the sensor goes to ON and when I'm away.

 

Boathouse Sensor Day - [iD 0035][Parent 0001]

 

If

        (

             From    Sunrise +  1 minute

             To      Sunset  -  1 minute (same day)

        )

    And (

             Control 'Motion-Sensor' is switched On

         And Control 'Motion-Sensor' is not switched Off

        )

    And $GMD's_iPhone5_Cottage is 0

 

Then

        Send Notification to 'GaryD' content 'Someone has entered the Boathouse'

        Send Notification to 'Gary's Cell' content 'Someone has entered the Boathouse'

 

Else

        Send Notification to 'GaryD' content 'Whoever was in the Boathouse has now Left'

        Send Notification to 'Gary's Cell' content 'Whoever was in the Boathouse has now Left'

 

This program is for daylight hours when the sensor goes to ON and when I'm away.

 

Boathouse Late Entry - [iD 0032][Parent 0001][Not Enabled]

 

If

   - No Conditions - (To add one, press 'Schedule' or 'Condition')

 

Then

        Set 'Master Lamp' 80%

        Wait  6 seconds

        Set 'Living Room Lamp' 80%

        Wait  3 seconds

        Set 'Back Soffits' 80%

        Set 'Back Coach - Family room' 80%

        Wait  7 seconds

        Set 'Muskoka Room' 85%

        Set 'Front Entrance Light' 80%

        Set 'Garage Soffits' 100%

 

Else

        Run Program 'Manual Lights OFF' (Then Path)

        Run Program 'ISY ReBoot Action' (Then Path)

        Wait  15 minutes 

        Set 'Master Lamp' 50%

        Wait  30 minutes 

        Set 'Master Lamp' Off

 

This program is called from Boathouse Sensor programs and should not be enabled.

 

 THEN is when someone enters boathouse

 ELSE is after they leave and the 15 minute timeout elapses

 

   

post-2761-0-37987500-1445187428_thumb.png

Link to comment

Many of us disable the Off portion of the MS and never receive the Off signal. This would  nullify the need for the 'control is Not Off' line and the else section.

 

Notifying of no motion anymore is done on a timer inside the MS and this same function can be done and better controlled inside ISY programming.

 

A few ways come to mind to only get one notification of motion. Your method looks good to accomplish this also.

 

1) Use a variable as a flag, set it upon motion, check it when further motion is sensed. If the flag is set then the notification is already sent. A timer program is needed that resets the flag after X time of your choosing.

 

2) Use a second program that disables the triggering program and then re-enables the triggering program after your selected time.

 

eg:

First program

If

    control MS is switched On.

  AND

    time is from sunset to sunrise

Then

   run (if) second program

Else

   ---

 

Second program

If

  additional conditions

Then

   disable first program

   notify you of motion

   wait x minutes

   enable first program

Else

   ---

 

Now some of the dangers of this is you are asleep and/or away and you get a notification. What do you do? You have no second opinion of a violation in the boathouse. The webcam could be that second opinion before manual action is taken. I have multiple MS units in different rooms so further movement can determine false or not.

 

You will probably need an RF to Powerline bridge device to send you signal from the MS and that can be done with a LampLinc device. If you comply with that you can use it to turn on lights in the boathouse and act as a scare tactic to help get the intruder out. Flashing would be even better to create some confusion. Noise also helps.

Link to comment

Thanks for the replies...

 

 

 

2. if the person moves around for more than 15 minutes additional motion On will occur after timeout motion Off  

 

Lee... that was what I was hoping for. I would like to know if they still are in there after 15 minutes

 

 

 

Now some of the dangers of this is you are asleep and/or away and you get a notification. What do you do? You have no second opinion of a violation in the boathouse

 

Larry... this is why I am looking at putting in an IP camera. Of course, being 2 1/2 hours away means that I might have some good footage of the intruder but not much more. Hopefully the local authorities would recognize the person(s) given that its a smallish community.

 

 

 

You will probably need an RF to Powerline bridge device to send you signal from the MS and that can be done with a LampLinc device. If you comply with that you can use it to turn on lights in the boathouse and act as a scare tactic to help get the intruder out. Flashing would be even better to create some confusion. Noise also helps.

 

I already have a dual band switch in the boathouse so I can get a proper signal from the MS. I also plan to install another switch for the inside lights so your idea to flash those lights is a good idea. I also like the idea of noise. I was thinking of looking into using an I/O Linc low voltage device connected to some form of noise... StusViews Insteon Buzzlinc?

Link to comment

In a previous house I had a 30 Watt siren mounted in a cold air duct. When that thing went off you couldn't stay in the house. Nobody could run for the panel fast enough to shut it off. :)

 

A horn would take some doing though. A big 12v adapter and an I/O Linc should do it. I have 60w 12v adapter for my LED strips that are fairly cheap. In a boathouse that would make your ears bleed. :)

Link to comment
  • 2 weeks later...

I ended up going with hooking up two Buzzlincs to the I/O Linc and it appears to work quite well and should hopefully work as a deterrent. In the event that the audible alarm does go off (if my mobilinc variable doesn't get set properly) I programmed to turn off the I/O Linc relay if someone turns on and then off the outside boat light switch. Only someone knowing that this works would think to try this.

 

Now another programming question... I have disabled the OFF for the MS and I am trying to run timers programatically. Here are 2 programs related to day time activity

 

Boathouse Sensor Day2 - [iD 0042][Parent 003D]

 
If
        Control 'Motion Sensor-Sensor' is switched On
 
Then
        $sBoathouse_Entry_Day  = 1
 
Else
   - No Actions - (To add one, press 'Action')
 
Boathouse Entry Day Timer2 - [iD 0041][Parent 003D]
 
If
        $sBoathouse_Entry_Day is 1
 
Then
        Set 'IO Relay' On
        Disable Program 'Boathouse Sensor Day2'
        Wait  15 minutes 
        $sBoathouse_Entry_Day  = 0  
        Enable Program 'Boathouse Entry Day Timer2'
        Wait  10 minutes
        Set 'IO Relay' Off
        
Else
   - No Actions - (To add one, press 'Action')
 
Am I correct in assuming that I have to change the state variable to something other than 1 before enabling program 1? Or does changing the state variable mean that as soon as I do so the current program (program 2) ceases and therefore program 1 isn't enabled?
 

 

Link to comment

You need two programs to disable one. That's because once you disable a program it cease to run, it does continue to the end.

 

Boathouse Entry Day Timer2 - [iD 0041][Parent 003D]
 
If
        $sBoathouse_Entry_Day is 1
 
Then
        Set 'IO Relay' On
        Disable Program 'Boathouse Sensor Day2' <---the program stops at this point
        Wait  15 minutes 
        $sBoathouse_Entry_Day  = 0  
        Enable Program 'Boathouse Entry Day Timer2'
        Wait  10 minutes
        Set 'IO Relay' Off
        
Else
   - No Actions - (To add one, press 'Action')
----------------------------------------------------------------------------------------------------------------------------
Boathouse Entry Day Timer2 - [iD 0041][Parent 003D]
 
If
        $sBoathouse_Entry_Day is 1
 
Then
        Set 'IO Relay' On
        Run Program 'Boathouse Entry Day Timer3' (Then Path)
        
Else
   - No Actions - (To add one, press 'Action')
 
 

Boathouse Entry Day Timer3

 

If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
Then
        Disable Program 'Boathouse Sensor Day2'
        Wait  15 minutes 
        $sBoathouse_Entry_Day  = 0  
        Enable Program 'Boathouse Entry Day Timer2'
        Wait  10 minutes
        Set 'IO Relay' Off
        
Else
   - No Actions - (To add one, press 'Action')
Link to comment

 

I ended up going with hooking up two Buzzlincs to the I/O Linc and it appears to work quite well and should hopefully work as a deterrent. In the event that the audible alarm does go off (if my mobilinc variable doesn't get set properly) I programmed to turn off the I/O Linc relay if someone turns on and then off the outside boat light switch. Only someone knowing that this works would think to try this.

 

Now another programming question... I have disabled the OFF for the MS and I am trying to run timers programatically. Here are 2 programs related to day time activity

 

Boathouse Sensor Day2 - [iD 0042][Parent 003D]

 
If
        Control 'Motion Sensor-Sensor' is switched On
 
Then
        $sBoathouse_Entry_Day  = 1
 
Else
   - No Actions - (To add one, press 'Action')
 
Boathouse Entry Day Timer2 - [iD 0041][Parent 003D]
 
If
        $sBoathouse_Entry_Day is 1
 
Then
        Set 'IO Relay' On
        Disable Program 'Boathouse Sensor Day2'         <--- nothing re-enables this
        Wait  15 minutes 
        $sBoathouse_Entry_Day  = 0  
        Enable Program 'Boathouse Entry Day Timer2'  <---nothing disables this in the first place
        Wait  10 minutes
        Set 'IO Relay' Off
        
Else
   - No Actions - (To add one, press 'Action')
 
Am I correct in assuming that I have to change the state variable to something other than 1 before enabling program 1? Or does changing the state variable mean that as soon as I do so the current program (program 2) ceases and therefore program 1 isn't enabled?
 

 

I believe you may have some lines of code incorrect or copied incorrectly.

 

If both lines are actually to enable/disable the 'Boathouse Sensor Day2' program, it appears you have gone to a lot of trouble to insure that the timer will not be retriggered.

 

Even without the disable/enable the program will have to time out and shut off the beeper before it can be triggered again by the MS.

The use of a variable to pass the trigger also insures that no retriggering can take place.

 

 

With the Off disabled in the MS this could all be fit into one program but you lose your non-retriggering, if this was desired.

Boathouse Sensor Day2 - [ID 0042][Parent 003D]

If
        Control 'Motion Sensor-Sensor' is switched On
Then
        $sBoathouse_Entry_Day  = 1
        Set 'IO Relay' On
        Wait  15 minutes 
        $sBoathouse_Entry_Day  = 0  
        Wait  10 minutes
        Set 'IO Relay' Off

Else

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

With the usage of a variable to pass the trigger the enable/disable isn't necessary as the variable can only be set to 1 by the MS. Only the second program sets the variable back off. Therefore the time and program 2 cannot be retriggered until the second program says so by setting the variable back to 0.

 

Yes, if the variable wasn't being used a trigger passing element you would have to bring the enable/disable into play to stop repetitive retriggering of timers.

 

Since you disabled the MS Off function it cannot stop the program from running either so the enable/disable isn't necessary to  insulate against that logic trigger either.

Boathouse Sensor Day2 - [ID 0042][Parent 003D]
If
        Control 'Motion Sensor-Sensor' is switched On
Then
        $sBoathouse_Entry_Day  = 1
Else
   - No Actions - (To add one, press 'Action')


Boathouse Entry Day Timer2 - [ID 0041][Parent 003D]
If
        $sBoathouse_Entry_Day is 1
Then
        Set 'IO Relay' On
        Wait  15 minutes 
        $sBoathouse_Entry_Day  = 0  
        Wait  10 minutes
        Set 'IO Relay' Off    
Else
   - No Actions - (To add one, press 'Action')
Link to comment

 

 

I believe you may have some lines of code incorrect or copied incorrectly.

 

You are correct! In my attempt to simplify the code I edited the lines and made an error... In fact, I was supposed to be enabling the same program that I disabled!! 

 

After reading both of your replies and testing a few things here is what I have come up with. Note that my objective is to have motion in the boathouse set off the audible alarm and send me a notification. The disabling / enabling is to avoid a series of notifications if there is continued motion. Then, after 15 minutes, if there still is motion to send me another notification and leave the alarm sounding. If there isn't any motion then to turn off the audible alarm and notify me. These programs seem to work in my basic testing...

 

Note that I'm using 2 variables:

 

iVar2 an integer variable with an init value of '0'; and

sVar1 a state variable with an init value of '0'

 

 

Prg 1 - [iD 00E4][Parent 0006]

If
        Control 'Motion Sensor-Sensor' is switched On
Then
        $sVar1  = 1
        $iVar2  = 1
        Send Notification to 'Me' content 'Someone has entered the Boathouse'
Else
   - No Actions - (To add one, press 'Action')
 
Prg 2 - [iD 00E2][Parent 0006]
If
        $sVar1 is 1
Then
        Set 'IO Relay' On
        Disable Program 'Prg 1'
        Wait  15 minutes 
        $iVar2 += 1
        Enable Program 'Prg 1'
        Run Program 'Prg 2a' (Then Path)
        $sVar1  = 2
Else
   - No Actions - (To add one, press 'Action')
 
Prg 2a - [iD 00E1][Parent 0006][Not Enabled]
If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
Then
        Wait  5 minute 
        Run Program 'Prg 3' (If)
Else
   - No Actions - (To add one, press 'Action')
 
Prg 3 - [iD 00E5][Parent 0006]
If
        $iVar2 > 1
Then
        Send Notification to 'Me' content 'Whoever was in the Boathouse is now Gone'
        Wait  1 minute
        Set 'IO Relay' Off
        $iVar2  = 0
        $sVar1  = 0
Else
   - No Actions - (To add one, press 'Action')
 
Link to comment

Archived

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


×
×
  • Create New...