Stuff & Nonsense

Tracking Cats in home assistant

A few months ago, my partner and I finally gave in to the relentless pressure from our children and added 2 kittens to our family. Say hello to Hamish and Hazel:

They’re now 6 months old (and slightly bigger) and getting ready to venture into the outside world. So, of course, being the massive nerd that I am I wanted a way to keep track of their adventures in the big wide world (and be able to find them again if they get lost).

Airtags

After some research, it seems like the best tracking devices currently on the market are Apple’s airtags, with a few caveats. They’re smaller (and cheaper) than GPS trackers. They allow accurate tracking on any recent IOS device (more on that later) and compared to android tracking devices they seem to have more coverage (ie: more people have apple handsets than android handsets froma. specific manufacturer).

There is however, one major downside to using airtags: the apple ‘walled garden’ ecosystem. Put simply, Airtags only work with apple devices. Coincidently I have a Macbook pro for work, but my phone is an android device and we have no other apple devices in our household. To even activate the airtags you need an iPhone (or maybe an iPad?) so the first step was to obtain one.

It’s important to note here that airtags have 2 methods for location. One uses (I think) bluetooth, and allows airtags to be tracked when they’re near just about any ios device back to an iPhone 6s. This means that your airtag can be hundreds of miles away from you and (as long as it’s near an ios device) you can find its location within 50m or so.

The second method uses ultrawideband, and is only available on more recent iPhones (iPhone 11 and up, not SE models). With this, you can get a much more acurate location when you’re close to the airtag (not sure the exact distance, maybe 10m?) which looks something like this:

So, I needed an iPhone and some airtags. I managed to snag a reasonable condition iPhone 11 on ebay for £160. Airtags I got from Amazon as they’re a) slightly cheaper than directly from apple and b) have next day delivery. I got 2 for £58. Oh and also some cat collars with built in airtag holders. Here’s Hazel and Hamish modelling theirs:

Worth noting that hazel is a very small cat (around 2.3Kg at 6 months old) and I was a little worried that the size & weight of the airtag would bother her, but she seems absolutely fine with it.

So now I can track the cats on the iPhone…..but I don’t actually use an iPhone on a daily basis, what I really want to do is have that tracking data available in my home asisstant setup so I can display it on the tablets I already have scattered about the house.

Home Assistant

As I mentioned before, the walled garden approach of apple is one of the downsides to using airtags, but thanks to a lovely utility from Martin Pham it’s possible to extract the data from ‘Find my’ and push it into home assistant via the HA API. Here’s what the app looks like:

Unfortunately but understandably this app only works on MacOS (it grabs the data from the ‘find my’ app’s files) so you will need a Mac to run it on. Or at least you’ll need MacOS to run it on. I definitely can’t condone using this script to setup MacOS as a proxmox VM running on cheap PC hardware like this:

And finally the money shot. Once your airtag data is synced as a ‘trackable device’ you can display it on a map card on your home assistant dashboards, like so:

Once the cats start venturing outside I’ll be able to see how accurate the tracking really is and whether I can use it to trigger automations (like notifying me when the cats come home for example?) but for now it seems to be working swimmingly!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.