Jump to content

IFTTT WebHook Question


Recommended Posts

Posted

Hello All

Hoping someone might have some insight as I'm just not understanding.

I'm testing IFTTT's locations applet as locative just isn't cutting.

What I'm attempting to do is have IFTTT change the state variable base on me being in our out of my geofence.

I'm creating 2 webhooks in the ISY portal for the same state variable each with a different value based on geofence state.

I.e:

PB is home so sPBHome=1 

PB is away so sPBHome=2

If I click on the URL created in the each webhook, its the same no mater what the variable value is set to.

This confuses me. When this "Webhook" is triggered based on geofence, how is ISY able to distinguish weather its the 1 value or the other if its the same URL being sent. I'm not seeing how the specific value could be differentiated.

Am I missing something?

I'm now thinking I may need two separate state variables and create a webhook for each.

I.e

PB is home so sPBHome=1 

PB is away so sPBAway=2

Thanks for any info.

PB

 

Posted (edited)
4 hours ago, PB11 said:

Hello All

Hoping someone might have some insight as I'm just not understanding.

I'm testing IFTTT's locations applet as locative just isn't cutting.

What I'm attempting to do is have IFTTT change the state variable base on me being in our out of my geofence.

I'm creating 2 webhooks in the ISY portal for the same state variable each with a different value based on geofence state.

I.e:

PB is home so sPBHome=1 

PB is away so sPBHome=2

If I click on the URL created in the each webhook, its the same no mater what the variable value is set to.

This confuses me. When this "Webhook" is triggered based on geofence, how is ISY able to distinguish weather its the 1 value or the other if its the same URL being sent. I'm not seeing how the specific value could be differentiated.

Am I missing something?

I'm now thinking I may need two separate state variables and create a webhook for each.

I.e

PB is home so sPBHome=1 

PB is away so sPBAway=2

Thanks for any info.

PB

 

Show use the specific webhooks you created, redacting authentication strings.   I haven't done it this way for a long time.   Also are you using the portal IFTTT integration or are you using direct API calls?

What did you find wrong with locative?  it seems to work like a champ for me.   Were you using it with the portal node server?

I did the reverse of the path you're following, I was using IFTTT and webhooks and it never worked correctly and then discovered locative and the portal node server... works much better, and is more secure.

Edited by MrBill
Posted (edited)

@MrBill

Hi MrBill.

I'm using the portal IFTTT. Not familiar with direct API calls.

Regarding Locative, I started out with a portal node server "Occupancy", then someone suggested I should use Admin Console Occupancy V2.0 (Geofence).

I never fully understood the difference, but hacked away at all of them until I had some level of functionality. ?

I've had great results with Locative when it works. The response from locative on my phone seems spot on, but isy responding is spotty at best.

After some success its just been so unreliable that I just assume not have it. Sometimes its responding after we've been home for 5 min. I did go through the exercise as detailed by another member of creating separate neighborhood and home geofences which prevented my house from opening up randomly at 4 am.

I would be happy to stick with locative if I could get it working as I have several programs configured to work with it.

By webhooks are you referring to the generated URL?

https://my.isy.io/api/ifttt/PBD/key/

Or this

webhook.thumb.jpg.1e9e0af99db7f6d75ed5017ec4ae7d2d.jpg

 

Testing IFTTT location for response only, seems quick and accurate. I live in the country on a dead-end spit of land which juts into the lake. I'm guessing I connect to a single cell tower. I'm assuming this isn't ideal, but historically I had great geofencing using Yonomi and the Insteon hub, but I haven't found compatibility with ISY and Yonomi.

Any thoughts appreciated

PB

Edited by PB11
Posted

With locative you should be using Occupancy.  The other one Occupancy V2.0 is when you are using UDmobile.    We've had very good luck with it.  I had the ISY firing lots of Pushover notices in early days, but I've silenced all except the two that say "Away Mode is On" or "Away mode is off".  Away mode sets further away from the house than I'd prefer but I think its because my wife's phone is in her purse and it takes longer for GPS.   Returning home Away mode turns off right as we reach the drive.  Response might vary with phone hardware, we do use iPhones.

