Dan Brag dot com

Thoughts and stories from a business student.

Fitbit One and Debian — How To

For Christmas, my lovely mother was kind enough to get me a Fitbit One. This little guy monitors my steps, floors climbed, sleep, and calories. It also ties in perfectly with their online interface where I can add food and activities. It also links up with MyFitnessPal!

The fitbit one

The fitbit one

Obviously, I need to lose some weight. But that’s not really the point of this post. I decided to dual boot the new version of Debian on my computer for fun. I realized that if I were to run Debian, I would need a way to sync my fitbit! I did a good amount of research and was finally able to figure out a way to get the fitbit to sync.

First, I’ll start with some technical information about the fitbit. The new fitbit systems use Bluetooth 4.0 LE to sync, rather than the proprietary ANT protocol. This is both good and bad for developers. The Bluetooth protocol is open enough to develop for, but there is still an issue of how to communicate with the fitbit tracker. Luckily for us, there are developers who have been working on ways to do this.

The oldest implementation of fitbit sync was with libfitbit — this used the ANT protocol to sync the trackers. This evolved and evolved until a kind person named Benoît Allard created a python script called galileo. This is the script we are going to be using to sync the tracker. An interesting thing about fitbit, is that the server parses the device ID and links the transmitted data to the appropriate accounts, rather than a client-side application being linked to a certain account. It makes the syncing a little bit easier.

Let’s Sync!

Before we begin, I would like to note I am running Debian version 7.3.

Below are the instructions that I used to get my Fitbit One to sync (all commands are all run in terminal as root):

  1. apt-get install python-usb
  2. apt-get install python-requests
  3. Download the pyusb script from the zip file here. Unzip the folder into a convenient location.
    1. Go to the directory in terminal as root and run the following: python setup.py install
    2. This is done to upgrade the Python USB libraries because the galileo script does not support the older one.
  4. Download the Galileo script from here (the zip file is located next to “Size” on the right hand side)
  5. Unzip this into a convenient folder (I just used /home/dan/Documents/fitbit)
  6. In terminal, cd into the folder and edit the file 50-fitbit.rules (vi 50-fitbit.rules)
    1. Change the OWNER name to your username (in my case, ‘dan’).
    2. Save the file
  7. Copy that file to /etc/udev/rules.d/ (cp 50-fitbit.rules /etc/udev/rules.d/)
  8. If you have the fitbit dongle plugged in, unplug it, then replug it.
  9. In the galileo folder, as your user, NOT ROOT, run ./galileo.py
  10. If there were changes in steps or any data, you will see the output of the script and the sync with the fitbit servers.

And there you have it! You have just synced your fitbit. This is only the beginning. We will have to add the script to run via a cron job. I will add mine to run every 15 minutes. Run the following commands as your own user, not root:

  1. crontab -e
  2. Append the following to your crontab: */15 * * * * /full/path/to/galileo.py

The above command will run galileo.py on every 15 minute interval in every hour (0, 15, 30, 45). Make sure that you use the full path to the python script in order to ensure that the script will run. If you do not want to wait, there is no harm in running the script manually.

Overall, I am very grateful that I found this script. It definitely can be a deal breaker for many people who use Linux, and I hope that this article could help. Since Ubuntu is based off of Debian, I am sure that this walk through can apply to that operating system as well.

As of right now, I have not seen any issues with the script. I will keep this post updated if I find anything out.

What Works:

  • Step tracking
  • Setting and configuring alarms via the online interface

Unknown:

  • Floor tracking

Please let me know if you have any questions or comments about the article!

Also, I apologize if this does not work for you, but I do not take any responsibility for any advice offered in this post.

– Dan

 

, , , , , , , , ,

5 thoughts on “Fitbit One and Debian — How To

  • Ben says:

    Thank you very much for this interesting step by step instruction !

    I don’t know if you’ve seen it, but you can now install the utility using ‘pip’. That installs the dependencies for you, and help you keeping up-to-date with the newer versions. The udev rule is not installed, but an instructive (at least I hope so) message instruct you how to do so if the utility realizes it’s missing …

  • Jen says:

    Thank you… I just synced from Ubuntu 13.04! Hooray!

    I had follow the steps in https://bitbucket.org/benallard/galileo/issue/41/errors-in-kubuntu to get galileo to run without errors (involves modifying ‘galileo.py’ for version 0.3.1 or ‘dongle.py’ for version ‘tip’)

    I believe this can be avoided by selecting a tagged release of pyusb – eg https://github.com/walac/pyusb/archive/1.0.0b1.zip – in step 3 of the instructions, rather than the master branch.

    Also, with regards to step 6, versions of galileo from 0.3 onwards have a “99-fitbit.rules” rather than “50-fitbit.rules” file and do not require any change to an OWNER variable.

    If anyone is interested (wondering why a tracker was skipped, for example), you can get a verbose mode using:
    [version 0.3.1] ./galileo.py -v
    [version ‘tip’] ./run -v

    Thanks again!
    Jen

  • […] Sure, you can use a compatible smartphone, but in general I like to use the idea of using my Linux computers for anything and with some research and some tests I’ve been able to sync successfully my flex with my Linux Mint 16. From Fitbit one and Debian: […]

  • Tom Bruning says:

    Thanks for this. I got it to work with no problems and it syncs everything, steps, calories, distance, sleep steps. Thanks again.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>