How do I configure libfitbit?

5,050

Solution 1

So I haven't actually been able to set up the fitbit using libfitbit, I had to use my roomates Mac to do the initial setup.

As for the "sticking in the stick and get the upload going", I included some udev rules in that package (I believe the original author wrote them), and it should just work when the fitbit is plugged in (once the initial setup has been done).

If it doesn't work, you just need to plug in, and run sudo start libfitbit_client

Solution 2

Thought I would add a couple of pointers for getting libfitbit running on Ubuntu Xenial Xerus 16.04:

  1. The ppa listed above currently only has libfitbit for Ubuntu distributions up to Vivid. To tell Xenial to fetch the Vivid distro code, after running sudo add-apt-repository ppa:cwayne18/fitbit, edit the file /etc/apt/sources.list.d/cwayne18-ubuntu-fitbit-xenial.list and change 'xenial' to 'vivid'. After that, sudo apt-get update and sudo apt-get install libfitbit should be able to find and install the package.

  2. You need this patch (currently in a unmerged pull request) applied to the file /usr/share/libfitbit/fitbit_client.py (which you can do in an editor, remove the '-' line and add the '+' lines without the plusses) to avoid '403 Unauthorized' errors when the script tries to access the fitbit website.

    At line 136:

    -                res = urllib2.urlopen(url, urllib.urlencode(self.info_dict)).read()
    +                req = urllib2.Request(url, urllib.urlencode(self.info_dict))
    +                req.add_header("User-Agent", "FitBit Client")
    +                res = urllib2.urlopen(req).read()
    
  3. Xenial runs (by default) systemd instead of upstart, so needs a different startup file. Put the following text in a file named /lib/systemd/system/libfitbit.service

    [Unit]
    Description=Fitbit ANT uploader
    Documentation=https://github.com/openyou/libfitbit
    
    [Service]
    Type=simple
    ExecStart=/usr/bin/python /usr/share/libfitbit/fitbit_client.py
    
    [Install]
    WantedBy=multi-user.target
    

    and start with sudo systemctl start libfitbit.

  4. after plugging in the Fitbit Ultra base station and your Fitbit into it, and waiting a few seconds, you should be able to see the debug output of the script talking to and from the device and Fitbit website by running sudo journalctl -u libfitbit

Share:
5,050

Related videos on Youtube

Satish
Author by

Satish

I'm the Solution Director Innovation for HCL Software, looking after an incredibly talented team of engineers based in Manila, Philippines. I hold multiple Salesforce certifications. Before that I worked in various roles: Salesforce Program Architect Director, IBM Code Mage for Collaboration & Cloud in IBM ASEAN; NotesSensei for IBM Lotus Notes & Domino, independent consultant and CTO for startups long before they became en vogue and venture backed. I started with COBOL (while studying economic, since there were no spreadsheets then), move to dBase and Foxpro. Fell in love with @1-2-3 and Lotus Agenda. Lotus Notes was the next logical step which I started with V2. I do JavaScript, Java & VB.NET and XML and XSLT. My first mobile application ran on a Palm Pilot mobilising a SAP inventory system (that was already last century). I love the maker movement and got a cupboard full of electronics to tinker with. I live in Singapore. My core interests are knowledge management and eLearning. I'm a certified counselor for personcentric organisational development. And yes: plenty of Salesforce certs too. If you feel something is too complicated, chat with me, I'll explain it in simple terms.

Updated on September 18, 2022

Comments

  • Satish
    Satish over 1 year

    To use Ubuntu to upload FitBit data you need libfitbit which is available as ppa now. However I couldn't find configuration instructions. I also wonder if cuttlefish could help to get the same functionality as on OS/X: stick the stick in and get the upload going?