This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.

Location / presence detection solution IFTTT with multiple users

A lot of homey users like me have problems with presence detection to trigger flows. Since build-in presence detection is not working (most of the time) i'm using a different solution. I tried to install Mosquitto on my Raspberry but the attempt failed because my distro was not up to date and i couldn't update. Better Presence and Smart Presence were not suitable for me, i wanted GPS detection. You can only connect one IFTTT account to Homey, so that's a problem for personalized actions (flows with different lightning, different music, temperature, alerts etc). However, there's a workaround...

What's the alternative? Use as many IFTTT accounts as you like. Trigger an applet based on GPS location and execute a get webrequest via maker webhooks. You can use the Webhook Manager app in the Homey appstore to get an webhook URL. This way you can execute a flow.  If you're new to this, it's not as difficult as it sounds. Follow the steps below:

1. Install Webhook Manager app from Homey app store
2. Create a flow with webhook (name) and action
3. Go to settings and click on Webhook Manager app. Copy and modify the url. My url is https://webhooks.athom.com/webhook/xxxxxxxxxxxxxxxxxx/?token=xxx&event=webhook-x-home (the bold letters should contain your own token and eventname)
4. Got to https://ifttt.com/create  (create an account if you don't have one) and create an applet.
4.1 Use a 'location' trigger, connect and set an area
4.2 Create an action 'maker webhooks' and connect*
4.3 Paste the modified url: https://webhooks.athom.com/webhook/xxxxxxxxxxxxxxxxxx/?token=xxx&event=webhook-x-home
4.4. Method should be 'GET' and Content type 'Application/Json' and Save

Note: on Mac/Linux you can test the maker webhook > flow in your terminal: curl -X POST https://maker.ifttt.com/trigger/webhook-x-home/with/key/xxxxxxxx

Now when you exit or enter the area the flow should be executed. You can make it as complicated as you want.

So if your wife of children have other IFTTT accounts, you still can use the same url to trigger a flow.
My flows are a little bit more complicated since i use the 'Better logic' app to set the status of everyone's presence. If nobody is at home anymore, the alarm will be armed. If anyone is coming home, then the alarm will be unarmed.

Good luck, i hope it is useful to anyone!





