Homey Community Forum

Location and Presence (Owntracks) - HowTo


At the moment you are too greedy :). The logic inside the Homey app can’t handle that scenario.
At the moment that you are crossing the border, the phone app tells the Homey app that it is leaving a fence and/or entering one.

But it is an interesting scenario. It is worth some debugging. Could you give me some logging from the Homey app. First i am interested in the _location messages. If you are in your town and home, what does the inregions section in that message say. Does it have two entries (home, town)?



In home (and thus in town):
20190209-18:26:29 OnMessage called

20190209-18:26:29 received ‘{“batt”:77,“lon”:4.66666666666666,“acc”:65,“p”:100.333333444,“vac”:10,“lat”:52.8888888888,“inregions”:[“home”,“town”],“t”:“p”,“conn”:“w”,“tst”:1546633189,“alt”:-3,"_type":“location”,“tid”:“GG”}’ on ‘owntracks/gerard/KA9Q77777-ADA6-4006-BC8D-BADCAFEC909’

20190209-18:26:29 We have received a location message

20190209-18:26:29 Set battery percentage for gerard to 77%

20190209-18:26:29 inregions: home,town

20190209-18:26:29 region home

20190209-18:26:29 region town

20190209-18:26:29 User gerard already is in region town

20190209-18:26:29 isAccurate



Thanks. That confirms what I thought.
Supporting.that requires a bit of rethinking of the trigger logic.

Will add a fence inside a fence also to see the trigger behavior.



How do I set this up from the mobile app 2.0.2?

I can’t find the option to carry out the following.

When using HTTPS, you have to add users that are allowed to send events to the homey app. To do this, go to the apps settings page and go to the second button (Change users). Add the user name that you want to give access by entering the name in the empty field below the already known users. Press the “+” button to add the user.



Doing some major rework on the Location and Presence app. Just managed to get pushing of waypoints working on https connections.
Pushing of waypoints means that you can send all known geofences from the Homey app to a known phone.

That was already possible for MQTT users, but the internal rework makes it possible to store messages to https connected phones. Once a location change comes in from that phone, the geofences are send inside the https response.



In the Athom Homey app, go to the App section, choose Location and Presence. In that screen press Configure App.

Then you will see the Homey Location and Presence settings screen. At the end of the settings screen, select the button/tab users. There you can add the new user.



Thank you, I now have it working with accurate presence status.



have you reassigned your phone in the owntracks flow ?



Scanno the fence in bigger fence will also fix additional complexity with owntracks getting false possitives. So if you go walking around your area the gate does not need to go open. If you have been out of you 2km fence then it should trigger again to open the gate.
I now have fixed this with adding logic variables but it could be much easier when you have multiple triggers possible or if trigger entered big geofence and home geofence entered than true if entered home geofence but no trigger entering big geofence then false



I found out I can ‘lock’ apps on my phone, to prevent them from closing, or sleeping, or something. I must say it’s been working fine the last couple of days.



On what phone and OS?






Xiaomi Mi Mix 2S, Android 9. In the overview of running apps, I can longpress in on an app. I then get a submenu with three options. One is a lock and it prevents apps from closing (I guess). Even though I’ve already turned off battery optimization for Homey and Owntracks, I still had issues, but now it seems to work.



Testing right now with multiple fences. Seems to be working so far. And I guess having a logic card that gives back true/false if you are in a fence is something I could add.

Main change is that I now have an array a fences that a device is in. Leave removes a fence from that array and enter adds it.



I somehow can’t get this to work. i get a
http 500 error

Any tips?
for now I’m on 1.5



The URL for 2.0 changed, so it’s logical that you get a 500 right now.
For 1.5.x use https://[cloudid] .homey.athom.com/api/app/nl.scanno.owntracks/events/?token=[tokenid]

In other words, change connect in the url into homey.

1 Like


I have homey in the url (what is it for 2.0 then?)



https://[cloudid] .connect.athom.com/api/app/nl.scanno.owntracks/events/?token=[tokenid from user]

You get a HTTP 500 and the app does not work any more or it still does?
Can be that athom shut down the old cloud endpoint.



owntrack gives me a 500 error, the app on homey shows undefinied, aka , enver connected.

Idk, it enver worked…also before 2.0 I think.
If I’d upgrade to 2.0 now? what would be the new url I need to fill in?



https://[cloudid] .connect.athom.com/api/app/nl.scanno.owntracks/events/?token=[tokenid from user]

It’s also in the first post