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.9k 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 @sdetweil
      last edited by

      @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 Reply Quote 0
      • S Offline
        sdetweil @philie
        last edited by

        @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 Reply Quote 0
        • P Offline
          philie @sdetweil
          last edited by

          @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 Reply Quote 0
          • S Offline
            sdetweil @philie
            last edited by sdetweil

            @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 Reply Quote 0
            • P Offline
              philie @sdetweil
              last edited by

              @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 Reply Quote 0
              • S Offline
                sdetweil @philie
                last edited by sdetweil

                @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 Reply Quote 0
                • P Offline
                  philie @sdetweil
                  last edited by

                  @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 Reply Quote 0
                  • S Offline
                    sdetweil @philie
                    last edited by

                    @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 Reply Quote 0
                    • P Offline
                      philie @sdetweil
                      last edited by

                      @sdetweil As mentioned, I have now also switched to a Raspbery Pi 3, installed MM cleanly using your script and then changed the openweathermap API onecall to 3.0 in the MMM-BMW-OW module, executed npm install request in the module folder, and now the module is running. Thank you very much for your support

                      S 1 Reply Last reply Reply Quote 0
                      • S Offline
                        sdetweil @philie
                        last edited by

                        @philie awesome… thanks for the feedback

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

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