With the IFTTT portal integration you need to make two entries per phone, and each phone needs to have one state variable.   the first entry is "arrive home", the variable associated with the person, and set the Value that you want to use "at home", the second entry is "leave home", the variable associated with the person, and set the Value that you want to use "away from home".    Repeat those two entries with another variable for another person. and so on......

For ISY Programs use AND to determine everyone is AWAY  and use OR to determine if someone has arrived home.

If

            sPB11 = 2

   AND  sPB12 = 2 

   AND  sPB13= 2

      (etc)

then

   Whatever we do when everyone has left

else

  (none)

-------------

If

            sPB11 = 1

   OR  sPB12 = 1

   OR  sPB13= 1

      (etc)

then

   Whatever we do when at least one person has returned home.

else

  (none)

 

 

 

 

Posted (edited)

Ok @MrBill

I'm back looking at my locative setup :)

I struggle to digest the information when someone posts their programs on this forum, but I'm wondering if I can post how I have locative setup for you to review? I understand if this is a bit much and you would rather not, so pls don't hesitate to pass and I will not be offended.

 I've stripped all buy my iphone from the equation and I'll only post the arrival scenario. If I can get this working I'm certain I can transfer the proper format forward.

 

I've created 2 geofences in Locative. 1)PBLakeHouse: for entry into my property, and 2) PBNeighborhood: for entry into a larger geofence surrounding neighborhood.

I've also created 2 state variables. One is "sPBHome" and one is "sNeighborhood".

I've created each variable a "Variable" program which changes their values based on my geolocation.

Geofence program:

PBHome - [ID 0056][Parent 002B][Run At Startup]

If
        '#Geofence / Lake House / PBLakeHouse' Occupied is True
 
Then
        $sPBHome  = 1
        Wait  6 minutes 
        $sPBHome  = 3
 
Else
        $sPBHome  = 3

 

Neighborhood  - [ID 0057][Parent 002B][Run At Startup]

If
        '#Geofence / Neighborhood / PBNeighborhood' Occupied is True
 
Then
        $sNeighborhood  = 1
        Wait  10 minutes 
        $sNeighborhood  = 3
 
Else
        $sNeighborhood  = 3


I've had both variables change to an obscure value after a period of time to prevent gps jump causing my doors to randomly open.

Here is my arriving home at night program

 

Arriving Home at Night PB - [ID 002A][Parent 002B][Run At Startup]

If
        $sPBHome is 1
    And $sNeighborhood is 1
    And (
             From    Sunset 
             To      Sunrise (next day)
        )
 
Then
        Send Notification to 'Lake House' content 'PB Night Geofence Ran'
        Set 'Garage / Garage 2 / Garage 2' Open
        Set '#House / Arriving Home' On
        Wait  2 minutes 
        Set 'Garage / Garage 2 / Garage 2' Close
        Set 'Security / Security' Off
        Wait  10 minutes 
        Set 'Back door / Backdoor' Off
        Set 'Hallway / Hallway' Off
        $sPBHome  = 3
 
Else
        Run Program 'Arriving Home Daylight PB' (If)

 

 

Daytime Arrival Program

Arriving Home Daylight PB - [ID 0030][Parent 002B][Run At Startup]

If
        $sPBHome is 1
    And $sNeighborhood is 1
    And From    Sunrise +  1 second
        To      Sunset  -  1 second (same day)
 
Then
        Send Notification to 'Lake House' content 'PB Day Geofence Ran'
        Set 'Garage / Garage 2 / Garage 2' Open
        Wait  3 minutes 
        Set 'Garage / Garage 2 / Garage 2' Close
        $sPBHome  = 3
 
Else
   - No Actions - (To add one, press 'Action')
 

