[RELEASE] OwnTracks for Hubitat Presence Detection

Yes, that would be the plan!

2 Likes

Wow!

So I am officially overwhelmed after scanning this thread from over a year ago... Was hoping to find a succinct path to implementing the Owntracks integration, but only learned how AMAZINGLY diligent so many people are in this community!!! Thank you @lpakula and so many others here.

As I understand this from here and the Owntracks booklet, I need to deploy an MQTT broker on my network, or subscribe to an outsourced one. ---> from there, I did find a couple of Android apps which imply they can use an android device (like my retired Samsung phone) as a broker. Has anyone tried this???

Whether Android, or Rpi or whatever, once I get the device, I need to install the broker util e.g. Mosquitto, or other, AND a Docker utility to use this. Am I correct so far??

Then use this release and the app(s) on the phone(s) to get started in tracking... Not sure at which point my head will explode... :exploding_head:

1 Like

That's a little more "Macguyver-ish" than required. :wink:

Install the @lpakula's HE Owntracks app from Hubitat Package Manager, and then open the app and follow the instructions in the app to set things up. You can set up as many features as you want to, but you're not required to set up everything. You don't need to install an MQTT broker to get things up and running. :slight_smile:

Instructions section of the HE app:

Depending on whether you're iOS or Android there are different mobile app options and settings.

Get started and come back w/any questions. :slight_smile:

1 Like

@Macguyver

Basically, without the additional docker etc, you get 'current location' only. That's a massive over-simplification, but you get the drift.

To see a history log, you need to add the additional via docker or similar.

Hardly an expert but I think that's about right.

1 Like

And I'm assuming Docker will not run native in the C7 Hub, but requires additional hardware? Since I have several old Android phones laying around, is there a way to deploy Docker on one of those?

You'd need a Raspberry Pi or another computer to run docker. You don't need docker for this integration though. The OwnTracks recorder (installed with as a docker container) just gives you past history of where a person has went.

The live map part of OwnTracks recorder can be replaced by this integration, and just needs you to sign up for a free Google Maps API key.

2 Likes

I don't think there is any way of running docker on an Android device (or any mobile device) at least not officially that I am aware of. Though many other forms of hardware would run it just fine. Old desktop, laptop, Raspberry Pi, mini PC (NUC style), Synology NAS, etc... Keep in mind though for it to work the device running docker needs to be on and running all the time.

Definitely not ideal for the power bill, but there are tons of power efficient options out there to run docker. The recorder package is not very resource intensive, so it would probably run fine on anything. Raspberry Pi or similar small compute device would probably be the best for power efficiency.

Again, not needed for this to work, just a nice to have if you want location historic data for you and your users.

2 Likes

If you haven't yet, really think you should set up the basic integration and use it a bit first... Try on the suit before you modify it. :wink:

2 Likes

^ agreed.

Incidentally, I've tried this:

...got to here...

... and got stuck.

The image is created:

These volumes are created:

If I click in the 'data' I see this:

I've also created this file in C:\Temp

image

image

I'm not sure how to now...

...as instructed. Can someone please assist?

Cheers!

You would need to make another folder in config _data, and then put that file you created there (not in c:\temp).

In that file you need to replace [HOME_PATH] with the actual path from your docker install. What are you running docker on? That will tell you what that needs to be replaced with.

1 Like

Windows.

I have no idea how to make the copy.

So, I'm working on setting this all up. I've added the Owntracks app to HE via HPM, installed the app on my Pixel 7-pro, set up the HTTPS portion and got a correct location on the phone. I am now at configuring the HE app - entered my SSID's (no spaces), set my radius and changed to "Imperial" because I suffer from arithmephobia, and am now looking at setting up the API. I selected Google as my provider, and see after that there is a requirement to "Sign up for a Google API key".... that's where the train goes of the track for me...
Google does not make it intuitive to know what/where/how to get what I need, and I can't even tell if I need to expect a fee associated with this? I think I get $200 worth of data free each month (28,500 "maploads" per month)? I assume that is more than enough, but to sign up do I need to create a project? or what?

