[HowTo] Location and Presence (Owntracks)

Evening

Yesterday things seemed to improve in the morning. The Location and Presence app updated correctly to show that we had left the Home Geofence.

We had to double back on ourselves and again it updated, this time showing we were home. As we left the GeoFence again, everything updated correctly. I was delighted.

When we returned home, it updated again. There was a bit of a delay in it doing so. Also, despite being in the same car, my phone updated about 11 minutes later. (which could have been the settings)

This morning it again updated correctly as we left for work.

However, this evening I have been bashing my head against the wall again. It only updated my phone as being home over an hour after I got home. According to the Location and Presence app, my partner is still not home. The GPS co-ordinates have updated but it never marks him home. I’ve included the logs in case someone can make sense of what is happening - what is interesting is it appears that he is being marked as home in the logs, but that doesn’t shoot through to the Overview:

20190418-21:12:53 We have received a location message
20190418-21:12:53 Set battery percentage for Drey to 94%
20190418-21:12:53 User Drey authenticated
20190418-21:12:53 handleOwntracksEvents: [{"_type":“location”,“tid”:“d2”,“lat”:51.xxxxxxx,“lon”:-0.72xxxxx,“tst”:1555618348},{"_type":“location”,“tid”:“d1”,“lat”:51.xxxxxxx,“lon”:-0.72xxxxx,“tst”:1555618338}]
20190418-21:12:57 handleOwntracksEvents called
20190418-21:12:57 received ‘{"_type":“location”,“acc”:100,“alt”:146,“batt”:96,“conn”:“w”,“inregions”:[“Home”],“lat”:51.xxxxxxx,“lon”:-0.72xxxxx,“tid”:“d1”,“tst”:1555618355,“vac”:200,“vel”:0}’ on ‘owntracks/Tim/httpendpoint’
20190418-21:12:57 We have received a location message
20190418-21:12:57 Set battery percentage for Tim to 96%
20190418-21:12:57 User Tim authenticated
20190418-21:12:57 handleOwntracksEvents: [{"_type":“location”,“tid”:“d2”,“lat”:51.xxxxxxx,“lon”:-0.72xxxxx,“tst”:1555618348},{"_type":“location”,“tid”:“d1”,“lat”:51.xxxxxxx,“lon”:-0.72xxxxx,“tst”:1555618355}]
20190418-21:13:09 handleOwntracksEvents called
20190418-21:13:09 received ‘{"_type":“location”,“acc”:16,“alt”:0,“batt”:94,“conn”:“w”,“inregions”:[“Home”],“lat”:51.xxxxxxx,“lon”:-0.72xxxxx,“tid”:“d2”,“tst”:1555618366,“vac”:0,“vel”:0}’ on ‘owntracks/Drey/httpendpoint’
20190418-21:13:09 We have received a location message
20190418-21:13:09 Set battery percentage for Drey to 94%
20190418-21:13:09 User Drey authenticated
20190418-21:13:09 handleOwntracksEvents: [{"_type":“location”,“tid”:“d2”,“lat”:51.xxxxxxx,“lon”:-0.72xxxxx"tst":1555618366},{"_type":“location”,“tid”:“d1”,“lat”:51.xxxxxxx,“lon”:-0.72xxxxx,“tst”:1555618355}]

Try enabling the inregions setting in the Homey app.

Thanks very much for the suggestion.

I did that last night and unfortunately it didn’t work too well this morning. Our phones were on significant changes mode in Owntracks and didn’t register we had left the GeoFence. I turned them to move monitoring mode after we had left the GeoFence and left them for a while. This seemed to update the Location and Presence app that we had left but didn’t trigger any of the Homey flows for some reason.

This evening, it did register that we were home in Location and Presence but about 10 minutes after we arrived. What was odd was that our location was shown correctly in OwnTracks. This was with Move monitoring mode enabled.

Any further ideas?

I use a Mosquitto MQTT Broker on my raspberry pi. Location and presence of
homey will check my pi for messages. Works prefect. See OwnTracks.org for howto’s.
I turned off Geofence of homey.
You can install MQTT Broker on homey instead of a raspberry pi.

Hi Hullie - thanks for the suggestion about MQTT. I did try playing around with MQTT but have to admit that I really didn’t understand what I was doing and as a result I couldn’t get things working.

For some reason, it seems to have started to pick up on us coming and going. The arriving back into the GeoFence seems to be rather delayed
 but it is working. I am gonna try and work out why but I am just happy it is working at present.

You can also install it on a NAS / QNAP or Synology or whatever

As I already had that present I installed Mosquitto MQTT on my QNAP NAS

If you are in a car with your phone your sunblocks in your front screen can block the GPS function, also you should have an “internet” connection to update the “owntracks” location to the MQTT server.

You should also setup the owntracks part on Homey turn on check doubble leave and enter events.

I added comments behind your questions.

Evening ChrisBoer.

I was in a car but had good location - checked in Waze - my location was very accurate.

I did have a good internet connection to.

Since your suggestion, I have also updated the Location and Presence app on Homey to double check enter and leave events.

Odd things are still happening
 it’s almost like the Owntracks app data isn’t feeding through correctly to Location and Presence in Homey.

