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.6k 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.
    • 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
              • M Offline
                mmille40
                last edited by

                This module looks great, unfortunately the installation is giving me the most difficulties from any module so far, I’m completely new to anything coding so I’m learning as I go. My first problem was trying to install the python-shell dependency. I get this message in my terminal:

                pi@matt:~ $ npm install python-shell
                npm WARN saveError ENOENT: no such file or directory, open ‘/home/pi/package.json’
                npm WARN enoent ENOENT: no such file or directory, open ‘/home/pi/package.json’
                npm WARN pi No description
                npm WARN pi No repository field.
                npm WARN pi No README data
                npm WARN pi No license field.

                • python-shell@1.0.4
                  updated 1 package in 2.932s

                What am I doing wrong here?

                1 Reply Last reply Reply Quote 0
                • D Offline
                  dh1201
                  last edited by

                  See issue from mmille40 (above).

                  I am running ‘npm install python-shell’ from within the MagicMirror/modules/MMM-fitbit folder and appear to be having the exact same issue [although the location of the file that cannot be found is reported differently to mmille40’s location] and am unable to discover the reason why. Does anyone have any ideas?

                  npm WARN saveError 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/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.

                  • python-shell@1.0.4
                    updated 1 package and audited 2 packages in 3.126s
                    found 0 vulnerabilities
                  S 1 Reply Last reply Reply Quote 0
                  • S Offline
                    sdetweil @dh1201
                    last edited by

                    @dh1201 this says u are in the MODULES folder, not MMM-Fitbit

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    1 Reply Last reply Reply Quote 0
                    • D Offline
                      dh1201
                      last edited by

                      Should it be the modules directory then?

                      Set up states:

                      As with all modules, use git clone in the modules directory to download the module
                      Goto fitbit to register a new app (sign in with your fitbit account)
                      Give your app a catchy name and description
                      Your personal website, organisation, and organisation website can be whatever you like
                      Check browser and personal for OAuth settings
                      Callback URL MUST BE http://127.0.0.1:8080/
                      Give your app read & write permissions (read-only untested)
                      Note your:
                      “OAuth 2.0 Client ID” — (client_id)
                      “Client (Consumer) Secret” — (client_secret)
                      (You can access these again later via manage my apps at the same link as above)
                      Navigate to MMM-fitbit in the modules directory
                      Install dependancies using the listed commands

                      1 Reply Last reply Reply Quote 0
                      • D Offline
                        dh1201
                        last edited by

                        Sorry @sdetweil - I misread your post.

                        The command is definitely being run from within the MMM-fitbit directory; but shows the errors previously posted.

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

                          This module usually stops working for me after a day or two, and I have to go through the setupAccess.py again to get it to work, and then it stops working again within 48 hours.

                          Am I doing something wrong?

                          1 Reply Last reply Reply Quote 0
                          • DeepThoughtD Offline
                            DeepThought
                            last edited by

                            Was there a resolution to the problems @dh1201 and @mmille40 were experiencing?

                            I am experiencing the same problem where when running the command, npm install python-shell, while in the MMM-fitbit directory, I receive the same error as @dh1201

                            npm WARN saveError 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/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.

                            When starting Magic Mirror, the Fitbit module displays no info and the cmd prompt states ‘TypeError: PythonShell.run is not a function’ and ‘TypeError: PythonShell is not a constructor’.

                            Does anyone know how to resolve this issue with python-shell? I’ve tried different versions and installing through different directories without any success. I’ve also tried clean installs of Magic Mirror but that doesn’t help either.

                            Is @Vendittelli still supporting this module?

                            1 Reply Last reply Reply Quote 1
                            • K Offline
                              K-Pental
                              last edited by

                              @deepthought said in Fitbit:

                              When starting Magic Mirror, the Fitbit module displays no info and the cmd prompt states ‘TypeError: PythonShell.run is not a function’ and ‘TypeError: PythonShell is not a constructor’.
                              Does anyone know how to resolve this issue with python-shell? I’ve tried different versions and installing through different directories without any success. I’ve also tried clean installs of Magic Mirror but that doesn’t help either.

                              After some faffing with the config to get the MM to load I am also getting this same error message when MM now loads.

                              From what I can see it is pulling the auth tokens correctly and is also able to run the getData.ph as running this on its own returns my total lack of steps etc. But the figures are not updating on MM, I’m assuming this is because of the above error messages.

                              I was able to get past PythonShell.run is not a function by altering line 9 in the node_helper.js to be:

                              let {PythonShell} = require(‘python-shell’)

                              However doing this then gave other error messages relating to code in other files, kind of making me think that this was the wrong thing to do. I’m assuming I am missing something obvious.

                              Does anyone have any suggestions?

                              O 1 Reply Last reply Reply Quote 1
                              • M Offline
                                MMMveasy
                                last edited by

                                hi everyone

                                i found a workaround

                                1. cd MagicMirror
                                2. mkdir Test
                                3. cd Test
                                4. npm install python-shell@0.5.0
                                5. copy python-shell from Test/node_modules folder to MagicMirror/node_modules
                                6. also copy package.json to node_modules folder of MM
                                S 1 Reply Last reply Reply Quote 1
                                • O Offline
                                  OttToyBoy @K-Pental
                                  last edited by

                                  @k-pental said in Fitbit:

                                  @deepthought said in Fitbit:

                                  When starting Magic Mirror, the Fitbit module displays no info and the cmd prompt states ‘TypeError: PythonShell.run is not a function’ and ‘TypeError: PythonShell is not a constructor’.
                                  Does anyone know how to resolve this issue with python-shell? I’ve tried different versions and installing through different directories without any success. I’ve also tried clean installs of Magic Mirror but that doesn’t help either.

                                  After some faffing with the config to get the MM to load I am also getting this same error message when MM now loads.

                                  From what I can see it is pulling the auth tokens correctly and is also able to run the getData.ph as running this on its own returns my total lack of steps etc. But the figures are not updating on MM, I’m assuming this is because of the above error messages.

                                  I was able to get past PythonShell.run is not a function by altering line 9 in the node_helper.js to be:

                                  let {PythonShell} = require(‘python-shell’)

                                  However doing this then gave other error messages relating to code in other files, kind of making me think that this was the wrong thing to do. I’m assuming I am missing something obvious.

                                  Does anyone have any suggestions?

                                  I’ve been struggling with this as well with no resolution. Pinging to see if anyone can provide some guidance.
                                  Notes:

                                  • brand new Raspian installation on pi 3, B+
                                  • manual installation of Magic Mirror meticulously following instructions (note: the auto-install did not work due to issues with missing npm)
                                  • installed MMM-Fitbit per instructions and have successfully executed getData.py and seen my correct fitbit data (i.e. all the registration and tokens have worked)
                                  • trying to “npm install python-shell” from within the MMM-Fitbit directory has errors as previously described by other users
                                  • doing “npm install python-shell” from the MagicMirror directory will succeed but I’ve no idea if this is where it should be done instead. After install, the following has been created: ~/MagicMirror/node_modules/python-shell

                                  I’ve tried re-installing from scratch several times to make sure I’m following instructions closely but no luck. Any guru guidance would be appreciated!

                                  Thanks, Peter.

                                  1 Reply Last reply Reply Quote 0
                                  • S Offline
                                    sameer-t @MMMveasy
                                    last edited by

                                    @MMMveasy said in Fitbit:

                                    hi everyone

                                    i found a workaround

                                    1. cd MagicMirror
                                    2. mkdir Test
                                    3. cd Test
                                    4. npm install python-shell@0.5.0
                                    5. copy python-shell from Test/node_modules folder to MagicMirror/node_modules
                                    6. also copy package.json to node_modules folder of MM

                                    This worked for me! Thank you!!

                                    1 Reply Last reply Reply Quote 0
                                    • StoffbeuteluweS Offline
                                      Stoffbeuteluwe Project Sponsor
                                      last edited by

                                      Hi is the module still working ?.???.

                                      1 Reply Last reply Reply Quote 0
                                      • V Offline
                                        voodew @bhepler
                                        last edited by

                                        @bhepler

                                        This post helped me the most.

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

                                        Thank you.

                                        1 Reply Last reply Reply Quote 0
                                        • Arno-StrasbourgA Offline
                                          Arno-Strasbourg
                                          last edited by

                                          Hi guys,

                                          I don’t know if the module is still maintained. But I have just implemented it. I have got the credentiels. I have put the code in the config.js file. It works fine but I have no datas refresh and an error in the log :

                                          /home/pi/.pm2/logs/mm-error.log last 15 lines:
                                          0|mm | [2020-05-10 13:41:56.342] [ERROR] TypeError: PythonShell.run is not a function
                                          0|mm | at Class.setCreds (/home/pi/MagicMirror/modules/MMM-fitbit/node_helper.js:32:15)
                                          0|mm | at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-fitbit/node_helper.js:18:9)
                                          0|mm | at Socket. (/home/pi/MagicMirror/js/node_helper.js:113:11)
                                          0|mm | at Socket.emit (events.js:200:13)
                                          0|mm | at /home/pi/MagicMirror/node_modules/socket.io/lib/socket.js:528:12
                                          0|mm | at processTicksAndRejections (internal/process/task_queues.js:82:9)
                                          0|mm | [2020-05-10 13:41:56.380] [ERROR] TypeError: PythonShell is not a constructor
                                          0|mm | at Class.getData (/home/pi/MagicMirror/modules/MMM-fitbit/node_helper.js:43:25)
                                          0|mm | at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-fitbit/node_helper.js:22:9)
                                          0|mm | at Socket. (/home/pi/MagicMirror/js/node_helper.js:113:11)
                                          0|mm | at Socket.emit (events.js:200:13)
                                          0|mm | at /home/pi/MagicMirror/node_modules/socket.io/lib/socket.js:528:12
                                          0|mm | at processTicksAndRejections (internal/process/task_queues.js:82:9)
                                          .
                                          .
                                          .
                                          0|mm | [2020-05-10 13:43:43.317] [LOG]
                                          0|mm | Set credential request recieved.
                                          0|mm | [2020-05-10 13:43:43.318] [LOG]
                                          0|mm | {
                                          0|mm | client_id: '22BR8T',
                                          0|mm | client_secret: '51313d185cxxxxxxxxxxxxxxxxd141c99'
                                          0|mm | }
                                          0|mm | [2020-05-10 13:43:43.329] [LOG]
                                          0|mm | Whoops! There was an uncaught exception...
                                          0|mm | [2020-05-10 13:43:43.330] [ERROR] TypeError: PythonShell.run is not a function
                                          0|mm | at Class.setCreds (/home/pi/MagicMirror/modules/MMM-fitbit/node_helper.js:32:15)
                                          0|mm | at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-fitbit/node_helper.js:18:9)
                                          0|mm | at Socket. (/home/pi/MagicMirror/js/node_helper.js:113:11)
                                          0|mm | at Socket.emit (events.js:200:13)
                                          0|mm | at /home/pi/MagicMirror/node_modules/socket.io/lib/socket.js:528:12
                                          0|mm | at processTicksAndRejections (internal/process/task_queues.js:82:9)
                                          0|mm | [2020-05-10 13:43:43.334] [LOG] MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
                                          0|mm | [2020-05-10 13:43:43.335] [LOG] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
                                          0|mm | [2020-05-10 13:43:43.336] [LOG] Initial run request recieved.
                                          0|mm | [2020-05-10 13:43:43.338] [LOG] Running getData.py
                                          0|mm | [2020-05-10 13:43:43.339] [LOG] Whoops! There was an uncaught exception...
                                          0|mm | [2020-05-10 13:43:43.342] [LOG] MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
                                          0|mm | [2020-05-10 13:43:43.342] [LOG] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
                                          0|mm | [2020-05-10 13:43:43.344] [LOG] [NewPIR] Initialize...
                                          0|mm | [2020-05-10 13:43:43.340] [ERROR] TypeError: PythonShell is not a constructor
                                          0|mm | at Class.getData (/home/pi/MagicMirror/modules/MMM-fitbit/node_helper.js:43:25)
                                          0|mm | at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-fitbit/node_helper.js:22:9)
                                          0|mm | at Socket. (/home/pi/MagicMirror/js/node_helper.js:113:11)
                                          0|mm | at Socket.emit (events.js:200:13)
                                          0|mm | at /home/pi/MagicMirror/node_modules/socket.io/lib/socket.js:528:12
                                          0|mm | at processTicksAndRejections (internal/process/task_queues.js:82:9)
                                          

                                          Do someone has any idea of that error ?

                                          StoffbeuteluweS 1 Reply Last reply Reply Quote 0
                                          • StoffbeuteluweS Offline
                                            Stoffbeuteluwe Project Sponsor @Arno-Strasbourg
                                            last edited by

                                            @Arno-Strasbourg Hey, please install MMM-Fitbit2 that works perfect.:thumbs_up_medium-light_skin_tone:

                                            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
                                            • 6 / 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