FWIW I didn't bother with Google maps.
I use the default Openmaps? setting and it works just great.
A portion of the map in Dark Mode.

Agree, I also use the Openmaps in the mobile app, it works perfectly fine.

Are you looking to set up the Google maps in the HE app? If so, yes, you need to "create a new project" and then ensure "Geocode API" and "Maps JavaScript API" are enabled:
image

The default "free" $200 is more than sufficient. The HE app will stop requesting map/geocode updates when that limit is hit.

Assuming Google "is right", windows docker home path is \wsl$\docker-desktop-data\data\

So in the recorder.conf file, the OTR_STORAGEDIR="/wsl$/docker-desktop-data/data/docker/volumes/recorder_store/_data

And that file needs to be created here /wsl$/docker-desktop-data/data/docker/volumes/config/_data/recorder.conf

Not a docker expert by any means, and never did this on Windows so this one is a bit of a 'beer swigging shot in the dark' :smiley:

Ah, another thick mode. I assumed there were matrix-like docker commands. Sorted!

Thank you!

1 Like

Docker for windows install

Some of these steps may be unnecessary - but this works for me.

The always-on windows pc is 192.168.1.252

Summary
  1. Install Docker Desktop (Docker Desktop: The #1 Containerization Tool for Developers | Docker)

image
image
image

  1. Run command prompt

image
image

  1. Type:
docker pull owntracks/recorder

...which will create this under the images section of Docker desktop

  1. Type the following two commands
docker volume create recorder_store
docker volume create config

image...which will create the following volumes under the Volumes section of docker desktop...

  1. On my system, Docker desktop was installed in the following folder by default:

.. I manually created the following folder tree:
Data -> Docker -> Volumes -> Config -> _data

  1. Run the following command:

docker run -d --restart always --name=owntracks -p 8083:8083 -v recorder_store:/store -v config:/config owntracks/recorder

  1. Now when you click on Volumes -> Config...

...you'll see this:

...now double-click on recorder.conf and you'll see this:

  1. Replace this with the following code:
OTR_STORAGEDIR="C:\Program Files\Docker\Docker\data\docker\volumes\config\_data"
OTR_PORT=0
OTR_HTTPHOST="0.0.0.0"
OTR_HTTPPORT=8083
OTR_TOPICS="owntracks/#"
OTR_GEOKEY=""
OTR_BROWSERAPIKEY=""
OTR_SERVERLABEL="OwnTracks"

(I've added my google api code into there too)

  1. Run this under Owntracks Desktop -> Images:


image

...which then gives this error, which I have no idea is important:

  1. Now you should be able to access the recorder via your browser, once you've entered the settings in the Hubitat owntracks app and sent a location update:

(http://192.168.1.252:8083)

image


.

Installing the frontend is way better.

docker pull owntracks/frontend
docker run -d --restart always --name=owntracks_ui -p 8082:80 -e SERVER_HOST=192.168.1.252 -e SERVER_PORT=8083 owntracks/frontend  

Enter this into browser:
http://192.168.1.252:8082/

...

@lpakula

Just realised that the docker containers don't start automatically if the always-on pc reboots.

However, if I just logon using remote desktop, they start up immediately.

Fix:

Summary

-=edit=-

This link fixed it:
Configure Windows to automate logon - Windows Server | Microsoft Learn

-=/edit=-

Summary

I had a "page not found for several minutes". Logged on to RD, 30 secs later, docker desktop showed they'd been running for 30 secs and everything worked fine again.

Note this is the default setting for the docker service on my machine:

image

I tried changing the service to autostart and that didn't make a difference, I still need to log on as a user first.

1 Like

Let me know if you are done editing your above post. I'll copy it up to the top as one of the sticky ones as a FAQ for others.

Thanks for the detail when doing that!

No worries. I'm done.

It was confusing though. I'd rather have someone check and confirm those steps do actually work (from fresh) before I contaminate your sticky with something that's bordering on awful =)

1 Like