Skip to content

A MagicMirror module that displays weather alerts (text based) from the Norwegian Meteorological Institute

License

Notifications You must be signed in to change notification settings

mabahj/MMM-Farevarsel

Repository files navigation

Module: MMM-Farevarsel

The MMM-Farevarsel module is a MagicMirror² addon. This module displays weather alerts (text based) from the Norwegian Meteorological Institute (https://api.met.no/). I used TuxDiver's MMM-Rest as a starting point for this module.

The alerts only cover Norwegian areas and are (therefore) only in Norwegian

Farevarsel Displays

Installation

Run the following commands

cd ~/MagicMirror/modules
git clone https://github.com/mabahj/MMM-Farevarsel
cd MMM-Farevarsel
npm install

Do not forget the "npm install" at the end - it fetches the required sub dependencies.

Changelog

  • 2024-09-10: Review: Remove deprecated dependency 'request' and little changes like formatting and typos. No functional changes.
  • 2024-09-09: Updated to 2.0 API, the previous was depreciated. Added user agent, as required by met.no. Added some county information in the README.md and improved information when it failed (server side error log).
  • 2019-11-11: First attempt at creating a (this) MagicMirror Module.

Known Issues

  • I am not a software developer. There are probably a lot of things that can fail. But it work just fine for me. PRs welcome. :)

Using the module

To use this module, add it to the modules array in the config/config.js file:

  {
    module: 'MMM-Farevarsel',
    position: 'top_bar',      // This can be any of the regions. I think.
    config: {
      county: '02',           // See below
      colorBackground: true,
    },
  },

Configuration options

The following properties can be configured. Non of these are required, but county is probably valuable to set unless you live in Oslo.

Option Default Description
county '03' The county (in Norway) to fetch weather alerts for. Two digits are required, so prefix with 0 if single digit. See https://data.norge.no/datasets/dd05acaa-1c89-4139-8612-0ad10e75d6a6 for a list of counties. Default is '03' for Oslo.
This field is a string, so it must be enclosed in quotation marks: E.g. '02' or “02”.
Code as of 2024-09-09Country (fylke)
03Oslo
11Rogaland
15Møre og Romsdal
18Nordland
30Viken
34Innlandet
38Vestfold og Telemark
42Agder
46Vestland
50Trøndelag
54Troms og Finnmark
colorBackground true Options: true or false
Show or do not show a background color matching the official alert level. Yellow, Orange or Red.
initialLoadDelay 1000 How long to wait for the first load

Example: 60000 (60 s)
animationSpeed 20000 Fadeover effect for dom updates

Example: 1000
url (Do not set this) Set to 'https://api.met.no/weatherapi/metalerts/2.0/test.rss' or 'https://api.met.no/weatherapi/metalerts/2.0/all.rss' for testing.

About

A MagicMirror module that displays weather alerts (text based) from the Norwegian Meteorological Institute

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published