In this tutorial, Sam Pinney explains how to turn your smart home into a nearby Pokémon Go scanner using Philips Hue lighting and IFTTT. Welcome to the future, Pokéhunters – and very possibly, a full Pokédex.
Ever wished you could get an alert when a Pokémon you haven't caught yet is near your home? If you live in a smart abode, it's easier than you might think. Here's my guide to using smart lighting (in this case, Philips Hue) and IFTTT to turn your dwelling into one big Pokémon tracker.
Before you begin, you’ll need...
- A virtual private server (VPS) that will run Python (I used Linode.com)
- Philips Hue lights, with a Philips account set up for remote access
- A dedicated Twitter account to tweet Pokémon sightings
- A phone number (for verifying a few things as you set them up)
- A fresh Google account
Watch: Pokémon Go tips and tricks
Setting up a custom Pokémon Map account
The first step is to download the Pokémon Go Desktop Map Application. This application talks to the actual Niantic servers to see which Pokémon are nearby. It requires a real Pokémon account to do this, but you don’t want to use your main account in case anything goes wrong, as accounts can be blocked if they're deemed to have 'hacked' the game.
Still with me? Great.
Register a new Pokémon Trainers Club account on the Pokémon website and use the account briefly in the actual Pokémon Go app to catch your first Pokémon, then log out again. You need to do this, as when the custom app we’re going to build talks to the Pokémon servers, they need to think it’s a real person playing the game.
At this stage, you also need to register on Google Maps to get access to the Google Maps API. This API talks to the Pokémon Go Desktop Map Application to get location data and share it with you in a useful way.
This is what the app looks like when it's running:
Related: Best Pokémon Go maps and trackers
Getting the app to talk to Twitter
When you download the Pokémon Go Desktop Map Application, it comes with a bunch of files. You need to edit the customLog.py script to run a program from the Python Twitter library to tweet from the special Twitter account you set up earlier.
This script checks if the Pokémon is nearby and, if so, tweets about it. (You’ll need to register a custom app to have access to your account via Twitter's OAuth functionality.)
To keep things interesting, I edited the Pokémon data file built into the desktop app (pokemon.min.json) to set the rarity of the Pokémon we aren’t interested in to ‘dull’ and set the script to check that before tweeting. So it only tweets if a Pokémon we don’t have appears nearby. We’ve set the radius to 100m for now.
This actually sounds a lot more complicated than it is – all you're really doing is adding a couple of extra lines to Pokémon Go Desktop Map’s customLog.py, editing the list of Pokémon you're interested in, and fiddling around with a Twitter account.
The next thing to do is upload your new custom Python script to your server and it should start tweeting away happily.
Related: 7 clever Pokémon Go hacks
Getting the Pokémon detecting app to talk to your lights
Now set up an If This Then That account. Then tell it you want to make a custom recipe using Twitter. It will ask for your personal Twitter account details and, after it has access, you can tell it to trigger when a specific, different account tweets.
Then it’s easy to plug it into Hue. IFTTT just needs to be given access to your Hue hub and you're away. You can set it to shine any colour you like but I started with red.
Now just wait until a Pokémon is nearby and the light show will begin. I've tested it for a few weeks now and it totally works, though you should warn guests that the lights may flash, otherwise they'll think they're in an episode of Stranger Things.
Related: 26 best IFTTT recipes
Possible future improvements
1) It would be possible to add a second account so that near-ish Pokémon flash orange, leaving only super-nearby ones to flash red.
2) Or you could build one to flash colours, so if a water Pokémon appears nearby the lights go blue. Hue supports 16 million colours so we could be incredibly specific.
3) You can use Hue to tell if you’re at home and only flash then, sparing the cat any Pokémon alerts when we’re not around because he doesn’t play Pokémon. He's a cat.
4) The Hue currently turns the lights red, or flashes forever, so you have to manually reset it to normal mode. It would be good to have it reset when the Pokémon disappears or after, say, 5 minutes
5) The next project would be to set up some sort of alert if the gym nearby is under attack, and even indicate the strength of the defenders. We'll work on that next.
6) You can remove the need for Twitter to talk to the Hue lights, but it’s quite handy seeing a map of where to go for the Pokémon.
Watch: Is Pokémon Go a waste of time?
How did you get on with this project? What tweaks and/or improvements did you make? Let us know in the comments below.