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 200.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.
    • O Offline
      onetwankyfive @tismepaulo
      last edited by

      @tismepaulo same issue for me as well

      1 Reply Last reply Reply Quote 0
      • C Offline
        crowbar
        last edited by

        Is anybody able to tell me how I would go about changing my distance from miles to kilometers? My mirror is set to metric however I believe this module has its own settings?

        1 Reply Last reply Reply Quote 0
        • O Offline
          Oliver_Tooth
          last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • O Offline
            Oliver_Tooth
            last edited by

            Hi folks, i’ve installed this module and got it up and running ,but it doesn’t seem to be pulling any data. Could anyone possibly point me in the right direction on how best to fix this? Cheers.

            bheplerB 1 Reply Last reply Reply Quote 0
            • bheplerB Offline
              bhepler Module Developer @Oliver_Tooth
              last edited by

              @Oliver_Tooth For starters, I would open up the developer tools to see if there are any obvious errors when the module is attempting to load data from the Fitbit servers.

              If you’re using an external machine to view the web application (such as Firefox, Chrome, Edge or whatever) press the F12 button. You should see the screen divide and show you what’s going on behind the scenes. Find the console tab and click on it. Look for any error messages in red and see if that helps.

              If you’re modifying the Pi directly, add the dev switch to the start command: npm start dev. It will likewise open up the developer tools and you can see what’s going on.

              It’s a start.

              O 1 Reply Last reply Reply Quote 0
              • O Offline
                Oliver_Tooth @bhepler
                last edited by

                @bhepler Cheers for the pointers. I’ve looked through the dev console and I can’t see anything glaringly obvious. Weirdly however, i’ve gone onto my account section on Fitbit’s website and it doesn’t actually say that this module (app) is listed as having access to the data, despite me running through all the setup as written.

                bheplerB 1 Reply Last reply Reply Quote 0
                • bheplerB Offline
                  bhepler Module Developer @Oliver_Tooth
                  last edited by

                  @Oliver_Tooth Hrm. The next step would probably be to check the NPM logs. I think they’re located at ~/MagicMirror/npm-debug.log, or possibly in the FitBit module’s directory itself.

                  It sure sounds like you’re not extracting data from the website.

                  O 1 Reply Last reply Reply Quote 0
                  • O Offline
                    Oliver_Tooth @bhepler
                    last edited by

                    @bhepler Slightly embarrassing to admit i can’t find that debug file anywhere!

                    1 Reply Last reply Reply Quote 0
                    • bheplerB Offline
                      bhepler Module Developer
                      last edited by

                      @Oliver_Tooth Well, the Wife wants her FitBit stats on the mirror so I’m going to end up using this module at some point. I’ll try and catch up to you and we’ll debug this together.

                      O 1 Reply Last reply Reply Quote 0
                      • O Offline
                        Oliver_Tooth @bhepler
                        last edited by

                        @bhepler That’d be fantastic if you could! This is a 21st birthday present due in just under a weeks time, so i’m starting to panic somewhat!

                        1 Reply Last reply Reply Quote 0
                        • O Offline
                          Oliver_Tooth @daniel44992
                          last edited by

                          @daniel44992 I too am having this exact issue. Did you ever find a solution?

                          1 Reply Last reply Reply Quote 0
                          • bheplerB Offline
                            bhepler Module Developer
                            last edited by

                            @Oliver_Tooth I was able to successfully install the Fitbit module and get it to pull information from the web API. It took a little tweaking, but I did get it to work.

                            Problems I encountered:

                            • Python was not installed. I had to install it and figure out how to install “pip”.
                            • Fitbit doesn’t make their developer area visible off their main website. I ended up bouncing through their forums first.
                            • Example config file on the module GitHub page contains errors. The character after config: should be {, not [.
                            • The secret key and appID field values need to be surrounded by single quotes, something not explained in the readme file.

                            Here’s the relevant portion of my config.sys file.

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

                            When you run npm start the MMM-Fitbit python script will run and kick out a few lines in the console. I’m not entirely sure what it’s doing, but here’s what mine reads:

                            Set credential request recieved.
                            { client_id: '000XX0',
                              client_secret: 'abbacadabba1234567890' }
                            Initial run request recieved.
                            Running getData.py
                            results: [{"message":"credentials.ini exists","type":"status"},{"message":"Writing credentials to credentials.ini","type":"status"},{"message":"Writing id: 000XX0 and secret: abbacadabba1234567890","type":"status"},{"message":"Credentials write successful","type":"status"}]
                            

                            When I ran the setupAccess.py script, it failed to modify the credentials.ini file. I ended up editing it manually and plugging in my application ID and my secret key. The format is simple. Spaces before & after the = and no quotes around the ID or key.

                            VendittelliV O V 3 Replies Last reply Reply Quote 1
                            • VendittelliV Offline
                              Vendittelli Module Developer @bhepler
                              last edited by

                              @bhepler Please, if you spot any problems with the documentation, create a pull request on GitHub and I’ll happily make those changes.

                              1 Reply Last reply Reply Quote 1
                              • O Offline
                                Oliver_Tooth @bhepler
                                last edited by

                                @bhepler That’s great news! I’ve managed to get mine up and working, but from what I can tell initially, it doesn’t seem to stay authorised for longer than a day, i’m currently browsing the python-fitbit forum for help on that. It’s also only showing data for steps, with all other fields showing 0. Is this something you’ve encountered?

                                bheplerB 1 Reply Last reply Reply Quote 0
                                • bheplerB Offline
                                  bhepler Module Developer @Oliver_Tooth
                                  last edited by

                                  @Oliver_Tooth Somewhat. I see steps, distance and calories. Sleep is zero. There’s definitely something going on here. I haven’t run it long enough to encounter the authorization problem. I’ll investigate further tonight.

                                  @Vendittelli - I’ll do that. I should have a PR for you in a couple days. Thanks for the great module!

                                  1 Reply Last reply Reply Quote 0
                                  • S Offline
                                    s199
                                    last edited by

                                    Hello, thank you for that nice addon…i finally managed to make it work (exemple code is still incorrect on github…) but there is a problem, im using an alta hr and i only have the “steps” info on display, everything else is set to 0 :/
                                    Any idea how i can fix that ?

                                    S 1 Reply Last reply Reply Quote 0
                                    • Sandy2503S Offline
                                      Sandy2503
                                      last edited by

                                      The Modul wont work on my Mirror too.
                                      First:
                                      In the moment i haven`t any Fitbit Hardware. I use the Fitbit -App on my WindowsPhone. I can see in the App all useful things like step etc. and the data will sync with the Fitbit webservce.
                                      I can see all activitys an the Mirror with a Zero …

                                      When i stop the mirror with
                                      pm2 stop mm and try to start the python script setupAccess.py from the local terminal so i can see this:

                                      //your code here
                                      sudo python setupAccess.py
                                      Get credentials from credentials.ini ? (Y/N)
                                      y
                                      {"message": "credentials.ini exists", "type": "status"}
                                      {"message": "Reading from crentials.ini", "type": "status"}
                                      {"message": "Read of credentials.ini successful.", "type": "status"}
                                      [19/Sep/2017:19:30:03] ENGINE Listening for SIGHUP.
                                      [19/Sep/2017:19:30:03] ENGINE Listening for SIGTERM.
                                      [19/Sep/2017:19:30:03] ENGINE Listening for SIGUSR1.
                                      [19/Sep/2017:19:30:03] ENGINE Bus STARTING
                                      CherryPY Checker:
                                      The Application mounted at '' has an empty config.
                                      
                                      [19/Sep/2017:19:30:03] ENGINE Started monitor thread 'Autoreloader'.
                                      [19/Sep/2017:19:30:03] ENGINE Started monitor thread '_TimeoutMonitor'.
                                      [19/Sep/2017:19:30:03] ENGINE Serving on http://127.0.0.1:8080
                                      [19/Sep/2017:19:30:03] ENGINE Bus STARTED
                                      

                                      and not more - and no prompt …

                                      when i now from a second terminal the mirror restart with pm2 restart mm
                                      i see on the mirror only:

                                      //your code here
                                      ```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`)
                                      
                                      CherryPy 3.8.2
                                      

                                      Can anyone help me to fix the problem ?

                                      Greetz Sandy2503

                                      1 Reply Last reply Reply Quote 0
                                      • S Offline
                                        stephenmelody @s199
                                        last edited by

                                        @s199 I also have this problem, only Steps is coming through. Did you manage to get it fixed?

                                        1 Reply Last reply Reply Quote 0
                                        • S Offline
                                          stephenmelody
                                          last edited by

                                          This is my output of getData.py

                                          pi@Magic-Mirror:~/MagicMirror/modules/MMM-fitbit/python $ sudo python getData.py
                                          {"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": 1649, "goal": 10000}, "resource": "steps", "type": "data"}
                                          {"values": {"data": 0, "goal": 1}, "resource": "floors", "type": "data"}
                                          pi@Magic-Mirror:~/MagicMirror/modules/MMM-fitbit/python $
                                          
                                          
                                          1 Reply Last reply Reply Quote 0
                                          • pyrosmileyP Offline
                                            pyrosmiley
                                            last edited by

                                            For a little ways now, I’ve been running into an issue where, after running for a day or so, the module stops being able to update. It seems that it’s failing --for some odd reason-- to write the new Refresh Token, so when the Access token is expired, it needs to be re-authorized. I’ve looked through the code and I don’t know a whole lot but I cannot figure out why it’s doing what it’s doing. For now, I have this shell script set to run every night, and that seems to keep it running well enough. I’m sure there’s a better way but until I can get around to learning more, the kludgy way will do.

                                            #!/bin/bash
                                            
                                            export DISPLAY=:0
                                            pm2 stop MagicMirror
                                            python  ~/MagicMirror/modules/MMM-fitbit/python/setupAccess.py
                                            killall chromium-browser
                                            pm2 start MagicMirror
                                            
                                            exit 0
                                            

                                            The first line is there so that it can be run manually over SSH. I did have to log in manually once, but I just told chromium to remember me, so now I don’t have to do anything to re-grant access.

                                            If anyone has a better fix, I’d love to hear your thoughts!

                                            Sandy2503S C 2 Replies Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 6
                                            • 7
                                            • 7 / 7
                                            • 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