Closed TangoE3O closed 1 year ago
Please show your config of the module (without apikey
).
Hello!
Below is my config.js
and my MMM-OneCallWeather.js
that I changed the
apiVersion: "2.5"
to apiVersion:3.0"
and finally some error codes present in the Developer Tools. I also reached out to some of the Magic Mirror Forums and we are unable to identify the reasons why this doesn't work.
This module does function with a 2.5 API key but not a 3.0 API key, which I just registered this week (March 2023). It should be mentioned that my API Key does work for the default weather module however, I've been unsuccessful to have OneCallWeather load correctly.
I can also send you my actual API key via private chat for you to try as well if you're interested to trouble shoot. If there is any additional information needed, please let me know.
Thanks in advance!
Config.js
module: "MMM-OneCallWeather",
position: "bottom_bar", // This can be any of the regions.
// Best results in bottom_bar region due to horizontal default layout and icon sizes.
config: {
// See 'Configuration options' for more information.
latitude: "28.53834", //Longitude from https://www.latlong.net/
longitude: "-81.379242", //Longitude from https://www.latlong.net/ - is West + is East of London
apikey: "66fXXXXXXXXXXXXXXXXXXXXXXXXXXXXa" //openweathermap.org API key.
}```
**MMM-OneCallWeather.js**
``` apiVersion: "3.0", /*default was "2.5" */
apiBase: "https://api.openweathermap.org/data/",
forecastEndpoint: "onecall",
calendarClass: "calendar",
tableClass: "small",
iconset: "4a",
iconsetFormat: "png",
Developer Tools Errors
When looking at the errors codes under npm start dev
, there are three as listed below
GET http://localhost:8080/css/icon/14.png 404 (Not Found)
GET http://localhost:8080/css/icon/26.png 404 (Not Found)
MMM-OneCallWeather.css:1
GET http://localhost:8080/css/icon/30.png 404 (Not Found)
Please don't edit files of the module.
You can set the apiVersion
in your config.js
. This example works for me:
{
module: "MMM-OneCallWeather",
position: "top_right", // This can be any of the regions.
// Best results in bottom_bar region due to horizontal default layout and icon sizes.
config: {
// See 'Configuration options' for more information.
latitude: "28.53834", //Longitude from https://www.latlong.net/
longitude: "-81.379242", //Longitude from https://www.latlong.net/ - is West + is East of London
apikey: "66fXXXXXXXXXXXXXXXXXXXXXXXXXXXXa", //openweathermap.org API key.
apiVersion: "3.0" /*default was "2.5" */
}
},
I modified my config.js
as you have shown with the working apikey and put the MMM-OneCallWeather.js
back to default showing the apiVersion: "2.5"
however, my MagicMirror is still showing "Loading".
I sent you a private message on MagicMirror Forum site with my actual API key. If you can get it to work using that key, please let me know what I'm doing wrong.
As mentioned, this picture shows the default weather module is working for me but not the OneCallWeather which shows "Loading" at the bottom.
Good idea. I didn't get it run with your key. But maybe this is a way for you: I've created a new key in my openweathermap settings: https://home.openweathermap.org/api_keys. With the new key and the onecall weatherEndpoint it worked:
{
module: "MMM-OneCallWeather",
position: "top_right",
config: {
latitude: "28.53834",
longitude: "-81.379242",
apikey: "################",
apiVersion: "3.0",
weatherEndpoint: "/onecall"
}
},
AH! I was so excited to try the new code and copied and pasted you had provided, with apikey of course, but it was a sad result, similar to opening presents as a kid on Christmas to only get socks :( It didn't work for me, even after double checking my copy and paste.
I also generated a new api key from OpenWeathermap.org and that worked for the default modules but again, not the OneCallWeather. Strange seeing as you just generated a new 3.0 key and it worked for you, so there must be something outside of the api key.
Do you get these errors?
Before I go down another rabbit hole, if you're able to try my api key to see if you get it to work, that would be extremely helpful. If it does work, then it's something other than my API and I'll have to come up with a game plan to do some digging or just reinstall MM. I have tried a variety of modules so maybe there is an old code buried somewhere even after I cleaned them up with rm - rf modules/MMM-"Other_Module_Attempts
.
Thanks again in advance.
Since I can't get your key to work, I sent you a test key via the forum. With that one it works for me.
I don't get these error messages.
I'm a little relieved that my key doesn't work for you but unfortunately, I tried the test key and it's the same outcome - "Loading". Over the weekend, I'm going to install a new Raspberry PI OS and Magic Mirror onto a separate SD with only installing OneCallWeather module and will use the test key. I'll let you know the results and for now, the journey continues...
{
module: "MMM-OneCallWeather",
position: "top_right",
config: {
latitude: "28.53834",
longitude: "-81.379242",
apikey: "################",
apiVersion: "3.0",
weatherEndpoint: "/onecall"
}
},
I took a closer look at the module and made some changes under the hood. Since Captsi is apparently no longer active, I recommend using my fork of the module: https://github.com/KristjanESPERANTO/MMM-OneCallWeather
However, this will not solve the problem with your key. Unfortunately it still doesn't work for me. And I have no idea what could be the cause of it.
Thank you again for looking into it and even after a fresh install of Magic Mirror, I was not able to get MMM-OneCallWeather
to work even using the test API. I did use the test API with MMM-OpenWeatherMapForecast
and it did work with the test API however, it did not work with my newly registered with OpenWeather keys.
Some good news is that the module MMM-weatherforecast
worked for all API keys and the default weather module still continues to work well. I still think the problem is related to API versions and the particular module of how it calls weather from OpenWeather.com. I'm uncertain of the root cause or how to fix it and will be using the default weather for now or until a new module becomes available.
@KristjanESPERANTO Thank you again and without your help & trial/error, it wouldn't have figured this out. While the solution is not for OneCallWeather, I think it might help for so I'm posting here. A quick update and I finally think I figured it out, at least for MMM-OpenWeatherForecast by:
node_helper.js
line 44 from 2.5 to 3.0 :
var url = https://api.openweathermap.org/data/3.0/onecall?"
@TangoE3O Have you already tried to have only the free plan of OpenWeatherMap and change only the node.js?
@mirrormonark - Yes and I did try that with multiple keys but it never worked even after updating the node.js.
@TangoE3O Nice! You found it 🎉 I didn't see that the apiVersion was hardcoded 🤦 So the value for apiVersion in the config file was useless. I just fixed it in my fork. Thanks!
in my node.js i see var myurl = https://api.openweathermap.org/data/2.5/onecall?"
VAR MYURL is wrong? i dont write this
probably the free plan is not for OneCall
@mirrormonark I recommend you to switch to my fork. I solved several problems of the module.
@KristjanESPERANTO i see and installed now.
@KristjanESPERANTO I deleted the module with the trash and installed yours. but it always says "loading"
Okay, since this is another problem, please create a new issue here: https://github.com/KristjanESPERANTO/MMM-OneCallWeather/issues
And show us there how you configured the module (without your key).
Hello Captsi - when attempting to use your module with an API 3.0 version, I was not able to get the module to work. This is after I changed the
apiversion
from 2.5 to 3.0.The default magic mirror module did return a weather report successfully however, I've struggled with multiple modules and my new API 3.0 key generated on March 2023. Do you have any thoughts on how a API 3.0 key will work?