OwnTracks is a popular ad for location tracking and home assistant allowing to
create some cool automations depending on the location of a device today I'm going
to show you how to set up OwnTracks using the HTTP mode and configure it in
Home Assistant with the Owntracks integration webhook we also going to be
looking at how to use it with the newly released cloud web hooks which allows
sending data back to home a system from anywhere without exposing your instance
to the Internet to set up OwnTracks in Home Assistant go to menu configuration
and then integrations search for OwnTracks tand then click on configure on
the pop up click on submit then another pop-up comes up containing the unique
web hook and also the encryption key make sure that you copy this information
because once you've closed the pop up you won't be able to see it again
inside the home assistant web interface but you can always find it by accessing
the corn.config_entries file inside the storage folder which is a hidden
folder inside the home assistant config folder now download the OwnTracks app
on your Android or iOS device if you are using an Android device open the OwnTracks
app click on the menu icon preferences and then connections set the
mode to private HTTP then under hosts enter the OwnTracks webhook URL
provided on Home Assistant under identification set up a user name device
ID and also a tracker ID for the device that you setting up now to add the
encryption key go back to the main preference window and then go to
advanced on an iOS device click on the I at the top left corner of the screen and
then go to settings change the mode to HTTP and then set up a device ID now
enable authentication and set up a user ID the secret encryption key and the
OwnTracks webhook URL if you don't have home assistant setup with remote
access you can still integrate OwnTracks and use the home assistant cloud service
which now has web hooks available making it possible to send data back to home
assistant without exposing your instance to the Internet to set up the cloud
webhook for OwnTracks going to configurations and then home assistant
cloud if you haven't set up an account yet you can try it out free for 30 days
if you already signed in you will notice that the web hooks that you set up in
the integration window are available to use with the cloud service switch on the
OwnTracks webhook and then a pop-up comes up with a new cloud web hook that you
can use for OwnTracks you can then copy the URL and paste it
on the host feel in the OwnTracks app alright so part of the setup is done we
can actually start pushing location data to home assistant by tapping on the
publish icon on the top right corner of the map window then if you check the
home assistant config folder a new file name known_devices.yaml was
automatically created there are a few things that you can configure for the
devices added for example you can add the devices MAC address which can be
used with a network device tracker like nmap you can also add a picture or an
icon to make it easier to identify a person or device if you want to add an
image to a device you will first need to save it in the www folder if you don't
have this folder yet you will need to create it inside the home assistant
config folder then add the path to the image using /local/
and then the name for the image including the file extension after the
image is added restart home assistant to apply the changes if you are using the
classic web UI in home assistant you would automatically see at the top the
badges for the devices that you setup but if you are using lovelace and you
have it set to yaml mode then you can either set up the devices in a glance
card or add the badges by adding the following to the top of the main view in
the yaml file alright so the next thing that you want to do is set up zones
which can be used in automations that can be triggered when a device is within a
specific area there are two ways that you can set up zones you can do it directly
in Home Assistant or you can set up regions in the OwnTracks app okay so to do
a via the OwnTracks app go to menu regions and then
tap on the plus icon at the top to add a new location in the description field
enter a name for the new location then tap on the GPS icon and search for a
location that you would like to set up after you select a new location
specify the radius that you would like to cover for this region then click on
the checkmark at the top to save the changes now to push this new location to
home assistant tap the three dots at the top and then publish waypoints you can
then check the map window in home assistant to see the new zones you can
also see the zones entity by going to States under the developer tools one of
the bad things about setting up regions via the OwnTracks app instead of zones
directly in Home Assistant is that anytime that you restart home assistant you
would need to manually publish the waypoints so they can appear in Home
Assistnat. Now if you set up zones in home assistant you don't have to worry every
time that you have to restart home assistant to set up a specific location
at home assistant create a new file named zones.yaml inside your home
assistant config folder then set up a name for the location the latitude the
longitude the radius and an icon that represents a location you can visit the
web site called map developers so you can easily find the correct latitude
longitude and especially the radius that you would like for the zone when
finished save the changes and then include the zones in the configuration.yaml
file by adding the following three star home assistant and then when
is back online you can see the new zone setup in the map window and you can
start using them in automations alright so OwnTracks is not perfect
sometimes he can report GPS locations with a low accuracy which can cause for
zoning and trigger automations to avoid that you can set at the max_gps_accuracy
in the configuration.yaml file for example if you set up the max_gps_accuracy
to be 100 or 200 meters then only GPS reports within that value will
be taken into account other parameters that you can set up here are waypoints
and Waypoint whitelist waypoints allow exporting regions from owntracks to
home assistant by default it is set up to true and any user in your home can
export the regions to home assistant if you want to limit the users that I can
do this then you can use the parameter Waypoint whitelist which allows and in
the user names for the people that can explore the location all right so the
last thing that you need to setup is the monitoring mode on the OwnTracks app if
you're going to depend a lot in location tracking for automations then
you want to use the move mode which continuously tracks and publish a new
locations to home assistant as soon as the device moves the bad thing about this
mode is that it uses a lot of battery so that's something that you definitely
want to have in mind now the alternative would be to set up the significant
location change mode which will only publish a new location when a device
moves at least 500 meters in five minutes this mode enables the OwnTracks app
to run in the background and minimize the battery consumption alright guys
that's all I have for you today remember that you can find all the steps at
juanmtech.com you can find a link in the description below if you have any
feedback suggestions or questions leave me a comment down below if I have the
answer to your questions I'll be more than happy to help
like always guys thank you for watching if you like this video give it a thumbs
up don't forget to subscribe if you haven't done so already and I will see
you in the next video