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

Module not showing up

Scheduled Pinned Locked Moved Unsolved Troubleshooting
16 Posts 2 Posters 3.0k 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.
  • B Offline
    basho429
    last edited by basho429 Dec 15, 2022, 4:58 PM Dec 15, 2022, 4:34 PM

    Here is my module config:

    {
      module: "MMM-OpenWeatherMapForecast",
      header: "MY CITY",
      position: "top_right",
      classes: "default everyone",
      disabled: false,
      config: {
        apikey: "MY OWN APIKEY",
        latitude: "MY LATITUDE",
        longitude: "MY LONGITUDE",      
        iconset: "4c",
        concise: false,
        forecastLayout: "table"
      }
    },
    
    S 1 Reply Last reply Dec 15, 2022, 4:37 PM Reply Quote 1
    • S Away
      sdetweil @basho429
      last edited by Dec 15, 2022, 4:36 PM

      @basho429 edit the module node_helper.js and change this

                          if (!error && response.statusCode == 200) {
      
                              //Good response
                              var resp = body; //needle automagically parses the response as JSON
                              resp.instanceId = payload.instanceId;
                              self.sendSocketNotification("OPENWEATHER_ONE_CALL_FORECAST_DATA", resp);
      
                          } else {
                              console.log("[MMM-OpenWeatherMapForecast] " + moment().format("D-MMM-YY HH:mm") + " ** ERROR ** " + error);
                          }
      

      to this

                          if (!error){
                              // Good response
                              if(response.statusCode == 200) {
      
                                  var resp = body; //needle automagically parses the response as JSON
                                  resp.instanceId = payload.instanceId;
                                  console.log(" needle responding="+JSON.stringify(resp))
                                  self.sendSocketNotification("OPENWEATHER_ONE_CALL_FORECAST_DATA", resp);
                              }
                              else {
                                  console.log("[MMM-OpenWeatherMapForecast] " + moment().format("D-MMM-YY HH:mm") + " ** bad status ** " + response.statusCode);
                              }
      
                          } else {
                              console.log("[MMM-OpenWeatherMapForecast] " + moment().format("D-MMM-YY HH:mm") + " ** ERROR ** " + error);
                          }
      

      then restart MagicMirror, and look at the messages again

      at least u will get a good error report

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      1 Reply Last reply Reply Quote 0
      • S Away
        sdetweil @basho429
        last edited by Dec 15, 2022, 4:37 PM

        @basho429 on your config…

        please always use the code block marker for config info.

        paste your text
        select it all
        hit the button above the editor that looks like </>

        u can edit the existing post and change it

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        B 1 Reply Last reply Dec 15, 2022, 5:02 PM Reply Quote 0
        • B Offline
          basho429 @sdetweil
          last edited by Dec 15, 2022, 5:02 PM

          @sdetweil

          I changed the module node_helper.js and restarted MagicMirror. However, I am still not getting any new error message. It’s still the same NULL error. Can you please check below and see if I changed it properly? Thank you.

          /* Magic Mirror
           * Module: MMM-BMW-OW
           *
           * By Mykle1
           *
           * MIT Licensed
           */
          const NodeHelper = require('node_helper');
          const request = require('request');
          
          
          
          module.exports = NodeHelper.create({
          
              start: function() {
                  console.log("Starting node_helper for: " + this.name);
              },
          
              getWeather: function(url) {
                  request({
                      url: 'https://api.openweathermap.org/data/2.5/onecall?lat=' + this.config.lat + '&lon=' + this.config.lon + '&units=' + this.config.units + '&lang=' + this.config.language + '&appid=' + this.config.api,
                      method: 'GET'
                  }, (error, response, body) => {
                      if (!error){
                                  // Good response
                                  if(response.statusCode == 200) {
          
                                      var resp = body; //needle automagically parses the response as JSON
                                      resp.instanceId = payload.instanceId;
                                      console.log(" needle responding="+JSON.stringify(resp))
                                      self.sendSocketNotification("OPENWEATHER_ONE_CALL_FORECAST_DATA", resp);
                                  }
                                  else {
                                      console.log("[MMM-OpenWeatherMapForecast] " + moment().format("D-MMM-YY HH:mm") + " ** bad status ** " + response.statusCode);
                                 		}
          
                              	} 
                      	}
                  	});
              	},
          
              socketNotificationReceived: function(notification, payload) {
                  if (notification === 'GET_WEATHER') {
                      this.getWeather(payload);
                  }
                  if (notification === 'CONFIG') {
                      this.config = payload;
                  }
              }
          });
          
          S 1 Reply Last reply Dec 15, 2022, 5:03 PM Reply Quote 0
          • S Away
            sdetweil @basho429
            last edited by Dec 15, 2022, 5:03 PM

            @basho429 that is not the changed new code… that is the old code

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            B 1 Reply Last reply Dec 15, 2022, 5:07 PM Reply Quote 0
            • B Offline
              basho429 @sdetweil
              last edited by Dec 15, 2022, 5:07 PM

              @sdetweil

              Below is the complete module node_helper,js that came with the module. Can you please send me back what it should contain to get more info about the error? Thank you.

              /* Magic Mirror
               * Module: MMM-BMW-OW
               *
               * By Mykle1
               *
               * MIT Licensed
               */
              const NodeHelper = require('node_helper');
              const request = require('request');
              
              
              
              module.exports = NodeHelper.create({
              
                  start: function() {
                      console.log("Starting node_helper for: " + this.name);
                  },
              
                  getWeather: function(url) {
                      request({
                          url: 'https://api.openweathermap.org/data/2.5/onecall?lat=' + this.config.lat + '&lon=' + this.config.lon + '&units=' + this.config.units + '&lang=' + this.config.language + '&appid=' + this.config.api,
                          method: 'GET'
                      }, (error, response, body) => {
                          if (!error && response.statusCode == 200) {
                              var result = JSON.parse(body);
                              //	console.log(body); // for checking
                              this.sendSocketNotification('WEATHER_RESULT', result);
                          }
                      });
                  },
              
                  socketNotificationReceived: function(notification, payload) {
                      if (notification === 'GET_WEATHER') {
                          this.getWeather(payload);
                      }
                      if (notification === 'CONFIG') {
                          this.config = payload;
                      }
                  }
              });
              
              S 1 Reply Last reply Dec 15, 2022, 5:11 PM Reply Quote 0
              • S Away
                sdetweil @basho429
                last edited by Dec 15, 2022, 5:11 PM

                @basho429 ok, we are talking different modules now

                that is the MMM-BMW-OW module

                to get its helper back, in that module folder do

                git checkout node_helper.js
                

                my code goes in the node_helper.js for MMM-OpenWeatherMapForecast module only

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                B 1 Reply Last reply Dec 15, 2022, 5:19 PM Reply Quote 0
                • B Offline
                  basho429 @sdetweil
                  last edited by Dec 15, 2022, 5:19 PM

                  @sdetweil

                  Apologies for the mix-up. Noob mistake. I was looking at the wrong node_helper.js. I changed the correct node_helper.js and got an error message that says ** bad status ** 401. What does that mean? Thank you.

                  S 1 Reply Last reply Dec 15, 2022, 5:20 PM Reply Quote 0
                  • S Away
                    sdetweil @basho429
                    last edited by sdetweil Dec 15, 2022, 5:26 PM Dec 15, 2022, 5:20 PM

                    @basho429 401 is authorization error… so your api_key is not good…

                    we had to make a change in the default module that uses openweathermap
                    try changing this

                    "https://api.openweathermap.org/data/2.5/onecall"
                    

                    to this

                    "https://api.openweathermap.org/data/3.0/onecall"
                    

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    B 1 Reply Last reply Dec 15, 2022, 5:32 PM Reply Quote 0
                    • B Offline
                      basho429 @sdetweil
                      last edited by Dec 15, 2022, 5:32 PM

                      @sdetweil

                      I am using the same api key for the default weather module that came with MagicMirror (and it works fine). Does that mean I need separate api keys for separate modules? Or I can only use one weather module at a time?

                      I made the change from 2.5 to 3.0 on the node_helper.js.

                      Thank you.

                      S 1 Reply Last reply Dec 15, 2022, 5:36 PM Reply Quote 0
                      • 1
                      • 2
                      • 1 / 2
                      1 / 2
                      • First post
                        8/16
                        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