@scanno

I’ve been using this app now for a while now and it works like a charm
 been (Iphone-7) testing and playing around
 I am keeping it But now I have a small problem

I wanted to add a second user (my GF) . so I added user Kirsten in the Homey-L&P-app and got a tokenID. next I installed Owntracks on her I-phone 6S

I set-up the HTTP broker
https://.connect.athom.com/api/app/nl.scanno.owntracks/events/?token=
Uder Kirsten (same as in L&P-app)
cloudid
 same as mine
tokenid
 her token

As soon as I’ve done all this I imediately get a notification on my own phone from the Homey-L&P app
saying “Location & Presence: Device Changed for user.Kirsten to httpendpoint”

So I guess she’s recognized
 and when I add a Geofence in her Owntracks-app I (on my phone) get a notification that Geofence X is added and it is also visible in the L&P-app settings .

but somehow it does not work
 the app won’t pick up her location
 her location stays “Undefined”

:cry::cry::cry:

When I test her presence in a flow

image

I tried several ‘moving’ modes in Owntracks

made her “beheerder” in Homey

Deleted everything and started all over again


nothing seems to help

What am I doing wrong??

Homeys network connections can be flaky. What are you using? HTTPS or MQTT?
When using HTTPS you are also depending on the availability of the athom cloud.

You are not doing anything wrong as far as i can see. Seems like the app has not received any location data yet. Wait and see if the phone leaves the house what happens. And check to log in the L&P app to see if data gets is received from the phone.

HI Scanno - I am using HTTPS as I don’t understand MQTT and when I did try it I couldn’t get it working. (That was definitely user error LOL!)

Hi Chris,

Thanks for your reply! I do appreciate the effort you made to give us an alternative for Homey Presence not working at all.

Ad 1.:
The thing is that having to do manual action to have an accurate position is as handy as manually set the “i am home” state in Homeys presence
 Furthermore I cannot do this for my household members and they suffer from the same.
However setting inregion seemed to take care of this (not understand how and why by the way). Maybe together with smaller locator displacement and locator interval settings?

Ad 2.:
I have disabled Homey Presence and my household members don’t have the homey app installed. Updating the position normally doesn’t help. Restarting (my own) homey app doesn’t help.
Sometimes members are shown home from Location and Presence while they are not and vice versa!? All this when the Owntrack client on my phone shows does members correctly in or out of home!? Flows that changes a counter and alerts me at my phone when someone arrives or leaves often don’t seem to run!?
Again not being able to rely on this is as good as no information so I hope you are able to solve this :slightly_smiling_face:

Regards, and again I appreciate all your efforts for making this!

@scanno
thx for re assuring me, it works!!

still 2 questions/problems though if u got the time

  1. Geofences are personal? cannot share them?

  2. I cannot add a fence in the L&P app
 well I CAN add a fence but is has no coördinates

problem is that on adding a fence, Only the “Fence” field is accesible and when I push the + button the fence is added but without Lon/Lat/Radius

image

In the near future I will set myself on learning how to set up and use a MQTT broker çus the https broker works really fine, but Damn! is a battery-drainer
 :slight_smile:

To answer your question:

  1. Geofences are not personal and can be shared. However at the current version for HTTPS users it is not yet possible to share those geofences. When using MQTT you can push the geofences to the owntracks app on you phone. I am working on a complete overhaul of the homey app that supports pushing data to HTTPS users (you can also see the location of other users in the owntracks app on your phone). But due to the master i am following (next to 40 hour workweek) that is on hold.
  2. Geofences are added autmatically when they are created on the phone. So please use that.

The best thing you can do is create a geofence on the phone with the same name and copy the coordinates from the other phone or from the homey app.

The overhaul includes stuff like:

  1. Nested geofences
  2. A user has one or more devices and each device has a location
  3. Support pushing user info and geofence info to HTTPS clients (like MQTT already supports)
  4. support triggers with user and specific device

Nice thx for support, you deserve a Nobel price for support

not make you rich, but to show my appreciation


image

@scanno

Is there some sort of guide for setting up your MQTT-broker?

only thing i found is how to set up cloud-mqtt but as far as I read I don’t need Cloud Do I?

grtz
Menne

Depends on what you want and your knowledge.

Setting up a free CloudMQTT account is the easiest way to get started with a MQTT broker. Here you just create the broker, add usernames for each device and the L&P app and you are good to go.

You can use my MQTT broker for Homey, but then you would need some knowledge about port forwarding and possibly things like dynamic dns and TLS certificates.

I made a guide regarding setting up the broker on Homey MQTT Broker for Homey

The Owntracks client on your phone needs to trust the selfsigned certificates. To do so you will need to add the generated certificate to the client on your phone.

You need to do the following steps:

  1. Go to the settings page of the MQTT Broker for Homey.
  2. Go to the Session Settings tab

  1. Select the contents of the Certificate field and copy that.
  2. Paste the contents in a text editor and save it with the extension PEM
  3. Put the file on your phone
  4. Go to the settings of the owntracks app on your phone
  5. Go to the security sections
  6. Press CA Certificate, press select and select the PEM file you copied to your phone
  7. Confirm
  8. Secure communication should be working.
1 Like