Need help with Fitbit module returning all zeroes



  • I’m having an issue where the fitbit module loads up fine, however none of the data fields are populated.
    What I’ve tried:

    • Set all privacy settings in my fitbit profile to “anyone”
    • Confirmed login ID and secret is correct in config.js

    Possibly related:

    • When I start “sudo python setupAccess.py” it hangs indefinitely at ENGINE Bus STARTED. I’m not sure if this is normal.
      0_1475598298034_upload-532432ce-5035-4549-b2a5-fadcce9641ea
    • Do I need to start MagicMirror with “sudo npm start”? I’ve been using “pm2 start mm”. When I use “sudo npm start” from the MagicMirror directory I get the following:
      0_1475597794489_upload-e4af3286-f04a-46f4-a7a1-b48ba9a4c7e4

    pi@raspberrypi:~/MagicMirror $ sudo npm start

    magicmirror@2.0.0 start /home/pi/MagicMirror
    electron js/electron.js

    npm ERR! Linux 4.4.21-v7+
    npm ERR! argv “/usr/bin/nodejs” “/usr/bin/npm” "start"
    npm ERR! node v6.7.0
    npm ERR! npm v3.10.3
    npm ERR! code ELIFECYCLE
    npm ERR! magicmirror@2.0.0 start: electron js/electron.js
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the magicmirror@2.0.0 start script ‘electron js/electron.js’.
    npm ERR! Make sure you have the latest version of node.js and npm installed.
    npm ERR! If you do, this is most likely a problem with the magicmirror package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR! electron js/electron.js
    npm ERR! You can get information on how to open an issue for this project with:
    npm ERR! npm bugs magicmirror
    npm ERR! Or if that isn’t available, you can get their info via:
    npm ERR! npm owner ls magicmirror
    npm ERR! There is likely additional logging output above.

    npm ERR! Please include the following file with any support request:
    npm ERR! /home/pi/MagicMirror/npm-debug.log

    pi@raspberrypi:~/MagicMirror/modules/MMM-fitbit/python $ sudo python setupAccess.py
    Get credentials from credentials.ini? (Y/N)
    Y
    {“message”: “credentials.ini exists”, “type”: “status”}
    {“message”: “Reading from credentials.ini”, “type”: “status”}
    {“message”: “Read of credentials.ini successful.”, “type”: “status”}
    [04/Oct/2016:09:23:41] ENGINE Listening for SIGHUP.
    [04/Oct/2016:09:23:41] ENGINE Listening for SIGTERM.
    [04/Oct/2016:09:23:41] ENGINE Listening for SIGUSR1.
    [04/Oct/2016:09:23:41] ENGINE Bus STARTING
    CherryPy Checker:
    The Application mounted at ‘’ has an empty config.

    [04/Oct/2016:09:23:41] ENGINE Started monitor thread ‘Autoreloader’.
    [04/Oct/2016:09:23:41] ENGINE Started monitor thread ‘_TimeoutMonitor’.
    [04/Oct/2016:09:23:42] ENGINE Serving on http://127.0.0.1:8080
    [04/Oct/2016:09:23:42] ENGINE Bus STARTED



  • Update: I figured out my issue was related to SSH. I’ve been setting up the MagicMirror entirely through SSH. When starting “sudo python setupAccess.py” it was hanging indefinitely at “ENGINE Bus STARTED.” I tried this same thing without SSH and it booted up the fitbit webpage to log in and grant access.

    I’m having another issue now where after granted access I’m getting:

    ERROR: Missing access token parameter.
    Please check that you are using the correct client_secret

    You can close this window

    File “setupAccess.py”, line 53, in index
    self.oauth.fetch_access_token(code, self.redirect_uri)

    File “/home/pi/MagicMirror/modules/MMM-fitbit/python/fitbit/api.py”, line 151, in fetch_access_token
    code=code)

    File “/usr/local/lib/python2.7/dist-packages/requests_oauthlib/oauth2_session.py”, line 244, in fetch_token
    self._client.parse_request_body_response(r.text, scope=self.scope)

    File “/usr/local/lib/python2.7/dist-packages/oauthlib/oauth2/rfc6749/clients/base.py”, line 409, in parse_request_body_response
    self.token = parse_token_response(body, scope=scope)

    File “/usr/local/lib/python2.7/dist-packages/oauthlib/oauth2/rfc6749/parameters.py”, line 376, in parse_token_response
    validate_token_parameters(params)

    File “/usr/local/lib/python2.7/dist-packages/oauthlib/oauth2/rfc6749/parameters.py”, line 386, in validate_token_parameters
    raise MissingTokenError(description=“Missing access token parameter.”)



  • Final update: I had a single capital letter in my client secret that was causing this issue. I swapped it to lower case and the module is finally working!



  • Glad to read you solved it! :)



  • @darrene Funny, but I had to change the config to remove the square brackets and replace them with curly brackets around the config parameters to get the config.js file to be accepted:

    {
        module: 'MMM-fitbit',
        position: 'top_center',
        **config: {**
            credentials: {
                client_id: ,
                client_secret: ,
            },
            resources: [
                'steps',
                'floors',
                'caloriesOut',
                'distance',
                'activeMinutes',
                'sleep',
                'heart'
            ],
            update_interval: 60
        **}**
    },
    

Log in to reply
 

Looks like your connection to MagicMirror Forum was lost, please wait while we try to reconnect.