Jump to content

Help with Geofence program


Naptown

Recommended Posts

Posted

OK, looking to do a program that will notify me if I have left the home and left a door opened.  Here is what I have started with:

 

Left House Unsecured Matt - [iD 001B][Parent 001C]

If
        $Matthew_Allen's_iPhone_Home is 0
    And $Molly's_iPhone_home is not 1
    And (
             Status  'Kitchen Slider-Opened' is On
          Or Status  'Basement Slider-Opened' is On
          Or Status  'Front Door-Opened' is On
          Or Status  'Garage Door Sensor Single' is Off
          Or Status  'Garage Door Sensor Double' is Off
        )
 
Then
        Send Notification to 'Matt Text' content 'You left the house UNSECURED'
 
Else
   - No Actions - (To add one, press 'Action')
 
 

 

I tried it and it works to notify me if I have left.  But, I also got a text message when I arrived back home and opened the garage door.  I believe this is because my phone had not "entered Home region" yet.  Any suggestions on change(s)?  Any help is appreciated.  Thanks!

Posted (edited)

What are you using for geofencing?

 


Then

        Wait 5 Minutes
        Send Notification to 'Matt Text' content 'You left the house UNSECURED'
 

Add a "Wait" before the "Send Notification", long enough for your phone's status to update.   At the end of the wait time, the program will re-evaluate the conditions, and if one of them has changed, will end before executing the notification statement.

Edited by KeviNH
Posted (edited)

What are you using for geofencing?

 

Add a "Wait" before the "Send Notification", long enough for your phone's status to update.   At the end of the wait time, the program will re-evaluate the conditions, and if one of them has changed, will end before executing the notification statement.

 

Using state variables of my iphone and my wife's iphone.  1 represents being home.

 

OK, I'll give that a try.

 

OK, that didn't work for me.  I just got my text notification 1 minute later (I put a 1 minute wait).  Any other suggestions?

Edited by Naptown
Posted

Hmmm.... Are the "iPhone_Home" variables both state variables?   What actually does the updating, changes the value of the variables?

 

Okay, here's another approach for the same goal

 

Left House Unsecured Matt - [iD 001B][Parent 001C]

If
        $Matthew_Allen's_iPhone_Home is 0
    And $Molly's_iPhone_home is not 1
    And $SV_House_Unsecured is 1
Then
        Send Notification to 'Matt Text' content 'You left the house UNSECURED'

 

House Is Unsecured [iD 00FF][Parent 001C]

If
             Status  'Kitchen Slider-Opened' is On
          Or Status  'Basement Slider-Opened' is On
          Or Status  'Front Door-Opened' is On
          Or Status  'Garage Door Sensor Single' is Off
          Or Status  'Garage Door Sensor Double' is Off
       
Then
       Wait 2 minutes

       $SV_House_Unsecured = 1
 
Else
       $SV_House_Unsecured = 0

 

I would customize the notification to include the value of all variables involved, or even the state of all of the doors being tested against, so you know which door is the culprit.

Posted

KeviNH - thank you for that.  I've created a state variable and I'm working that method now.

 

Question regarding, "customize the notification to include the value of all variables involved, or even the state of all of the doors being tested against, so you know which door is the culprit."

 

I'm not seeing the state of variables in the custom notification setup.  Can you elaborate on how I would do this?

Posted

Question regarding, "customize the notification to include the value of all variables involved, or even the state of all of the doors being tested against, so you know which door is the culprit."

 

I'm not seeing the state of variables in the custom notification setup.  Can you elaborate on how I would do this?

 

For variable and node $ expansions, see http://wiki.universal-devices.com/index.php?title=ISY-994i_Series:EMail_and_Networking_Substitution_Variables

 

You can use the dropdown to choose variables to insert:

 

11v4o6a.jpg

 

You could also put the nodes in the notification, e.g Kitchen=${sys.node.11 22 AA 1.ST}, Basement=${sys.node.33.44.BB.1.ST}

Posted

Naptown,

 

