The Spot Messenger is a neat bit of gear. My 18-year-old daughter just got back from a 10-day trip down through OR, ID, MT, UT, and CO with her friend, and my wife and I wanted a way to keep an eye on where she was, and an awful lot of their trip was going to be in places with zero cell service. I had a Spot messenger sitting in a drawer in my office, so I dug it out, put some batteries in it, and re-subscribed to the service. It’s easy to see where the thing is using their web page, or even better, via their free iPhone app. After a few days, I started to wonder if Spot had a public API available to pull data from (it’s a lot easier than trying to do web-scraping). In fact, they do, though there’s almost zero in the way of documentation, and what little there is kind of gives you the idea that some intern has a task to support it in his spare time. Fortunately, it worked exactly the way it should have, and a very small amount of code lets you poll the API to get position data back (see below). The code was written using SBCL and Quicklisp on Linux, though it should work on any modern CL that’s supported by Quicklisp (which is essentially all of them). I tried it on my Mac, and it worked perfectly. You’ll need to fill in the glld (which is the unique Feed Identifier assigned by Spot when you share a page) as well as the optional password. If there’s no password, just set *feedpassword* to nil (no quotes). By default, the up-to-dater thread polls the Spot API every 2.5 minutes. If you do it more often, you’ll anger the API Gods, and Spot will cut you off. A 30 second interval on checking *locations* for new data seems to work well, though you can change this with *sleeptime*. Load the code, then do (start-spot) to start the background thread that polls the API and keeps *locations* up to date with current location data. If you want to watch the location data as it streams in (“streams” might be a strong word, as by default, the tracking is only updated every ten minutes), do (watch-spots). That’s it. Obviously, there’s a lot you can do with the location objects other than just look at them, but this is enough to get you started.
Unfortunately, WordPress eats much of the indentation when I pasted in the code, so it’s a little hard to read. But copy and paste this into your editor, save it, run it, and you should be fine. I decided to just stick the code in github, instead of leaving potentially outdated code posted here. So go look here for the latest version (I already added reverse geocoding to the original code).