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

MMM-BMW-OW API Issues

Scheduled Pinned Locked Moved Solved Troubleshooting
12 Posts 2 Posters 1.3k Views 2 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.
  • P Offline
    philie
    last edited by Jan 3, 2024, 3:49 PM

    Hi All
    My MMM-BMW.OW module does not get past “OpenWeather data…” when loading. I have configured everything as specified in the module’s readme. Troubleshooting on my part has revealed that the API endpoint at openweathermap.org may have changed.
    The endpoint should be as follows: api.openweathermap.org/data/2.5/weather?id=524901&appid=YOUR_API_KEY

    The API can therefore also be called up in a browser: http://api.openweathermap.org/data/2.5/weather?id=524901&lat=46.9481&lon=7.4474&units=metric&appid=YOUR_API_KEY

    However, in the node_helper.js script of the module, the API is specified as follows: https://api.openweathermap.org/data/2.5/onecall?lat= + config.

    I call up this endpoint in a browser: https://api.openweathermap.org/data/2.5/onecall?lat=46.9481&lon=7.4474&units=metric&appid=YOUR_API_KEY

    a 401 is returned.

    but the module does not run even if I replace the presumably broken endpoint in node_helper.js.

    Does anyone have more detailed information?
    Many thanks in advance
    philie

    S 1 Reply Last reply Jan 3, 2024, 3:53 PM Reply Quote 0
    • S Offline
      sdetweil @philie
      last edited by Jan 3, 2024, 10:33 PM

      @philie said in MMM-BMW-OW API Issues:

      Cannot find module ‘request’

      yes…

      starting 2 years ago we have been removing no longer supported, or needed libraries
      see https://forum.magicmirror.builders/topic/15778/fix-for-black-screen-in-2-16-and-later

      this documents the procedure for finding the missing library name and installing it in the module folder…

      many module authors didn’t know how to document dependencies, and well, it just worked…
      lots of modules haven’t been updated in a while, SO… we users ge to do the update OVER AND OVER…

      there are 8 missing libraries now I think…

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      P 1 Reply Last reply Jan 5, 2024, 2:41 PM Reply Quote 0
      • S Offline
        sdetweil @philie
        last edited by Jan 3, 2024, 3:53 PM

        @philie the onecall api is now v3.0 only (with newly create api keys)

        so change the URL to use 3.0 instead of 2.5

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        P 1 Reply Last reply Jan 3, 2024, 8:42 PM Reply Quote 0
        • P Offline
          philie @sdetweil
          last edited by Jan 3, 2024, 8:42 PM

          @sdetweil thank you very much for your quick response sam!
          I did therefore change the API in node_helper.js to

          https://api.openweathermap.org/data/3.0/onecall?lat=
          

          and registered a corresponding API key.
          API key pasted in config/config.js:

          {
                                  disabled: false,
                                  module: "MMM-BMW-OW",
                                  position: "bottom_bar", // designed for bottom_bar(best) thirds should be good too
                                  config: {
                                          api: "e9e02edummy/dummy/dummy/dummy0864", // Get at https://openweathermap.org/price
                                          ownTitle: "Current Conditions",
                                          lat: '43.574794', // Your latitude
                                          lon: '-77.112454', // Your longitude
                                          css: "2", // 1-6
                                          playSounds: "no",
                                          useHeader: false, // true if you want a header
                                          header: "Your header",
                                          maxWidth: "100%",
                                          updateInterval: 5 * 60 * 1000,
                                  }
          

          Like before, in a browser its working but unfortunately not in the module.
          I’ve grepped over the magicmirror root directory for the API url to see if it’s referred elsewhere, but it seems not.

          What do I miss?

          S 1 Reply Last reply Jan 3, 2024, 8:54 PM Reply Quote 0
          • S Offline
            sdetweil @philie
            last edited by Jan 3, 2024, 8:54 PM

            @philie can u edit the node_helper,js and add on this litle bit of code

                        if (!error && response.statusCode == 200) {
                            var result = JSON.parse(body);
                            //	console.log(body); // for checking
                            this.sendSocketNotification('WEATHER_RESULT', result);
                        } 
                        else if(error){      // -------- add these 3 lines
                            console.log("BMW-OW error = "+error.message)
                        }
            

            then restart MM and look at the output from npm start

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            P 1 Reply Last reply Jan 3, 2024, 9:07 PM Reply Quote 0
            • P Offline
              philie @sdetweil
              last edited by Jan 3, 2024, 9:07 PM

              @sdetweil

              root@magicmirror:/opt/magicmirror/modules# npm restart
              
              > magicmirror@2.26.0 restart
              > npm stop --if-present && npm start
              
              
              > magicmirror@2.26.0 start
              > DISPLAY="${DISPLAY:=:0}" ./node_modules/.bin/electron js/electron.js
              
              /opt/magicmirror/node_modules/electron/dist/electron: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
              

              This error did however already appear before the adjustement.
              I’ve uncommented even

              //	console.log(body); // for checking
              

              -> no logline. Quiet odd…

              S 1 Reply Last reply Jan 3, 2024, 9:10 PM Reply Quote 0
              • S Offline
                sdetweil @philie
                last edited by sdetweil Jan 3, 2024, 9:11 PM Jan 3, 2024, 9:10 PM

                @philie sudo apt install -y libnss3

                is this a new MM install? did you install with my script or manually?

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                P 1 Reply Last reply Jan 3, 2024, 9:33 PM Reply Quote 0
                • P Offline
                  philie @sdetweil
                  last edited by Jan 3, 2024, 9:33 PM

                  @sdetweil
                  there have been many libraries missing.
                  its the server version as LXC Container for proxmox. https://tteck.github.io/Proxmox/

                  I’ve deployed this for testing purposes. Guess I’m switching on propper Pi installation though!
                  Thank you very much for your help!

                  S 1 Reply Last reply Jan 3, 2024, 9:34 PM Reply Quote 0
                  • S Offline
                    sdetweil @philie
                    last edited by sdetweil Jan 3, 2024, 9:35 PM Jan 3, 2024, 9:34 PM

                    @philie but, if its the server version, you should be doing npm run server… server has no display… you will need to change the MM config to allow apps outside localhost(inside the lxc container) to connect to MM

                    then use a host browser to connect to http://container_ip_address:MM_port (8080 by default)

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    P 1 Reply Last reply Jan 3, 2024, 9:57 PM Reply Quote 0
                    • P Offline
                      philie @sdetweil
                      last edited by Jan 3, 2024, 9:57 PM

                      @sdetweil ahh ok I didn’t know there is a difference to restart… :(

                      however now we’re talking:
                      I could figure out and fix the error in the node_helper.js. Now its working and this is the output:

                      root@magicmirror:/opt/magicmirror# npm run server
                      
                      > magicmirror@2.26.0 server
                      > node ./serveronly
                      
                      [03.01.2024 22:54.21.808] [LOG]   Starting MagicMirror: v2.26.0
                      [03.01.2024 22:54.21.809] [LOG]   Loading config ...
                      [03.01.2024 22:54.21.809] [DEBUG] config template file not exists, no envsubst
                      [03.01.2024 22:54.21.810] [LOG]   Loading module helpers ...
                      [03.01.2024 22:54.21.811] [LOG]   No helper found for module: alert.
                      [03.01.2024 22:54.21.814] [LOG]   Initializing new module helper ...
                      [03.01.2024 22:54.21.814] [LOG]   Module helper loaded: updatenotification
                      [03.01.2024 22:54.21.814] [LOG]   No helper found for module: clock.
                      [03.01.2024 22:54.21.858] [LOG]   Initializing new module helper ...
                      [03.01.2024 22:54.21.858] [LOG]   Module helper loaded: calendar
                      [03.01.2024 22:54.21.858] [LOG]   No helper found for module: MMM-AareGuru.
                      [03.01.2024 22:54.21.859] [ERROR] Whoops! There was an uncaught exception...
                      [03.01.2024 22:54.21.861] [ERROR] Error: Cannot find module 'request'
                      Require stack:
                      - /opt/magicmirror/modules/MMM-BMW-OW/node_helper.js
                      - /opt/magicmirror/js/app.js
                      - /opt/magicmirror/serveronly/index.js
                          at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
                          at Module._resolveFilename (/opt/magicmirror/node_modules/module-alias/index.js:49:29)
                          at Module._load (node:internal/modules/cjs/loader:985:27)
                          at Module.require (node:internal/modules/cjs/loader:1235:19)
                          at require (node:internal/modules/helpers:176:18)
                          at Object.<anonymous> (/opt/magicmirror/modules/MMM-BMW-OW/node_helper.js:9:17)
                          at Module._compile (node:internal/modules/cjs/loader:1376:14)
                          at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
                          at Module.load (node:internal/modules/cjs/loader:1207:32)
                          at Module._load (node:internal/modules/cjs/loader:1023:12)
                          at Module.require (node:internal/modules/cjs/loader:1235:19)
                          at require (node:internal/modules/helpers:176:18)
                          at loadModule (/opt/magicmirror/js/app.js:181:19)
                          at loadModules (/opt/magicmirror/js/app.js:211:10)
                          at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
                          at async App.start (/opt/magicmirror/js/app.js:259:3) {
                        code: 'MODULE_NOT_FOUND',
                        requireStack: [
                          '/opt/magicmirror/modules/MMM-BMW-OW/node_helper.js',
                          '/opt/magicmirror/js/app.js',
                          '/opt/magicmirror/serveronly/index.js'
                        ]
                      }
                      [03.01.2024 22:54.21.861] [ERROR] MagicMirror² will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
                      [03.01.2024 22:54.21.861] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
                      root@magicmirror:/opt/magicmirror#
                      

                      Still no functional MMM-BMW-OW though.

                      S 1 Reply Last reply Jan 3, 2024, 10:33 PM Reply Quote 0
                      • S Offline
                        sdetweil @philie
                        last edited by Jan 3, 2024, 10:33 PM

                        @philie said in MMM-BMW-OW API Issues:

                        Cannot find module ‘request’

                        yes…

                        starting 2 years ago we have been removing no longer supported, or needed libraries
                        see https://forum.magicmirror.builders/topic/15778/fix-for-black-screen-in-2-16-and-later

                        this documents the procedure for finding the missing library name and installing it in the module folder…

                        many module authors didn’t know how to document dependencies, and well, it just worked…
                        lots of modules haven’t been updated in a while, SO… we users ge to do the update OVER AND OVER…

                        there are 8 missing libraries now I think…

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        P 1 Reply Last reply Jan 5, 2024, 2:41 PM Reply Quote 0
                        • 1
                        • 2
                        • 1 / 2
                        1 / 2
                        • First post
                          5/12
                          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