Read the statement by Michael Teeuw here.
Module not showing up
-
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; } } });
-
@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
-
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.
-
@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"
-
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.
-
@basho429 did the change make a difference?
I do not know otherwise
-
I created a new api key but I am still getting a 401 error.
I will remove the module and re-install. Maybe that will work.
Any suggestions?
Thank you.
-
@basho429 reinstalling the module won’t help