2007-06-24
Above London, a Hackday project
The idea of Hackday London 2007 was, unsurprisingly, to hack. Beforehand I’d had little idea of what to do, but candace managed to come up with a few ideas. Notably, one evening last week she noticed some photos on SpaceWeather.com of the International Space Station, as taken from the Netherlands, and thought that perhaps we’d have a chance of seeing it. We checked Heavens-Above, a venerable satellite tracking/prediction site, and we caught a flyby which included a moment of brightness as the newly-deployed solar panels caught the sun.
Wouldn’t it be great, she mused, if it was possible to get messages to your phone when such things were going to happen? As well as ISS flybys, there are also Iridium flares, where the redundant communications satellites reflect sunlight down to the ground, and it’d be nice to be told about those, too. It looked like we had an idea.
Implementing the idea wasn’t terribly tricky, either. There are two parts to it. Firstly, there’s a scraper for Heavens-Above. We set up a special London account, and wrote a script that authenticates against the site, and downloads and parses the data tables for the ISS and iridium flares. This goes into a plain text file, with the date and time as one field and the text message to send as the next. Since the data tables list events for seven days in advance, this script doesn’t have to run frequently- at the moment it’s doing so once a day.
Secondly, there’s the sender script, which runs every five minutes. It reads in the data file, parses the date (slightly hackily- I’ll need to fix that eventually), and, if the event is within twenty minutes, sends it to Twitter. Also - and this is where where the required use of a BBC or Yahoo! API comes in - the script checks the Yahoo feed’s “current weather conditions” value, and if it’s likely you’ll be able to see the event, continues onwards to send it. Otherwise, it doesn’t bother (but I do get an email from cron telling me what the weather actually was).
I was able to get all the coding done and put it on my colo before one of the flares that evening, but sadly the weather wasn’t quite clear enough and we didn’t have visibility in the right direction. Still, we had SMSes and a Twitter list that we could point to as proof of a working hack, so we went home. (There’s an aside here about the difference between the SF culture and London’s more lackadaisical one, perhaps, but it’ll have to wait for another day.)
I spent another 30 minutes on Sunday morning tidying up the verbosity of the script (it now only prints, and hence sends email, at the same time it has output to send), and then came the slightly nervewracking presentation, which thankfully seemed to go down well, despite us having nothing really in the way of UI to demo. (One of the best things about Hackday- you don’t have to write up yourself…)
That evening I added a feed for SF (and took the chance to comment alongside all the bits of code that needed changing). If you’re interested in getting messages for passes Above London or Above SF then get a Twitter account and friend the appropriate user. (Longer-term Twitter users might want to adjust their phone notification settings if they want to get SMSes late at night.)
What’s next, then? Well, I’ve since looked at a Perl module (Astro-satpass) that would have let us cut out Heavens-Above, and possibly opened the door to more customised messages. In particular, we’ve made some arbitrary decisions (we don’t send flares that don’t climb above 20°) and it’s really hard to add a new location. It’d be nice to remove those limitations, but doing so introduces a new problem; namely, Twitter is a very easy platform for notifications, although I’m concerned about its reliability and timeliness. Customised messages mean either abandoning it or (ab)using the direct messaging syntax.
It was notable that Twitter was used in a fair amount of the hacks (from the live blog post written during the presentations, at least 10%). I think it’d be a perfect fit for Yahoo, alongside Flickr and del.icio.us, as a developer-friendly site that, perhaps, needs a bit of resourcing behind it to make it truly reliable (and, perhaps, more international; the UK number isn’t always cheap). How about it?
Anyway, the two applications/accounts/bots should now run without human intervention (at least until that date hack I mentioned rears its head around Christmas), and hopefully I’ll remain inspired to tackle the more complex project of personalised feeds and notifications later in the summer. For now, enjoy spotting satellites.
(via more chaff)