This is another weather module for MagicMirror². It is based somewhat around https://github.com/jharttech/MMM-weatherforecast and the default 'weather' app. This version has been edited to allow the days of the week to span left to right, each with its own weather icon and details.
The app uses data from the currently-free source of openweathermap.org, using their one-call API - https://openweathermap.org/api/one-call-api.
Since the original author of the module, Captsi, is no longer active, I forked the module. I fixed a few issues and will try to keep the module working in the future.
This module is in maintenance mode. So I'm not planning any functional changes. If someone wants to take over the further development, I would be happy. PR's are welcome too!
Typical view of weather
In your terminal, go to your MagicMirror's module folder:
cd ~/MagicMirror/modules
Clone this repository:
git clone https://github.com/KristjanESPERANTO/MMM-OneCallWeather
Install the dependencies:
cd MMM-OneCallWeather
npm ci
Go to https://openweathermap.org/api and subscribe to One Call API. Its free to set up an account, and the free subscription level is fine for this app. The API returns a lot of information and can return 1000 calls a day on the free subscription level (approx once every 2 minutes maximum). The API is good as it uses their algorithms to give ultra local weather reports, even if you don't live in a named location, which some other apps suffer with.
Go to https://www.latlong.net/ and figure out where you want the forecast for. There are plenty of ways of figuring out your location, and you just need a decimal format of your position. 52N 010W becomes 52.0 -10.0 on the two lines in your config.
Icons used in this module were created by:
VClouds Weather Icons Created and copyrighted by VClouds - http://vclouds.deviantart.com/
The icons are free to use for Non-Commercial use and can be found at icons DA page - http://vclouds.deviantart.com/gallery/#/d2ynulp
Note: You can use any of your own icons but you will have to rename them to the weather items shown on openweather. There are only 9 types of weather that the API currently shows (2021) and they are shown on https://openweathermap.org/weather-conditions. With some different icons for day and night you should have 18 icons in each folder, some of which will just be copies.
This module displays the weather forecast for the coming week, including an an icon to display the current conditions, the minimum temperature and the maximum temperature. The software is designed around a display in Celsius and miles per hour, but should work in a multitude of units. I found that the openweathermap information is a bit crude in that you cant have Farenheight and metres per second, or celsius and miles per hour, hence this code. Its a bit clunky.
To use this module, add it to the modules array in the config/config.js
file:
{
module: "MMM-OneCallWeather",
position: "top_right",
// Best results in bottom_bar region due to horizontal default layout and icon sizes.
config: {
latitude: "51.500149", // Longitude from https://www.latlong.net/
longitude: "-0.126240", // Longitude from https://www.latlong.net/ - is West + is East of London
apikey: "YOUR_API_KEY" // openweathermap.org API key
}
},
The following properties can be configured:
Option | Description |
---|---|
latitude |
The latitude of the location used for weather information. Example: '51.500149' Default value: false Value is REQUIRED |
longitude |
The longitude of the location used for weather information. Example: -0.126240 Note: - (minus sign) is West + (plus, or no minus sign) is East of the prime meridian in London. To find your location you can go to latlong.net, or use google maps. If no value is entered for either lat or long the module will not work. Value is REQUIRED |
apikey |
The OpenWeatherMap API key, which can be obtained by creating an OpenWeatherMap account. Value is REQUIRED |
apiVersion |
The OpenWeatherMap API version to use. Change it to "2.5" if you have an old apikey Default value: 3.0 |
units |
What units to use. Specified by config.js Possible values: config.units = Specified by config.js, default = Kelvin, metric = Celsius, imperial =Fahrenheit Default value: config.units |
roundTemp |
Round temperature values to nearest integer. Possible values: true (round to integer) or false (display exact value with decimal point) Default value: false |
layout |
Define whether layout should be horizontal or vertical. Specified by config.js Possible values: "horizontal" , "vertical" or "default" Default value: "default" This value is optional. By default the weatherforecast module display in a hybrid format. The vertical option is OK too. Some work still needs to be done on pretty formats. |
showRainAmount |
Should the predicted rain amount be displayed? Possible values: true or false Default value: false This value is optional. By default the weatherforecast module will not display the predicted amount of rain. |
updateInterval |
How often does the content needs to be fetched? (Milliseconds) Possible values: 1000 - 86400000 Default value: 600000 (10 minutes). The free subscription level currently allows a call every 2 minutes. |
animationSpeed |
Speed of the update animation. (Milliseconds) Possible values: 0 - 5000 Default value: 1000 (1 second) |
lang |
The language of the days. Possible values: en , nl , ru , etc ... Default value: uses value of config.language |
iconset |
The icon set to use. Possible values: 4a , 3c or any other folder of icons in the MMM-OneCallWeather/icons folder.Default value: 4a .` |
iconsetFormat |
The format of the symbols in the above iconset folders. The module can't parse the filetype of the icons so you have to tell it what type it is. MagicMirror is pretty flexible with image types. If you have some funky icons try them out Possible values: png , svg or any other image file type.Default value: png . |
decimalSymbol |
The decimal symbol to use. Possible values: . , , or any other symbol.Default value: . |
fade |
Fade the future events to black. (Gradient) Possible values: true or false Default value: true |
initialLoadDelay |
The initial delay before loading. If you have multiple modules that use the same API key, you might want to delay one of the requests. (Milliseconds) Possible values: 1000 - 5000 Default value: 2500 (2.5 seconds delay. This delay is used to keep the OpenWeather API happy.) |
appendLocationNameToHeader |
If set to true , the returned location name will be appended to the header of the module, if the header is enabled. This is mainly intresting when using calender based weather. Default value: true |
tableClass |
Name of the classes issued from main.css . Possible values: xsmall, small, medium, large, xlarge. Default value: small. |
colored |
If set 'colored' to true the min-temp get a blue tone and the max-temp get a red tone. Default value: true |
Go to the module’s folder inside MagicMirror modules folder and pull the latest version from GitHub and install:
cd ~/MagicMirror/modules/MMM-PublicTransportHafas
git pull
npm ci
If you find any problems, bugs or have questions, please open a GitHub issue in this repository.
Pull requests are of course also very welcome 🙂