Posted by: Shawn Workman | July 23, 2016

C.H.I.P. Live Pokémon Tracker – Update

Up to this point

A couple of days ago I saw an article on using the PocketC.H.I.P. as a Live Pokemon Tracker.  I don’t have the PocketC.H.I.P. but I do have the C.H.I.P..

I took that article and what I had already done on my MacBook Pro and setup my C.H.I.P. to use the develop branch of the PokemonGo-Map project on GitHub.  That can be seen here.

With new projects like this I like to keep up to date with the development branches so I can see what is going on.  For this to be somewhat easy some scripting is required.  This allows me to checkout the latest from time to time while preserving my settings without having to edit a lot of files whenever I decided to update everything; which I do several times a day.

Before we get going

The C.H.I.P. is amazing.  When you get down to it though, it is just Linux.  What follows works equally as well on my MacBook Pro which is UNIX.  I copied and pasted the commands from my Mac to the C.H.I.P. without having to change them.

The meat and potatoes

Before you get started with what I have done you will want to make sure the basic components have been installed.  Since this post is regarding the C.H.I.P. I recommend heading over to the original article and issuing the commands on lines 1 – 4 from the that they have listed.  I have listed them below for easy reference:

sudo apt-get update
sudo apt-get install libpython2.7-dev build-essential python-pip

With those commands run successfully we can get to it.

Get to it already!

Fine, ok..  let’s do this.

But wait….

My C.H.I.P. already had git installed on it.  Honestly I don’t remember if it was there originally or if I installed it at some point along the way.  If it isn’t installed on yours a quick:

sudo apt-get install git

should take care of that.

You will still need a Google API Key.  Look at this for information on how to get one.

Installed git – Check; API key – Check

This is really easy, and has been working well for several days.  Tracking a development branch means you are going to run into issues – you will need to fix things from time to time so be prepared for that.

As of the time of this writing what I am presenting is a simple run and enjoy process.

Here we go – for realsies.

I am logging in as the chip user on my C.H.I.P.. The chip user has sudo access.

Create a script in your home directory.  Call it whatever you want, but make it executable.  Mine is called

chip@chip:~$ touch
chip@chip:~$ chmod +x

Next use your favorite editor to edit the file we just created:

chip@chip:~$ vi

Once the editor opens up paste the lines below into it, save the file, and close the editor. Beware that some lines below will wrap. Most notably the line:

cd PokemonGo-Map
cp config/credentials.json ../
cp config/config.ini ../
git checkout .
git pull
cp ../credentials.json config/
cp ../config.ini config/
rm pogom.db
sudo pip install -r requirements.txt
sudo pip install -r requirements.txt --upgrade

python -a google -u USER -l "LONGITUDE LATITUDE"
 -st 10 -H

This is the script that I run from my home directory to preserve my settings, get the latest develop branch changes, merge my local changes back in, delete my old database, install and update any new requirements and start the server.

Before we can do that we need to clone the repository of course. Again mind the line wrap:

chip@chip:~$ git clone -b develop
Cloning into 'PokemonGo-Map'...
remote: Counting objects: 6145, done.
remote: Total 6145 (delta 0), reused 0 (delta 0), pack-reused 6144
Receiving objects: 100% (6145/6145), 11.65 MiB | 1.89 MiB/s, done.
Resolving deltas: 100% (2862/2862), done.
Checking connectivity... done.

Now we need to add our Google API key to the credentials.json file after we move it into place.  Line wrap…:

chip@chip:~$ mv PokemonGo-Map/config/credentials.json.example

Then use your favorite editor again to paste your Google API key in the appropriate spot. Save the file, and close the editor.  Line Wrap.. Reminds me of “Toe Pick”:

chip@chip:~$ vi PokemonGo-Map/config/credentials.json 

        "gmaps_key" : "API KEY GOES HERE"

Now we can run our script:

chip@chip:~$ ./ 
cp: cannot stat 'config/config.ini': No such file or directory
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 1
Unpacking objects: 100% (4/4), done.
   9fefd90..01d086d  develop    -> origin/develop
Updating 9fefd90..01d086d
 templates/map.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
rm: cannot remove 'pogom.db': No such file or directory

Your output will vary depending on what items and versions are already installed on your C.H.I.P.. You may/will be prompted for your sudo password and will be prompted for your Pokémon Go account password as well.  Any errors indicating that files don’t exist are there because, well — the don’t exist.  This is the first time we have run this after cloning the repository.  Subsequent runs should look similar to the following:

chip@chip:~$ ./ 
Already up-to-date.
Requirement already satisfied (use --upgrade to upgrade): ...
Requirement already up-to-date: ...

You get the idea.

If all goes well you should see it start up and be able to reach the server in your web browser at the IP Address and Port you have configured. By default this is if you are on the C.H.I.P. directly. The -H argument lets me access mine by the LAN IP of my C.H.I.P..

That’s it, really… No, really.

That is really all there is to it.  If you don’t want to deal with all of this updating and keeping up with develop you can omit the -b develop when you issue the git clone command.  The rest should work as is as long as the master branch uses the same paths for credentials.json.  That is the only important piece since it has our Google API key in it.

Like I said earlier – This should work on any UNIX/Linux like OS.  Actually, if you look in the ./PokemonGo-Map/Easy Setup/setup.bat file you will see that the setup is pretty straightforward on Windows platforms as well.

Leave me a comment if you have any questions or run into any issues.  I will do my best to lend a hand.



  1. The credentials.json file doesn’t seem to exist anymore?

  2. Yeah, the Development branch is actively changing. I would recommend if you want to follow it that you keep your settings saved and periodically wipe it out and clone it fresh. I do that about once every week or so. Usually after a normal update that I do fails with errors.

  3. […] De servers de makers van de Pokémon Go app hebben de beschikking over een API die bevraagd kan worden over de aanwezigheid van Pokémons in de buurt. Een handig scriptje kan die informatie op een Google maps kaart tonen en dat is precies wat er is gebeurd. […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: