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 201.0k 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.
    • 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
          • Sandy2503S Offline
            Sandy2503 @pyrosmiley
            last edited by

            Hi.

            I start the setupAccess.py and i have got an Error from Chromium Browser.

            In the Message stands the the Chromium Browser starts as normal user and not as root.

            How can i fix it ?

            Sandy

            1 Reply Last reply Reply Quote 0
            • M Offline
              MattSharp
              last edited by

              Has anyone managed to get this installed on a Raspberry Pi Zero W using Jessie Lite?

              When running setupAccess.py I can’t get anywhere as it doesn’t open a browser window so I can’t authenticate.

              Any help appreciated.

              1 Reply Last reply Reply Quote 0
              • C Offline
                Costi @pyrosmiley
                last edited by

                @pyrosmiley I had the same issue and I could change it by setting new rights for the tokens.ini file. Set the rights for write to all (before this only for root access) and the new token can be written. Update works now, let’ see how long …

                1 Reply Last reply Reply Quote 0
                • A Offline
                  Achilles
                  last edited by

                  Hello all,

                  Newbie here. I know I am late trying to put together a MagicMirror, but I just discovered this! Anyway, I am trying to put this Fitbit module on mine, and I when I run “sudo python setupAccess.py”, I get a “python: can’t open file ‘setupAccess.py’: [Errno 2] No such file or directory” error.

                  I am not sure where I have gone wrong here, as I have followed the instructions thus far found here:

                  https://github.com/SVendittelli/MMM-fitbit/blob/master/README.md

                  Any ideas?

                  Thanks.

                  1 Reply Last reply Reply Quote 0
                  • A Offline
                    Achilles
                    last edited by

                    I fixed it. Newbie mistake, I was in the wrong directory when I tried to excute the command. Having problems now trying to get my steps to show, so I have pouring over all of the info here in the forum…thanks to all who have posted here

                    1 Reply Last reply Reply Quote 0
                    • A Offline
                      Achilles
                      last edited by

                      I got it to work! Great module!

                      1 Reply Last reply Reply Quote 1
                      • C Offline
                        cambor
                        last edited by cambor

                        @achilles
                        @Vendittelli

                        Hi! I too am new to MagicMirror (and programming in general) and am trying to install the Fitbit module. Maybe as you have done it so recently you could help me please?

                        When I enter:

                        sudo pip install -r python/fitbit/requirements.txt

                        I get the following error message:

                        Could not open requirements file: [Errno 2] No such file or directory: ‘python/fitbit/requirements.txt’

                        Any idea what I am doing wrong or what I need to do?

                        Thanks!

                        1 Reply Last reply Reply Quote 0
                        • A Offline
                          Achilles
                          last edited by Achilles

                          @cambor

                          I am no expert by any means, but did your:

                          npm install python-shell

                          step work?

                          C 1 Reply Last reply Reply Quote 0
                          • C Offline
                            cambor @Achilles
                            last edited by

                            @achilles Thanks for getting back to me. Yes that step worked and now I have figured out I was in the wrong directory when running sudo pip install -r python/fitbit/requirements.txt. I was trying to do that step out of sequence before following the preceding steps in the Setup instructions.

                            I am facing another issue now though: I’ve added the example config to my config but when I try to run the MagicMirror it throws an error
                            “Please create a config file…If you get this message while your config is already created, you config file probably contains an error…”

                            I saw there was issues with the brackets after “config” in line 4 of the example config file and people have suggested replacing the [ with { and again on line 19 ] with } but it still doesn’t work.

                            Now I see some people are saying there are issues with the fitbit API (https://github.com/SVendittelli/MMM-fitbit/issues/15) but those comments are from January so I’d be interested to hear about how you got yours working so recently and if you can see where I might be going wrong.

                            Thanks a lot!

                            bheplerB 1 Reply Last reply Reply Quote 0
                            • A Offline
                              Achilles
                              last edited by

                              Every time I have got that error, it has been because I have something wrong with the syntax: Curly braces incorrect, double quotes where there should be single quotes, comma missing, etc. Does every open bracket or curly brace have a corresponding closing bracket or curly brace?

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

                                @cambor - Easiest thing to do is to copy the example config.js.sample file to config.js and modify it incrementally. After each modification to the file, you can reload the mirror and make sure you haven’t introduced an error.

                                If you like, you can post the MMM-fitbit section of your config.js here and we’ll see if we spot anything. Be sure to use the markdown features of the forum to aid in troubleshooting.

                                1 Reply Last reply Reply Quote 0
                                • A Offline
                                  Achilles
                                  last edited by

                                  Has anyone’s Fitbit module stopped working recently? For some reason, mine is not displaying anything anymore–just 0s. This started about a week ago…

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

                                    @achilles - That happened to me about three weeks ago. I had to get back on the mirror and run the setupAccess.py script to authorize with fitbit.com again. After that it started working again. You’ll probably find an indication of what’s up in the pm2 logs.

                                    Fitbit is weird in that they insist that you use their website to authenticate. You can’t get an API key for you app. Your app must incorporate a means to go to their website to use their interface and then return.

                                    1 Reply Last reply Reply Quote 0
                                    • A Offline
                                      Achilles
                                      last edited by

                                      @bhepler - At the risk of sounding stupid, you have to go back and run through the commands again and get to setupAcess.py to get Fitbit to work again?

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

                                        @achilles - Almost. You just have to run the setupAccess.py again. So get onto your Pi directly, open up a terminal window, stop your MagicMirror process, and run the sudo python setupAccess.py or whatever the command is. It will open up a browser window with the FitBit login page. Log in with your credentials, wait for the confirmation screen and then close the browser.

                                        Restart your MagicMirror process and it should start pulling from the FitBit service.

                                        1 Reply Last reply Reply Quote 0
                                        • A Offline
                                          Achilles
                                          last edited by

                                          @bhepler Thanks! That helped. I guess this means I can look forward to doing this every month or so?

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

                                            @achilles - I don’t actually know. Mine was up for months with no issue. It may be that a prolonged period without the module refreshing the tokens is the determining factor. It may even be something on Fitbit’s end expired all of the tokens.

                                            1 Reply 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
                                            • 3 / 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