Read the statement by Michael Teeuw here.
[DEBUG] Default Weather Module with OpenWeatherMap One Call API
-
Hey all, I’m trying to get a basic implementation of OpenWeatherMap’s One Call API working inside the default Weather module, mainly so I can get hourly weather data, but I’m running into some problems.
Files with changes inside the
modules/default/weather/directory:- weather.js
- weatherprovider.js
- providers/openweathermap.js
- wdatahourly.njk (renamed from wdataHourly.njk, Windows is being stupid)
Sample Module Configuration: (all included config parameters are required for the moment)
module: "weather", position: "bottom_center", header: "Hourly Forecast", config: { weatherProvider: "openweathermap", type: "wDataHourly", // wDataCurrent and wDataDaily theoretically work but currently don't have .njk files apiKey: "OPENWEATHERMAPAPIKEY", // your OpenWeatherMap API key lat: 40.7128, // your latitude lon: -74.0060, // your longitude weatherEndpoint: "/onecall", maxNumberOfEntries: 12 }The module just stays at “Loading …” indefinitely. The console tab in the menu that shows up after I hit Ctrl+Shift+I doesn’t report any errors or warnings, so I’m not sure what’s causing the readings to not show up.
Any advice is appreciated since I haven’t worked too much with in the past with JavaScript, Node.js, etc. so I’m not sure what the proper way to troubleshoot problems is.
*edit: The module seems to be loaded just fine and the weather provider gets initialized as expected. Still not sure what the problem could be.


-
minor correction, the
maxNumberOfEntriesconfig parameter is wrong, it should bemaxEntriesinstead:module: "weather", position: "bottom_center", header: "Hourly Forecast", config: { weatherProvider: "openweathermap", type: "wDataHourly", // wDataCurrent and wDataDaily theoretically work but currently don't have .njk files apiKey: "OPENWEATHERMAPAPIKEY", // your OpenWeatherMap API key lat: 40.7128, // your latitude lon: -74.0060, // your longitude weatherEndpoint: "/onecall", maxEntries: 12 } -
Got it working! I think I’ll just avoid dot notation from now on…
Repo is linked below. If anyone’s looking to use this, OpenWeatherMap’s One Call API asks for latitude and longitude instead of a location or location ID. But in return, you can get not only current and daily (max 7 days) forecasts, but also hourly forecasts (max 48 hours).
All original functionality of the module should remain intact.
Sample Module Configurations:
{ module: "weather", position: "bottom_left", header: "Current Forecast", config: { weatherProvider: "openweathermap", weatherEndpoint: "/onecall", type: "wDataCurrent", apiKey: "OPENWEATHERMAPAPIKEY", // your OpenWeatherMap API key initialLoadDelay: 0, lat: 40.7128, // your latitude lon: -74.0060, // your longitude } }, { module: "weather", position: "bottom_center", header: "Hourly Forecast", config: { weatherProvider: "openweathermap", weatherEndpoint: "/onecall", type: "wDataHourly", apiKey: "OPENWEATHERMAPAPIKEY", // your OpenWeatherMap API key initialLoadDelay: 2500, lat: 40.7128, // your latitude lon: -74.0060, // your longitude maxEntries: 32, // max 48, set by OWM One Call API showPrecipitationAmount: true } }, { module: "weather", position: "bottom_right", header: "Daily Forecast", config: { weatherProvider: "openweathermap", weatherEndpoint: "/onecall", type: "wDataDaily", apiKey: "OPENWEATHERMAPAPIKEY", // your OpenWeatherMap API key initialLoadDelay: 5000, lat: 40.7128, // your latitude lon: -74.0060, // your longitude maxEntries: 7, // max 7, set by OWM One Call API colored: true, showPrecipitationAmount: true } }Sample MagicMirror Output:

Not making a pull request yet since I don’t know how the default Weather module is meant to be designed.
-
Hey @lost,
thanks for creating this. I am currently building my first mirror and have issues with the weather module from the master (only showing “Loading”) and hence wanted to try yours, as I am looking for hourly data anyways.
However, I am a total noob to git and stuff, so I don’t know how to install your branch. Could you help me out here? Much appreciated in advance.
-
Hi,
Thanks for your work, ive tried using your config above and have run into two issues.
{
module: “weather”,
position: “bottom_left”,
header: “Current Forecast”,
config: {
weatherProvider: “openweathermap”,
weatherEndpoint: “/onecall”,
type: “wDataCurrent”,
apiKey: “xxxxxxx”, // your OpenWeatherMap API key
initialLoadDelay: 0,
lat: 40.7128, // your latitude
lon: -74.0060, // your longitude
}
},-
using the type: “wDataCurrent” results in “UNDEFINED”
however if I change variable to Current, I then run into issue 2. -
loading. Similar to your original post, my screen remains forever loading and doesn’t load the retrieved values.
any other thoughts or tips & tricks on how to resolve?
-
-
i had the same problem and changed type: “wDataCurrent”, to type: “current”, because in the folder /home/pi/MagicMirror/modules/default/weather i found the files
current.njk
hourly.njk
forecast.njknow is runs
-
This post is deleted!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login