Hope that makes sense. 

PB

 

Edited by PB11
Posted (edited)

Your programs could be written in simpler form.   Because ISY is event based there are some things happening that you may not realize.  For example, $sPBHome and $sNeighborhood are both state variables meaning that anytime the value changes they fire the programs.   What does that mean lets trace what happens as written.

 

You enter the neighborhood and $sNeighborhood becomes 1 --> that fact alone causes Arriving Home at Night PB AND Arriving Home Daylight PB to run

Then because Arriving Home at Night PB ran and the If was false the ELSE of that program ran, Which again caused Arriving Home Daylight PB to run.

now you get close to home and $sPBHome becomes 1 --> that fact causes Arriving Home at Night PB AND Arriving Home Daylight PB to run again.

depending on the time of day we might run Arriving Home Daylight PB yet again.

Also the way the programs are written each attempts to run at Sunrise AND Sunset which will RUN the nighttime ELSE clause, causing the Daytime programs to run.  which will then RUN again at Sunrise+1 second and Sunset+1 second.

I guess I see the point of the dual geofences if for some reason the inner one trips in an out, but I would look for the root cause of that problem, because it's certainly not one I've seen myself or heard others complaining about.  I wonder why your instance of locative acts up?

Also while it's very James Bond like to have your door open automatically upon arrival I would never have my geoFence actually do that step.  For security I'd prefer to press the button myself to open and close the door.  I do in fact use geofencing to turn on/off AWAY mode but I also get notification of it were to misfire for some reason (it's never happened).    Another reason I would never choose to have the door automatically open is what if someone had cased the place and was standing waiting for that to happen.  I'd rather the door never open until I'm in front of it and ready to watch what happens. 

I'll think about your programs for a bit and post my suggestions.  I won't include the line opens the door, If you want to put that back in that's on you.

 

 

Edited by MrBill
  • Like 1
  • Thanks 1
Posted
1 hour ago, MrBill said:

Also while it's very James Bond like to have your door open automatically upon arrival I would never have my geoFence actually do that step.  For security I'd prefer to press the button myself to open and close the door.  I do in fact use geofencing to turn on/off AWAY mode but I also get notification of it were to misfire for some reason (it's never happened).    Another reason I would never choose to have the door automatically open is what if someone had cased the place and was standing waiting for that to happen.  I'd rather the door never open until I'm in front of it and ready to watch what happens. 

Just to follow up what @MrBill says about auto opening the door...there have been times (few and very far between) that my phone would drop wifi while at home and hit a tower that's just outside my geofence and would trigger programs when it realigns the GPS to being inside the geofence. So the last thing you would want would have that happen while at home, in the middle of the night. Some things just shouldn't be automated...entry/access points are at the top of that list for me. 

Good luck with your programs. Look intense! 

 

  • Like 1
  • Thanks 1
Posted (edited)

@MrBillThe James Bond comment made me chuckle. That was exactly what I was going for. Can't have the cool cars, might as well have the cool garage door opener. 

Ok, that can easily be sacrificed. Once Security is mentioned I start to get twitchy.

My logic in my programs was this.

In the Arriving Home at night program, I thought all 3 If's had to be met before the "then" was triggered.

This explains a lot, and makes me realize I have a lot of changes to make throughout my programming.

 

The double Geo fence was for reasons exactly mentioned by @Geddy.

I was finding my programs would be triggered at 5am and I assumed it was my phone bouncing in and out of Geofence, though I'm now wondering if its the "From Sunset to Sunrise"  in my If statements.

Again here what I assumed was "sunset to sunrise" was a span of time, not 2 separate instances. Apparently my thought process isn't as logical as I thought.

Thanks for the pointers.

 

 

Edited by PB11
  • Like 2
Posted

First since the neighborhood geofence is a filter to prevent things from happening as opposed to a trigger (something that makes things happen) it needs to be an Integer variable rather than a State variable.    State Variable cause programs to run.  Integer variables don't trigger them to run, but can be used as a filter.   So move $sNeighborhood to $iNeighborhood.     Also $sPBHome isn't needed at all.  

Neighborhood  - [ID 0057][Parent 002B]

If
        '#Geofence / Neighborhood / PBNeighborhood' Occupied is True
 
Then
        $iNeighborhood  = 1
        Wait  10 minutes 
        $iNeighborhood  = 3
 
Else
        (nothing)

In the above program I changed the variable from state to integer, deleted the Else clause, and removed the [Run at Startup] attribute which won't have any effect on how the program works.

-------------

PBHome - [ID 0056][Parent 002B]

If
        '#Geofence / Lake House / PBLakeHouse' Occupied is True

AND $iNeighborhood  = 1
 
Then
        Run Program 'Arriving Home' (If)
 
Else
       (Nothing)

-----------------

Arriving Home  - [ID 002A][Parent 002B][Run At Startup] [Disabled]

If
       
             From    Sunset 
             To      Sunrise (next day)
      
 
Then
        Send Notification to 'Lake House' content 'PB Night Geofence Ran'
        Set '#House / Arriving Home' On
        Wait  2 minutes
        Set 'Security / Security' Off
        Wait  10 minutes 
        Set 'Back door / Backdoor' Off
        Set 'Hallway / Hallway' Off
      

Else

         Send Notification to 'Lake House' content 'PB Day Geofence Ran'
        Set 'Garage / Garage 2 / Garage 2' Open
        Wait  3 minutes 
        Set 'Garage / Garage 2 / Garage 2' Close

 

10 minutes ago, PB11 said:

The double Geo fence was for reasons exactly mentioned by @Geddy.

I was finding my programs would be triggered at 5am and I assumed it was my phone bouncing in and out of Geofence, though I'm now wondering if its the "From Sunset to Sunrise"  in my If statements.

Again, I assumed is was a span of time, not 2 separate instances. Apparently my thought process isn't as logical as I thought.

Thanks for the pointers.

Geofences don't work because of Cell Towers or Wifi.  It's all based on the GPS coordinates of your phone.  A change of cell tower or wifi on/off may cause Locative: to check the GPS values.  I've noticed my wife's phone take much longer to realize we have left (if we leave in the same car) than mine.  I assume that's because hers in buried deeper in obstacles (purse and purse junk) that make it harder to get the low power signals from GPS satellites.  

16 minutes ago, PB11 said:

The James Bond comment made me chuckle. That was exactly what I was going for. Can't have the cool cars, might as well have the cool garage door opener.

Now if you want that feature, it's doable, i just wouldn't rely on GPS/Geofence.  Instead maybe a driveway sensor that detects you driving in, that triggers a transmitter in the house to "ask" the car if it's the correct car to open the door for.... when the car has answered with a secure message "yep this is PBsCar" then open the door.... I still would keep the manual button in the car tho because Automation Can always fail.

Posted
4 minutes ago, MrBill said:

Arriving Home  - [ID 002A][Parent 002B][Run At Startup] [Disabled]

If
       
             From    Sunset 
             To      Sunrise (next day)

First off, thank you.

Ok, just to digest this.

The from sunset to sunrise in this statement isn't being evaluated because its disabled? But does it still not act as two separate points of activation? One at Sunset and one at Sunrise or did I misinterpret.

8 minutes ago, MrBill said:

Geofences don't work because of Cell Towers or Wifi.  It's all based on the GPS coordinates of your phone. 

This I  did understand, but thought the confirmation of gps status was transmitted via cellular or wifi data lines.

23 hours ago, PB11 said:

If
        $sPBHome is 1
    And $sNeighborhood is 1
    And From    Sunrise +  1 second
        To      Sunset  -  1 second (same day)

 

Just for a better understanding. Is this assessed by ISY as 3 individual if's and each trigger the "then" or do all 3 need to be met to trigger the "then"?

By the verbiage I assumed "and" meant that all 3 needed to be true before being authorized to move on to the "then" statement.

I've pulled open the cooked book once again, and gave it a pinned tab on my google browser. 

I'll implement what you've given me above and will see how and why it works the way it does. Very much appreciate the time you've taken @MrBill

Posted
15 minutes ago, PB11 said:

First off, thank you.

Ok, just to digest this.

The from sunset to sunrise in this statement isn't being evaluated because its disabled? But does it still not act as two separate points of activation? One at Sunset and one at Sunrise or did I misinterpret.

The program being disabled prevents it from running by itself at Sunset and Sunrise.  However when ANOTHER PROGRAM tells it to run, it still runs.  In this case THEN will run from Sunset to Sunrise.... during the other period, ELSE runs... but it is only triggered to run when the other program tells it to run.

 

15 minutes ago, PB11 said:

Just for a better understanding. Is this assessed by ISY as 3 individual if's and each trigger the "then" or do all 3 need to be met to trigger the "then"?

By the verbiage I assumed "and" meant that all 3 needed to be true before being authorized to move on to the "then" statement.

I've pulled open the cooked book once again, and gave it a pinned tab on my google browser. 

I'll implement what you've given me above and will see how and why it works the way it does. Very much appreciate the time you've taken @MrBill

The IF statement:

      $sPBHome is 1
    And $sNeighborhood is 1
    And From    Sunrise +  1 second
        To      Sunset  -  1 second (same day)

will be evaluated anytime the value of $sPBHome changes AND at anytime the value of $sNeighborhood changes AND at SUNRISE AND at Sunset.... at any of those events/times 

Let say we arrive in the neighborhood after sunset.

$sPBHome is 1
    And $sNeighborhood is 1
    And From    Sunrise +  1 second
        To      Sunset  -  1 second (same day)

will be seen as

        False

and True

and False

 

when we consolidate False AND True AND False to a single value.... we get False.... because we get false ELSE runs

so now when PBHome goes to one we get:  True AND True AND False which reduces to False so Else runs again

Now lets change the time we are driving in to NOON....

first neighboorhood becomes 1.......  False and True and True....  Else runs

then PBHome becomes 1..... True and True and True... Then Runs....

I never even pointed out in my initial post what happans when the timers time out.....

When neighborhood goes to 3 (assume phome is still 1)

True and False and True... Else runs again.....

 

The important distinction between State and Integer variables is that CHANGING THE VALUE of a State Variable causes the program to RUN.... If a state Variable changes the IF statement will be re-evaluated AND either THEN or ELSE is going to be executed.   Integer Variables on the other hand don't have that magic property of causing the IF of a program to be evaluated so we can think of them as a filter, rather than a trigger.

so grabbing the new IF from above:

If
        '#Geofence / Lake House / PBLakeHouse' Occupied is True

AND $iNeighborhood  = 1

Nothing happens when $iNeighborhood  becomes 1..... this program does not run. 

when Locative tells the portal nodeserver to become true the program runs... now we use the value.

 

True AND True reduces to True..... so THEN runs. 

  • Like 1
Posted

@MrBill

I like it. On the 15th read there was some clarity. 

Few more times over and I think I'll have it. Its logical, just very incremental.

I'll spend some time on it and let you know how I make out.

Just bought you a virtual cold beer.?

 

  • Like 2
Posted

It's hard for everyone to grasp how ISY programs work.  It's important to remember that when IF is evaluated either Then or Else will always run.

17 hours ago, PB11 said:

I was finding my programs would be triggered at 5am and I assumed it was my phone bouncing in and out of Geofence, though I'm now wondering if its the "From Sunset to Sunrise"  in my If statements.

I suspect you maybe on to something there.

 

Good luck, let us know if more questions come up as you experiment.

  • Like 2
Posted
18 hours ago, MrBill said:

Geofences don't work because of Cell Towers or Wifi.  It's all based on the GPS coordinates of your phone.  A change of cell tower or wifi on/off may cause Locative: to check the GPS values.  I've noticed my wife's phone take much longer to realize we have left (if we leave in the same car) than mine.  I assume that's because hers in buried deeper in obstacles (purse and purse junk) that make it harder to get the low power signals from GPS satellites.  

 

 

@MrBill True geofences don't work because of cell tower/wifi, but as you said the phone has to adjust the GPS. In my experience it was an older iOS (I think 10 or 11) and I noticed that Google Maps would think my GPS would bounce if I turned wifi off and connected to a cell tower. At the time my cell provider was having tower issues near the house and I would use a tower further away (with just barely a signal) and so between GPS and data jumping around my location would move about a mile or two away from the house before location would settle to within a few feet of where I actually was. It was strange to see it happen, and would be annoying some evenings when my trigger would happen as though I left/returned the area after midnight. I think iOS 14 is a little quicker with GPS as I don't seem to have as much of a jump when leaving the house...if I watch Google Maps or other Apple Maps when leaving the wifi. 

It's fun to get geeky at times on GPS and I've tested locations with three different phones just to see how they react. iPhone X, 8, and 12 (mini) all running iOS 14.4.1 somehow must bounce to different towers at the entrance to my neighbor hood and the GPS for all three phones goes different directions for a moment before they settle to the same spot. 

The issue I see coming sooner or later is that Apple might end up being like Android and continue to move to block more location based apps/services in the background. It's already difficult to make sure they're "always running" in location settings. I hope they don't as many Android users have experienced issues with geofences for several years because of changes to background apps and location settings. 

 

Posted
4 minutes ago, Geddy said:

True geofences don't work because of cell tower/wifi, but as you said the phone has to adjust the GPS. In my experience it was an older iOS (I think 10 or 11) and I noticed that Google Maps would think my GPS would bounce if I turned wifi off and connected to a cell tower. At the time my cell provider was having tower issues near the house and I would use a tower further away (with just barely a signal) and so between GPS and data jumping around my location would move about a mile or two away from the house before location would settle to within a few feet of where I actually was. It was strange to see it happen, and would be annoying some evenings when my trigger would happen as though I left/returned the area after midnight. I think iOS 14 is a little quicker with GPS as I don't seem to have as much of a jump when leaving the house...if I watch Google Maps or other Apple Maps when leaving the wifi. 

It's fun to get geeky at times on GPS and I've tested locations with three different phones just to see how they react. iPhone X, 8, and 12 (mini) all running iOS 14.4.1 somehow must bounce to different towers at the entrance to my neighbor hood and the GPS for all three phones goes different directions for a moment before they settle to the same spot. 

The issue I see coming sooner or later is that Apple might end up being like Android and continue to move to block more location based apps/services in the background. It's already difficult to make sure they're "always running" in location settings. I hope they don't as many Android users have experienced issues with geofences for several years because of changes to background apps and location settings.

I confess, you have more details on how GPS works than I do.   I have noticed that iOS these days asks repeatedly for awhile (maybe 3 times over 3 days) if you really mean "always" then every few months it asks again.   Frankly I'm happy with apple on that... a few years ago apps were taking the "always" way too often and apple was allowing it to happen, where the avg consumer doesn't really realize what they are giving away. 

  • Like 1
Posted

Hello @MrBill

Wanted to let you know that Locative is working like a charm.

I'm now restructuring some of my other programs as you have layout.

Hoping to get my motion sensors working.

Thanks for your time and experience.

All the best.

 

  • Like 1
Posted
13 hours ago, PB11 said:

Wanted to let you know that Locative is working like a charm.

I'm now restructuring some of my other programs as you have layout.

Hoping to get my motion sensors working.

Good to know that it worked out for you.

Let us know if you have more questions.

Guest
This topic is now closed to further replies.

×
×
  • Create New...