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.

    MMM-Fitbit2

    Scheduled Pinned Locked Moved Health
    fitbithealthfitnesshealthywaterfoodtrackingactivity tracker
    98 Posts 21 Posters 113.5k Views 19 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 Away
      sdetweil @Meidlmarkus
      last edited by

      @Meidlmarkus yeh, can’t help on the auth part

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      MeidlmarkusM 1 Reply Last reply Reply Quote 0
      • MeidlmarkusM Offline
        Meidlmarkus @sdetweil
        last edited by

        @sdetweil yeah, so I renamed MMM-Fitbit2, cloned fresh.
        In the package.json there is no such a line that you mentioned (I guess @Vizulize must have fixed it already)
        Did npm init, then ./init seemingly went through.
        With ./auth.sh same thing as before - no dialog showing up.

        I hope @Vizulize sees it and helps out :-)

        Thanks
        Markus

        S 1 Reply Last reply Reply Quote 0
        • S Away
          sdetweil @Meidlmarkus
          last edited by

          @Meidlmarkus I just checked again
          https://github.com/m-roberts/MMM-Fitbit2

          still has those lines

          don’t see another author choice in google search

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • MeidlmarkusM Offline
            Meidlmarkus
            last edited by

            Yes, right.
            Must have looked into the package.json after doing the npm init - my bad. Did another git clone and it is as you said.

            Meanwhile it turned out I had pip not installed. After installing pip and running ./init.sh again (after npm init) libraries were installed, and also auth.sh was able to start (only saw it when I called the python script directly rather than from auth.sh)

            So auth.sh was now able to “Open a Web browser” (at least according to its logs), I just don’t see any dialog.

            Anyway, will now try init with the modified package.json and see if it makes a difference - will report back.
            Thanks so far
            Markus

            1 Reply Last reply Reply Quote 0
            • MeidlmarkusM Offline
              Meidlmarkus
              last edited by

              So, quick update:
              I tried inist.sh with the modified package.json
              The result was just the same - I don’t see any input dialog open.

              I believe the module is installed properly and the dependencies are ok.
              Thanks
              Markus

              V 1 Reply Last reply Reply Quote 0
              • V Offline
                Vizulize Module Developer @Meidlmarkus
                last edited by

                @Meidlmarkus It’s been a while since I worked on this. From memory, doing this over SSH has extra complexity (probably to do with the DISPLAY environment variable). Honestly, I’ve wanted to rework this to be headless for a while but haven’t had the capacity to do so.

                My advice would be to try and run it locally if possible.

                Also if anyone can verify that the modification to package.json is a fix, then I will merge this in: https://github.com/m-roberts/MMM-Fitbit2/pull/10/files

                1 Reply Last reply Reply Quote 0
                • MeidlmarkusM Offline
                  Meidlmarkus
                  last edited by Meidlmarkus

                  @Vizulize thanks a lot!
                  In the meantime I came a little further.

                  So about the package.json: Yes, can confirm, @sdetweil 's solution works perfectly.
                  I did go the other route: after the git clone, I did an npm init, this resolved the prob in the package.json and package-lock.json - this worked, too.
                  My next problem was when calling the init.sh, I found out I had no pip installed, so the required libraries could not be installed.
                  So I installed pip, then init.sh ran fine and installed what was required.

                  I also came to the conclusion that the oauth authentification would probably work better locally rather than over ssh.
                  So I ran auth.sh, was told that server was now listening on http://127.0.01/8888 - which was also what I entered when registering the app at fitbit. Looked good so far.

                  No browser was opened though. So restarted MM with an invalid config.js, hooked up a keyboard/mouse on the mirror-raspberry locally and opened electron from a local terminal like so:
                  /home/pi/MagicMirror/node_modules/electron/dist/electron http://localhost:8888
                  That’s when the serverside reported

                  127.0.0.1 - - [04/Dec/2023:20:19:56] "GET / HTTP/1.1" 404 2019 "" "Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.5845.228 Electron/26.6.2 Safari/537.36"
                  

                  So, 404.
                  On the electron window, this was shown:

                  Traceback (most recent call last):
                    File "C:\ProgramData\Anaconda3\lib\site-packages\cherrypy\_cpdispatch.py", line 54, in __call__
                      return self.callable(*self.args, **self.kwargs)
                  TypeError: index() missing 1 required positional argument: 'state'
                  
                  During handling of the above exception, another exception occurred:
                  
                  Traceback (most recent call last):
                    File "C:\ProgramData\Anaconda3\lib\site-packages\cherrypy\_cprequest.py", line 628, in respond
                      self._do_respond(path_info)
                    File "C:\ProgramData\Anaconda3\lib\site-packages\cherrypy\_cprequest.py", line 687, in _do_respond
                      response.body = self.handler()
                    File "C:\ProgramData\Anaconda3\lib\site-packages\cherrypy\lib\encoding.py", line 219, in __call__
                      self.body = self.oldhandler(*args, **kwargs)
                    File "C:\ProgramData\Anaconda3\lib\site-packages\cherrypy\_cpdispatch.py", line 60, in __call__
                      raise sys.exc_info()[1]
                    File "C:\ProgramData\Anaconda3\lib\site-packages\cherrypy\_cpdispatch.py", line 58, in __call__
                      test_callable_spec(self.callable, self.args, self.kwargs)
                    File "C:\ProgramData\Anaconda3\lib\site-packages\cherrypy\_cpdispatch.py", line 157, in test_callable_spec
                      raise cherrypy.HTTPError(404, message=message)
                  cherrypy._cperror.HTTPError: (404, 'Missing parameters: state')
                  
                  

                  Pls note: this is not exactly my error, looks like this is coming from a windows machine:
                  This came up as the first result when entering “missing parameters state” in the google search. But it is close enough to my error (just replace C:\ProgramData… with home/pi/.local/lib/python3.7… - I could not be bothered to type it all off of my mirror :-D )
                  There was no solution given, though, so that is where I am stuck now…

                  Thanks again for your help,
                  Markus

                  1 Reply Last reply Reply Quote 0
                  • MeidlmarkusM Offline
                    Meidlmarkus
                    last edited by

                    Plus: I learned that the callback page needs to be called exactly as specified, so I tried also with http://127.0.0.1:8888/

                    with ending slash, without, even with https - all to no avail.

                    Thanks again
                    Markus

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