• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Need help with Fitbit module returning all zeroes

Scheduled Pinned Locked Moved Troubleshooting
5 Posts 3 Posters 2.8k Views 3 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    vdubs
    last edited by Oct 4, 2016, 4:28 PM

    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

    1 Reply Last reply Reply Quote 0
    • V Offline
      vdubs
      last edited by Oct 9, 2016, 6:14 PM

      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.”)

      1 Reply Last reply Reply Quote 0
      • V Offline
        vdubs
        last edited by Oct 9, 2016, 6:59 PM

        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!

        1 Reply Last reply Reply Quote 1
        • D Offline
          darrene
          last edited by Oct 15, 2016, 8:31 PM

          Glad to read you solved it! :)

          F 1 Reply Last reply Dec 5, 2016, 9:20 PM Reply Quote 0
          • F Offline
            frog @darrene
            last edited by frog Dec 5, 2016, 9:30 PM Dec 5, 2016, 9:20 PM

            @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_id>,
                        client_secret: <client_secret>,
                    },
                    resources: [
                        'steps',
                        'floors',
                        'caloriesOut',
                        'distance',
                        'activeMinutes',
                        'sleep',
                        'heart'
                    ],
                    update_interval: 60
                **}**
            },
            
            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Enjoying MagicMirror? Please consider a donation!
            MagicMirror created by Michael Teeuw.
            Forum managed by Sam, technical setup by Karsten.
            This forum is using NodeBB as its core | Contributors
            Contact | Privacy Policy