Comments

  • What is required on the phones if you want to let it work?
    - Should the IFTTT app be installed?
    - Should it run in the background?
    - Should Location detection be switched on?

    I have done some trials and it does work fine following above tutorial. I was wondering though if it would also work with a different status of above three points.
  • I have done this slightly different, with the IFTTT app in Homey. 

    Each of the IFTTT apps on the mobiles can connect to the same IFTTT channel. Let's say that one of the main account.
    Install the IFTTT app on each phone with its own user and connect to the Homey channel, using the id of the main account.

    When you trigger a geofence on the IFTTT script for that particular user on the mobile, have it connect to the Homey channel and provide the 3 variables that are supported via the Homey channel with values of your choice.

    I am using the first variable to indicate the user triggering the event and other variables to indicate leaving/entering and the 3rd to say where from. With this setup, I can trigger flows in Homey, for example to put  the outdoor lights on when any of my family members are getting close to home.

    This feels a little more straight forward than the setup with webhooks.

    Curious to hear others who may have even simpler solutions.
  • Interesting. I believe the answers on my questions are as follows:

    - Should the IFTTT app be installed? YES, each phone needs the to have the IFTTT app installed.
    - Should it run in the background? No, as long you are signed in in the IFTTT app.
    - Should Location detection be switched on? YES, and the IFTTT app should be set to Always use Location Services.

    Please correct me if I'm wrong.
  • correct

  • KvMKvM Member
    edited November 2017
    What is you're experience with the reliability / stability of the location triggers from IFTTT? Sounds like an interesting solution, especially the way Oskar explained
  • It's running it for some time now with varying success. Most of the time it works great but sometimes no trigger is given. It's not 100% but so aren't the other solutions. I'm trying out GPS-Trace which looks interesting but my phone app needs to be running in screen all the time which is not the way to go either.
  • KvMKvM Member
    edited November 2017
    I've installed it on 2 android phones now. I made two triggers, one using ifttt location, one using ifttt wifi detection. Both trigger the same flow in homey (using the variables like Oskar).  When I arrived home today the lights were on (got the debug message in the car when entering the street). Hopefully this will work and the two triggers will help each other :-)
  • Can you explain the wifi ifttt a bit further?
  • KvMKvM Member
    edited November 2017
    The explanation:
    -In homey I used two flows with as trigger IFTTT: "IFTTT someone comes home", "IFTTT someone leaves" (I used the first variable from IFTTT to set which person is coming home / leaving).
    -In IFTTT I used the Location, You enter an area, as a triggger for the homey flow "IFTTT someone comes home"
    -In IFTTT I used the Location, You exit an area, as a triggger for the homey flow "IFTTT someone leaves"
    -In IFTTT I used the "Android device connects to specific WIFI network" as a triggger for the homey flow "IFTTT someone comes home"
    -In IFTTT I used the "Android device disconnects from a specific WIFI network" as a trigger for the homey flow "IFTTT someone leaves".

    The flows in Homey with the IFTTT Trigger only sets the person away status (and a debug push message to my phone for now). All other flows with the trigger "A person left" / "A person came home" are run then automatically. So IFTTT is only replacing the homey app presence detection so to say.

    As homey changes the home/away tag using this way the triggers "nobody is home" etc are usable as well. Also it is possibile to use "a specific person came home" etc.

    It is possible in this way that a person is leaving twice shortly in a row, but as the homey status of that person is set to away the first time, no flows are triggered the second time. For coming home the same, it is possible a person comes home twice shortly in a row, but nothing happens the second time. 

    I already noted now that not always both IFTTT events are triggered, so it is a nice backup in this way.

    I hope you can follow my explanation, if not just ask

    PS I turned off the presence detection in the homey app for now, to prevent interference
  • bulldogdriverbulldogdriver Member
    edited November 2017
    @KMV
    Can you post printscreens of the flows, cause as a newby I cannot follow the description.
    Base-elements are there: IFTTT-app installed btoh on iphone and homey. Now get them to work together ....
    Thanks in Advance

    I think I managed (ifttt finds the flow.... now I must make the flow working).
  • @KMV Can you share show the ifttt applet 'Android device disconnects from a specific WIFI network' I have trouble finding it.
  • @MariusBrand

    The trigger is part of the "Android Device" set in IFTTT:

  • @bulldogdriver

    This is my flow (in dutch, I'm sorry). I blacked out our last names in the screenshot, no relevant info there.


    For away it is the same, only difference is it sets persons as away instead of home
  • @KMV:    Dank je wel (I'm dutch)!  Dit leert  zoveel makkelijker. Heb nog een lange weg te gaan.
  • Thanks, found it.
  • No Thanks!

    PS it is @KvM not KMV :-) 
  • Sorry about that :)
  • KvMKvM Member
    edited November 2017
    Update:

    for me this is still working quite well. Most of the time the WIFI triggers first (both when coming home and leaving) sometimes the GPS is quicker and the lights turn on when I'm still parking my car :-)

    I added a time-out (60sec) for the "nobody home flow" to prevent the lights to go off when a short glitch in the WIFI connection is experienced. Normally this is no issue when more than one user is at home, but last week one time the lights went of when I was home alone :p
  • POBPOB Member
    edited November 2017
    Edit: Forget it, for now at least. Think I found another solution.

    Want to test the maker webhook > flow in terminal. What is expected as a key in this URL "curl -X POST https://maker.ifttt.com/trigger/webhook-x-home/with/key/xxxxxxxx" ?? 
    My token or what? I constantly get a "You sent an invalid key" no matter what I try.

    /POB
  • crunixcrunix Member
    @KvM just wondering, how do you pass to Homey the user who triggered the flow? I have a single IFTTT account linked to Homey, each user with IFTTT app using the same single IFTTT account. Is there a specific "ingredient" to feed the phone who triggered the flow?
  • KvMKvM Member
    edited May 2018
    @crunix I use 2 IFTTT accounts for 2 persons. Both IFTTT accounts connected with the same Homey account. In IFTTT I give a variable with the name of the person. In my screenshot above you see the flow checks the var1 for the name "koen" (that's me). If its not "koen" than it is my wife that came home. 

    Var2 I use for the debug message, debug message tells me if it is triggered with GPS or WIFI.

    General update: I had some issues on the Samsung Note 8 closing the background IFTTT app every week or so, but since the last android update this is resolved. 100% stable / accurate on a Galaxy S7 as well. Debug messages are still on but I never miss a trigger both the GPS and Wifi trigger are working perfectly :-)
  • crunixcrunix Member
    @KvM thank you for the quick reply. I am probably doing something wrong because I am unable to link 2 IFTTT accounts one for each person. My setup on Homey is with 2 Users: 1 Owner and 1 User. The Owner can connect to IFTTT but when I log-in on Homey as the User, I can already see IFTTT connected under Settings. I feel like I am missing something obvious...


  • rickprickp Member
    On a different device I trigger a different flow. "rick home", "girlfriend home".. Don't get why to make it more difficult? 
  • KvMKvM Member
    edited May 2018
    @crunix, If I remember correct I only connected 1 homey user to IFTTT in the my.athom.com homey settings.
    I use 2 IFTTT accounts however. Both IFTTT accounts I connect to Homey in the IFTTT Web interface. Click "settings" in this screen (www.ifttt.com/homey):

    And then you get this screen where you can connect with your homey credentials:


    In this way, both you're IFTTT accounts can be connected to homey.

    Next, in homey you make a flow with a IFTTT trigger:

    And then when you make an applet in IFTTT you can choose this as an action:

    I hope you understand better now, if not let me know :-)

  • Fire69Fire69 Member
    muesli said:
    A lot of homey users like me have problems with presence detection to trigger flows. Since build-in presence [...]
    Follow the steps below:

    1. Install Webhook Manager app from Homey app store
    2. Create a flow with webhook (name) and action
    3. Go to settings and click on Webhook Manager app. Copy and modify the url. My url is https://webhooks.athom.com/webhook/xxxxxxxxxxxxxxxxxx/?token=xxx&event=webhook-x-home (the bold letters should contain your own token and eventname)
    4. Got to https://ifttt.com/create  (create an account if you don't have one) and create an applet.
    4.1 Use a 'location' trigger, connect and set an area
    4.2 Create an action 'maker webhooks' and connect*
    4.3 Paste the modified url: https://webhooks.athom.com/webhook/xxxxxxxxxxxxxxxxxx/?token=xxx&event=webhook-x-home
    4.4. Method should be 'GET' and Content type 'Application/Json' and Save

    Note: on Mac/Linux you can test the maker webhook > flow in your terminal: curl -X POST https://maker.ifttt.com/trigger/webhook-x-home/with/key/xxxxxxxx

    [...]

    Hi!
    Just found this post, and looks like a nice system.
    I configured an applet to test with my IFTTT-account when I leave home.
    The url I use is:
    https://webhooks.athom.com/webhook/xxxxxxxxxxxxxxxxxxxxxxxx/?token=xxxxxxxxxx&event=IFTTT_Fire69_Away
    I created a flow with webhook-trigger "IFTTT_Fire69_Away"
    The applet runs (I set an alert in IFTTT) but the link to Homey isn't working.
    When I test with curl it returns this message:
    "ok_but_no_matches"

    Any idea what I could be doing wrong?
Sign In or Register to comment.