Homey Community

Owntracks - howto


#1

Owntracks MQTT Client for Homey


Since this was on the old forum, i suppose it is better to move it also here.

Up to now using topics was the main way of identifying users. This is no longer the case. The owntracks app listens to all topcis that begin with owntracks. For MQTT users, the username is retreived automatically from the topic the phone app posts on. So it is important that you use correct usernames.

Also with version 1.5.0 it is also possible to use HTTP. HTTP can be used on its own (without a MQTT broker). The use of a MQTT broker is still possible and has some advantages over the use of HTTP. 

When using HTTP,  you have to add users that are allowed to send events to the owntracks app. To do this, go to the owntracks 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.



After you have added the user, the user will show up in the user list and it will have a token generated that is used in the phone app to allow receiving of the events:


You can remove a user by pressing the “-” button. The “#” button can be used to generate a new token when you think the id has been comprimised.

In the app on your phone, you should select HTTP as connection:





Then select HOST:



The URL you have to enter here is as follows:

https://<cloudid>.homey.athom.com/api/app/nl.scanno.owntracks/events/?token=<tokenid from user>

where <cloudid> is the Athom Cloud ID of your homey that you can find in Settings/System.
The tokenid is the id that is generated when you added the user.

Using the Athom Cloud is the easiest way of getting started with owntracks. If you are more skilled you can also directly connect to your Homey by port forwarding. Keep in mind that homey itself does not support TLS/SSL. If you want to have a secured session, you need to use a proxy.

In addtion you can use a MQTT broker:

Setting up a MQTT brokers can be done in several ways. You can either use a broker on the internet (there are MQTT hosting services) or run a MQTT broker yourself.
There is a MQTT Broker app for Homey available in the App store.

For setting up a private MQTT broker in the cloud with CloudMQTT see the tutorial below:
https://forum.athom.com/discussion/2810/use-cloudmqtt-as-a-broker-for-owntracks-or-mqtt-app

@ingmar  made a very nice tutorial how to setup Owntracks:
 https://forum.athom.com/discussion/2804/setup-homey-with-mqtt-for-location-detection/p1