I fear this is becoming more complicated than necessary.  I don't believe that there is any need for waits or variables.  Let's think this through a bit more.

 

First thing, the only trigger we want is when based upon the geofenced area, right?  Once we leave, then test the other conditions which define whether the house is secure, right?  We have no need to trigger the program because doors or windows change state, correct?

 

Next, is it correct to assume that matthewphone = 0 is away and that mollyphone = 1 is home?  And that you only want notifications when both are away?  Is it correct to assume that there are only two values possible for either variable, 0 and 1, meaning away and home?  (Curious as to why you chose "= 0" for one condition and "not = 1" for the other condition?) 

 

Why not:

 

If
        $Matthew_Allen's_iPhone_Home is 0
    And $Molly's_iPhone_home is not 1

 

Then run next program

Else nothing

 

Next program (disabled)

if

Status  'Kitchen Slider-Opened' is On
          Or Status  'Basement Slider-Opened' is On
          Or Status  'Front Door-Opened' is On
          Or Status  'Garage Door Sensor Single' is Off
          Or Status  'Garage Door Sensor Double' is Off

then

send notification

else

nothing

Posted

Naptown,

 

I fear this is becoming more complicated than necessary.  I don't believe that there is any need for waits or variables.  Let's think this through a bit more.

 

First thing, the only trigger we want is when based upon the geofenced area, right?  Once we leave, then test the other conditions which define whether the house is secure, right?  We have no need to trigger the program because doors or windows change state, correct?

 

Next, is it correct to assume that matthewphone = 0 is away and that mollyphone = 1 is home?  And that you only want notifications when both are away?  Is it correct to assume that there are only two values possible for either variable, 0 and 1, meaning away and home?  (Curious as to why you chose "= 0" for one condition and "not = 1" for the other condition?) 

 

OK, looking forward to some more experimenting.  Oberkc, thank you.

 

1.  Yes, geofence is what I'm basing this off of.  I do not need to trigger the program at change of state - you are correct.

 

2.  Yes, I use a state variable for home and away.  Home = 1 away = 0 for both phones.

 

My thinking is, ISY could text my wife if her phone is the one changing from 1 to 0.  If my phone is 0, then I'm not at the house.  If hers changes from 1 to 0, then she is the one who most recently left the house (unsecured).  I was actually going to copy the program and switch it around to contact me in the event I left the house with a door open.

Posted

Have you proven your geofence for both devices?

 

If
        $Matthew_Allen's_iPhone_Home is 0

 

Then

      

       send notification

 

 

I'd start from there.

 

 

Jon...

Posted

Have you proven your geofence for both devices?

 

If

        $Matthew_Allen's_iPhone_Home is 0

 

Then

      

       send notification

 

 

I'd start from there.

 

 

Jon...

 

Yes, geofencing is working for both devices.

Posted

OK, looking to do a program that will notify me if I have left the home and left a door opened.  Here is what I have started with:

 

Left House Unsecured Matt - [iD 001B][Parent 001C]

 

If

        $Matthew_Allen's_iPhone_Home is 0

    And $Molly's_iPhone_home is not 1

    And (

             Status  'Kitchen Slider-Opened' is On

          Or Status  'Basement Slider-Opened' is On

          Or Status  'Front Door-Opened' is On

          Or Status  'Garage Door Sensor Single' is Off

          Or Status  'Garage Door Sensor Double' is Off

        )

 

Then

        Send Notification to 'Matt Text' content 'You left the house UNSECURED'

 

Else

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

 

 

 

I tried it and it works to notify me if I have left.  But, I also got a text message when I arrived back home and opened the garage door.  I believe this is because my phone had not "entered Home region" yet.  Any suggestions on change(s)?  Any help is appreciated.  Thanks!

 

This program should notify you only when you leave the geofence ($Matthew_Allen's_iPhone_Home is 0.)

If you run geofence test programs concurrently it will tell if geofence drops out for some reason.

 

 

Jon...

Guest
This topic is now closed to further replies.

×
×
  • Create New...