• 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.

Fitbit

Scheduled Pinned Locked Moved Troubleshooting
129 Posts 42 Posters 166.8k Views 37 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
    Vendittelli Module Developer @darrene
    last edited by Oct 15, 2016, 9:06 PM

    @darrene That is weird. The module is pretty unadvanced so I don’t have proper debugging, unfortunately. The scope looks correct, are you sure you have synced your Fitbit today? It would explain why calories are displayed as they are calculated automatically so you don’t need to sync them.

    D 1 Reply Last reply Oct 15, 2016, 9:49 PM Reply Quote 0
    • D Offline
      darrene @Vendittelli
      last edited by Oct 15, 2016, 9:49 PM

      Thanks for the quick reply @Vendittelli - that could be the answer. I didn’r realise the calories were calculated like that - as you say, it’d certainly explain it.

      I’ll have a look into it. If it comes to it, I’ll recreate the app - I seem to remember there are a list of tick boxes for the fitibit attributes and on the pi browser, it was really difficult to tell whether or not they were ticked!

      1 Reply Last reply Reply Quote 0
      • M Offline
        moshinh
        last edited by moshinh Oct 25, 2016, 3:42 PM Oct 25, 2016, 3:36 PM

        I am having the same issue Greppie had at some point.

        Next thing is, that setupAccess.py doesnt work or I did not understood how it does. The script start a server at port 8080 but if fitbit redirects to it I get an error that the page is not accessible. However I copied the token from url an put it into tokens.ini. There’s only an access token and no refresh token, right?

        I am having this same problem, I get a 404 error on the attempt to get my tokens. I was able to pull the token from the URL, but have no way to get the refresh. Please help, im so close! Thanks for all of your effort.

        When I click the autogenerated authorization URL, I am redirected to http://127.0.0.1:8080/ and throw this 404 error.

        404 Not Found

        Missing parameters: state

        Traceback (most recent call last):
        File “/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py”, line 670, in respond
        response.body = self.handler()
        File “/usr/local/lib/python2.7/dist-packages/cherrypy/lib/encoding.py”, line 217, in call
        self.body = self.oldhandler
        (*args, **kwargs)
        File “/usr/local/lib/python2.7/dist-packages/cherrypy/_cpdispatch.py”, line 67, in call
        raise sys.exc_info()[1]
        HTTPError: (404, ‘Missing parameters: state’)

        This is what I see when I run setupAccess.py

        Is this part normal?

        CherryPy Checker:
        The Application mounted at ‘’ has an empty config.

        Full output:

        pi@mirror:~/MagicMirror/modules/MMM-fitbit/python $ sudo python setupAccess.py
        Get credentials from credentials.ini? (Y/N)
        n
        Would you like to enter them manually now? (Y/N)
        y
        Enter client id:
        227WT7
        Enter client secret:
        9fe3da42b609603a67e7730aad3ca96a
        [25/Oct/2016:11:20:26] ENGINE Listening for SIGHUP.
        [25/Oct/2016:11:20:26] ENGINE Listening for SIGTERM.
        [25/Oct/2016:11:20:26] ENGINE Listening for SIGUSR1.
        [25/Oct/2016:11:20:26] ENGINE Bus STARTING

        CherryPy Checker:
        The Application mounted at ‘’ has an empty config.

        [25/Oct/2016:11:20:26] ENGINE Started monitor thread ‘Autoreloader’.
        [25/Oct/2016:11:20:26] ENGINE Started monitor thread ‘_TimeoutMonitor’.
        [25/Oct/2016:11:20:27] ENGINE Serving on http://127.0.0.1:8080
        [25/Oct/2016:11:20:27] ENGINE Bus STARTED
        127.0.0.1 - - [25/Oct/2016:11:20:40] “GET / HTTP/1.1” 404 1206 “” “Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.91 Safari/537.36”

        T 1 Reply Last reply Nov 28, 2016, 2:17 PM Reply Quote 0
        • F Offline
          frog
          last edited by frog Nov 10, 2016, 10:18 AM Nov 10, 2016, 10:16 AM

          I have the same issue but I think the problem is earlier in the install

          Well I’m having an even earlier problem in installing the dependencies:

          pi@Mirror1:~/MagicMirror/modules/MMM-fitbit $ npm install python-shell
          

          returns:

          /home/pi/MagicMirror/modules
          └── python-shell@0.4.0 
          
          npm WARN enoent ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/package.json'
          npm WARN enoent ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/node_modules/node_helper/package.json'
          npm WARN modules No description
          npm WARN modules No repository field.
          npm WARN modules No README data
          npm WARN modules No license field.
          

          The python-shell is clearly not installing.

          A 1 Reply Last reply Dec 22, 2016, 2:15 PM Reply Quote 0
          • T Offline
            tismepaulo @moshinh
            last edited by Nov 28, 2016, 2:17 PM

            I’m also having the same issues as @moshinh and @frog during installation. Has anyone been able to get this working?

            F O 2 Replies Last reply Dec 8, 2016, 6:47 PM Reply Quote 0
            • F Offline
              frog @tismepaulo
              last edited by frog Dec 8, 2016, 7:54 PM Dec 8, 2016, 6:47 PM

              @tismepaulo Actually, I got it working by firstly not using ssh and running this directly on the display using a terminal and secondly not using sudo. Populated the tokens.ini with the results from the results of the script - and changed the access of the tokens.ini file to 666 - re-ran again the setupAccess.py and it said all was good.

              having said that - while I get the authorisation page from Fitbit, I got zero values on the MM. The fitbit account page says that I have access, but initially no data comes through… Next thing I did was running getData.py (in the python directory) I do get a good response:

              {"message": "credentials.ini exists", "type": "status"}
              {"message": "Reading from credentials.ini", "type": "status"}
              {"message": "Read of credentials.ini successful.", "type": "status"}
              {"message": "credentials.ini exists", "type": "status"}
              {"message": "Reading from credentials.ini", "type": "status"}
              {"message": "Read of credentials.ini successful.", "type": "status"}
              {"message": "tokens.ini exists", "type": "status"}
              {"message": "Reading from tokens.ini", "type": "status"}
              {"message": "Read of tokens.ini successful.", "type": "status"}
              {"message": "Making API call", "type": "status"}
              {"message": "API call okay", "type": "status"}
              {"message": "Tokens valid", "type": "status"}
              {"values": {"data": 4684, "goal": 10000}, "resource": "steps", "type": "data"}
              {"values": {"data": 0, "goal": 1}, "resource": "floors", "type": "data"}
              

              So I think it is at least reflecting accurately now what the fitbit site is showing for steps, but is incorrect for distance - still showing 0 (maybe because I’m using KM not miles?)

              1 Reply Last reply Reply Quote 0
              • R Offline
                Rmtcts
                last edited by Dec 10, 2016, 8:49 PM

                I’m having a bit of trouble getting this to work with my Magic Mirror. The display is there but it has 0 in all of the categories. I have followed the steps and I get up to running setupAccess.py which takes me to a webpage where I allow access to all of the checkboxes, but it then just redirects to the magic mirror screen with 0s in all of the categories. if I run getData.py it says

                {"message": "credentials.ini exists", "type": "status"}
                {"message": "Reading from credentials.ini", "type": "status"}
                {"message": "Read of credentials.ini successful.", "type": "status"}
                {"message": "credentials.ini exists", "type": "status"}
                {"message": "Reading from credentials.ini", "type": "status"}
                {"message": "Read of credentials.ini successful.", "type": "status"}
                {"message": "tokens.ini exists", "type": "status"}
                {"message": "Reading from tokens.ini", "type": "status"}
                {"message": "Read of tokens.ini successful.", "type": "status"}
                {"message": "Making API call", "type": "status"}
                {"message": {"401": {"errors": [{"message": "Access token invalid: <your access token>. Visit https://dev.fitbit.com/docs/oauth2 for more information on the Fitbit Web API authorization process.", "errorType": "invalid_token"}], "success": false}}, "type": "error"}
                {"message": "Invalid token, reauthorise fitbit API", "type": "status"}
                

                and the tokens.ini file says:

                [Tokens]
                acc_tok = <your access token>
                ref_tok = <your refresh token>
                
                1 Reply Last reply Reply Quote 0
                • F Offline
                  frog
                  last edited by Dec 10, 2016, 9:07 PM

                  Well the token.ini file should be altered to include the correct credentials. That’s why you are getting the error. Fix that and you may get somewhat further. I manually entered the info to get mine to (partially) work.

                  1 Reply Last reply Reply Quote 0
                  • R Offline
                    Rmtcts
                    last edited by Dec 11, 2016, 11:20 AM

                    Where could I get the access and refresh tokens from?

                    1 Reply Last reply Reply Quote 0
                    • A Offline
                      Azrael Masters @frog
                      last edited by Azrael Masters Dec 22, 2016, 2:18 PM Dec 22, 2016, 2:15 PM

                      @frog I’ve got the same Issue with the Image of “2016-11-25-raspbian-jessie”.
                      I’m logged in on the BigScreen (not with SSH) and typing via Terminal:

                      pi@raspberrypi:~/MagicMirror/modules/MMM-fitbit $ npm install python-shell
                      /home/pi/MagicMirror/modules
                      └── python-shell@0.4.0
                      npm WARN enoent ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/package.json'
                      npm WARN enoent ENOENT: no such file or directory, open '/home/pi/MagicMirror/modules/node_modules/node_helper/package.json'
                      npm WARN modules No description
                      npm WARN modules No repository field.
                      npm WARN modules No README data
                      npm WARN modules No license field.
                      

                      I also tried this, without success:

                      pi@raspberrypi:~/MagicMirror $ npm install python-shell
                      magicmirror@2.0.0 /home/pi/MagicMirror
                      ├── UNMET PEER DEPENDENCY grunt@1.0.1
                      └── python-shell@0.4.0
                      npm WARN grunt-yamllint@0.2.0 requires a peer of grunt@~0.4.0 but none was installed.
                      

                      Anybody an Idea, what I need to do?

                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 5
                      • 6
                      • 7
                      • 8
                      • 9
                      • 12
                      • 13
                      • 7 / 13
                      • 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