Homey Community Forum

Location and Presence (Owntracks) - HowTo

app
tools

#42

I managed to install the MQTT broker on my Synology NAS. I run LetsEncrypt for a valid certificate. For those that like to know: Control Panel -> Security -> Go to certificate tab -> add the letsencrypt certificate for your public hostname that is pointing to your NAS. That certificate can be used in the mosquitto configuration as well. For those trying to figure that out, the relevant settings are:
cafile /etc/ssl/certs/DST_Root_CA_X3.pem
certfile /usr/syno/etc/certificate/system/default/fullchain.pem
keyfile /usr/syno/etc/certificate/system/default/privkey.pem

You also need to add read rights to these files (chmod a+r fullchain.pem privkey.pem). I can live with the fact that this means my private certificate is readable for everyone with an account on this NAS. A more elegant way would be to add access to just the mosquitto daemon.

The documentation is stressing left and right to set “use_identity_as_username false”, but you don’t want that for a situation where you have a valid certificate. It is intended for a situation where you have a manually installed certificate on your phone that is also providing ‘credentials’, i.e.: having (and using) that particular certificate allows a valid TLS encrypted login. If you make the mistake to set this use_identity_as_username to false, you will get CONNACK errors telling your username or password is not correct. Which is a valid error message, albeit not very helpful remedying the error.

My only worry is that my Synology autoupdates the certificate every 3 months so I keep a valid shortlived LetsEncrypt certificate. I reckon I will run into problems since I expect the broker will not pick up on the on the fly updates to that certificate. So, I think I need to work out a script that is restarting the mosquitto service after an automated certificate update.

My next step would be to actually use the owntrack updates in flows. I disallowed the homey app access to Location data on my phone (and save battery that way) but I obviously would like to update the presence awareness in the Homey sphere (pun intended). What would be an appropriate way to do that? Should I update the status of the already available (but flakey) Presence facility from homey with ‘mark user as away’ leaving a geofence, or should I run flows with a dedicated variable ignoring this build in facility?


#43

How do you find out the external ip of a device where you can’t use Google to tell you? :sweat_smile:


#44

nmap on your raspberry or ‘fing’ on your iPhone, and Android has similar tools.


#45

Also for a Nas?


#46

ssh to the NAS, type “ifconfig -a [enter]” and see how the various interfaces are configured. Or, use your phone connected to the same network and with an app like ‘fing’ find out what seems to be the NAS.


#47

I’d rather use MQTT broker on Homey, since Mosquito has no gui. Maybe I’ll try it someday, but first I have to make sure private http works flawlessly. I went to work today and Owntracks knows I’m at work, but Homey (Location & presence) still thinks I’m at home. I wish I was too, but that’s a different matter.

I went to a friend Saturday and it worked fine then.


#48

I have installed the app and connected it with mqtt.
The problem is that added geofence are not visible in owntracks.
When I add a geofence in Homey I cannot add the coordinates.


#49

That can have several causes. First your location accuracy was bad and the leave event was ignored. Also connectivity problems can be a cause, but then the message should be send as soon as the connection is back again.

For those situations i was experimenting with the inregions field that is send with regular locations events, but cant get that to work reliable. If you have often these kind of problems, try enabling inregions.


#50

You can see your location in settings?


#51

How can I sync those on an iPhone? The screenshot from Android show an advanced setting, on the iPhone I don’t see something that publishes my ‘home’ geofence to other phones. The homey knows about it, the phone that configured it knows about it, but the second phone does not show this geofence. Can I push it from the 1st phone or homey app? Force get it on the second phone?


#52

Ah you want to push to other phones? Go to the settings page of the homey app.
In the overview tab you will see the most actual data of the knows users. At the right side you wil see a button that says ^ by each line. Press it and it will send the data of the geofences to that phone (only MQTT for now)


#53

Ah! Thanks. That phone is en route now, so I will have to wait for a check if the app is showing the fence. This is the screen scanno is talking about:


#54

If it does not show, the device has to accept remote commands. Its a setting somewhere on the phone app.


#55

Only on Android under Advanced. This option is not available on the iPhone.


#56

Nope. Did not work. I see the cmd command in the communication but the owntracks app on phone 2 does not add the geofence. I clicked the arrow next to phone two since that is the phone that needs the waypoints. As a quick fix I exported the waypoint in my settings screen and send them with airdrop to phone number 2. If it can not be send as it should, then we should send it as it can… Let’s find out if this exported geofence is triggering flows…


#57

Yesterday we went away and it worked fine (both leaving and coming home). This morning I went to work and Owntracks knows I’m here, but Location & Presence did not get updated. I’ll try turning inregions on and see what happens.


#58

After leaving the ‘ported’ home geofence once, everything is working fine!


#59

Ik heb exact hetzelfde gehad na de update werd de app onbruikbaar. Met de nieuwe settings over HTTP lukt het wel weer. Als alles goed draait maar weer eens een MQTT broker proberen.


#60

If you could please keep the conversation in English as much as possible, then more people will be able to participate and help you. If you would rather not or can’t communicate in English then please check out Non-English boards at

https://community.athom.com/c/non-english


#61

After testing it for a couple of days, I do have some questions. I’d like to compose a geofence within a geofence. It is nice to have a flow arriving in town (to flow the thermostat) with like a geofence of 5 miles around home, and within geofence town a geofence home with a 300 feet radius (and flow the normal presence items). When I configure that, the combination owntracks/homey is becoming a bit unpredictable. Like when leaving home it is mentioning arriving in town, which is odd, since I already was in town. Yet it is not mentioning leaving home and hitting my presence update flow.

Am I too greedy? Should I just make a couple of geofences on the entrance ways into town or is my geofence within geofence a scenario that actually should work and just needs some more debugging?