• 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 172.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.
  • K Offline
    kckndrgn
    last edited by Sep 8, 2016, 11:45 AM

    Had my first issues in a while last night. The problem was that my router lost internet connection and when it was restored the tokens were expired. I ran the setupAccess.py and got new tokens.
    Seems that there should be a better way to reset the module on restart, like if the tokens are expired, the go get new ones.

    1 Reply Last reply Reply Quote 0
    • V Offline
      Vendittelli Module Developer
      last edited by Sep 9, 2016, 12:36 PM

      The python that accesses the fitbit API is currently having that functionality added, I’m doing some work at the moment to help with install issues and once the work on python-fitbit is complete I’ll update again.

      1 Reply Last reply Reply Quote 0
      • C Offline
        chengstark
        last edited by paviro Sep 27, 2016, 8:46 PM Sep 18, 2016, 10:55 PM

        results: [{"message":"Writing credentials to credentials.ini","type":"status"},{"message":"Writing id: 227Z5P and secret: 55b8d28e28533664a52c6ec6a25b51f0","type":"status"},{"message":"Credentials write successful","type":"status"}]
        nop
        Whoops! There was an uncaught exception...
        { Error: process exited with code 1
            at terminateIfNeeded (/home/pi/MagicMirror/modules/node_modules/python-shell/index.js:100:23)
            at ChildProcess.<anonymous> (/home/pi/MagicMirror/modules/node_modules/python-shell/index.js:88:9)
            at emitTwo (events.js:106:13)
            at ChildProcess.emit (events.js:191:7)
            at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
          executable: 'python',
          options: null,
          script: 'modules/MMM-fitbit/python/getData.py',
          args: null,
          exitCode: 1 }
        MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
        If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
        

        i noticed that my mirror stopped getting data updates. it works yesterday but not today, can you help me identify where went wrong?


        Note from admin: Please use Markdown on code snippets for easier reading!

        K 1 Reply Last reply Sep 19, 2016, 10:55 AM Reply Quote 0
        • K Offline
          kckndrgn @chengstark
          last edited by Sep 19, 2016, 10:55 AM

          @chengstark,
          Possibly the internet connection was lost during a refresh, this will cause the tokens to get out of date.
          I stop MM, re-run the “setupAccess.py” script using credentials from the file, then re-start MM and all is fine, until the next time I have an internet hiccup.

          C 1 Reply Last reply Sep 19, 2016, 1:59 PM Reply Quote 0
          • C Offline
            chengstark @kckndrgn
            last edited by Sep 19, 2016, 1:59 PM

            @kckndrgn thanks, will try

            1 Reply Last reply Reply Quote 0
            • V Offline
              Vendittelli Module Developer
              last edited by Sep 22, 2016, 12:31 PM

              I have released a fix for the .ini files problem in the latest version on GitHub. You’ll need to delete your tokens.ini and credentials.ini files and remake them (as well as performing a git pull) for the fix to be effective.

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

                For some reason, I’m getting calories displayed, but nothing else. @Vendittelli, does the module have any additional debugging or logging that I can turn on to look through? - I’m not getting any issues in dev mode or in the terminal - it seems that’s the only data I get. When I look in the dev console, I see:

                writing steps (data/goal): 0/10000
                Writing floors (data/goal): 0/10
                writing calories out (data/goal): 1664/2930
                writing distance (data/goal) 0/5
                writing activeminutes (data/goal): 0/30
                writing sleep (data/goal): 0/480

                When I clear down my tokens.ini and re-run the setupaccess.py, I can see the scope information for the token results includes u’social’, u’settings’, u’profile’, u’sleep’, u’activity’, u’heartrate’, u’weight’, u’nutrition’, u’location’
                if that’s helpful…
                As a slight aside: @olliewarren411, would you mind sharing your ‘vertical-layout’ css? I’m still trying to get my head around cascading style sheets!

                V 1 Reply Last reply Oct 15, 2016, 9:06 PM Reply Quote 0
                • 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
                      • 1
                      • 2
                      • 3
                      • 4
                      • 5
                      • 6
                      • 7
                      • 8
                      • 12
                      • 13
                      • 6 / 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