Skip to main content

Air quality Norway smart home integration, free and open source

Air quality Norway integration for Gladys Assistant

Air quality forecast of MET Norway for your home or a station: index, pollutants, next 24 hours.

What it does​

This integration brings the air quality forecast of MET Norway, the Norwegian Meteorological Institute, into Gladys: the Norwegian air quality index and the pollutants it is made of, for the hour that is now and the next 24 hours. The model is the official Norwegian one (the same as the luftkvalitet.info map), down to the neighbourhood.

  • One device per place: each house of Gladys located in Norway, and the measuring stations you add.
  • Scene triggers: air quality degraded now, degradation forecast within 24 hours, back to normal.
  • A scene action giving the air quality of a place, with a sentence ready for a notification.
  • A dashboard widget: the pollutants, the level now and over the next 24 hours.

Read only, through the open API of MET Norway (api.met.no): no account, no key. Not affiliated with MET Norway.

Requirements​

  • Gladys Assistant 5.2.0 or later.
  • A house located in Norway (Settings → Houses → location), or the code of a Norwegian measuring station. MET Norway has no air quality forecast elsewhere.
  • Internet access to api.met.no.

Configuration​

FieldWhat to enter
Area around a houseThe area whose forecast a house gets: its neighbourhood (grunnkrets, the default, the finest), its district (delområde) or its municipality (kommune).
StationsOptional. Codes of measuring stations to follow too, separated by commas (10 at most), for example NO0057A. The Find a station button gives them, by name or around a house, with their distance.
LanguageLanguage of the feature names (set when a device is added) and of the scene texts. French by default.

Every house with a location becomes a device in the Discovery tab, if it is in Norway. A house outside Norway is left out, and said in the status of the Configuration screen when no place is left.

The Check the places button reads every place now and tells what MET Norway forecasts: the level, and the worst level of the next 24 hours.

Devices​

Each place (house or station) gives one device, named MET Norway <house or station>, with:

FeatureMeaning
Air quality indexThe Norwegian index for the hour that is now: below 2 low, 2 to 3 moderate, 3 to 4 high, 4 and more very high.
Air qualityIts level as a word: Low, Moderate, High, Very high.
PM2.5, PM10, NO₂, O₃The forecast concentrations, in µg/m³.
Highest index, next 24 hThe worst hour from now to 24 hours ahead.
Air quality, next 24 hIts level as a word.

The index is shown with one decimal, never rounded up across a level boundary (1.96 is "Low" and shows 1.9). The overall index is the highest of the pollutants' ones.

MET Norway updates the forecast a few times a day. The integration reads each place once an hour, with a conditional request (nothing is downloaded when the forecast did not change), and moves to the next hour on its own.

Widget​

Air quality Norway: with a place chosen in its settings, four tiles (PM2.5, PM10, NO₂, O₃) that follow the device, the level now and the worst level of the next 24 hours with its hour, colored green (low), orange (moderate) or red (high, very high). Without a place: one row per added place, its level now.

Scenes​

Triggers​

  • Norway air: air quality degraded: the level of a place now rises to "Moderate" or worse, or gets worse again. Filters: the place, the new levels (tick from your threshold up). Variables: place name, level, index, previous level, pollutant setting the index, summary.
  • Norway air: degradation forecast: the worst level of the next 24 hours rises to "Moderate" or worse, or gets worse again. Filters: the place, the forecast levels. Variables: the same, plus the hour of the peak and the hours until it.
  • Norway air: back to normal: the level comes back to "Low" after a degradation. Filters: the place, the worst level reached. Variables: place name, level, index, worst level, summary.

The first evaluation after the installation only sets the starting levels: nothing fires. A restart fires nothing again.

Action​

Norway air: get the air quality: of one place, or of the place with the worst index. Outputs: summary (for example MET Norway Hjemme: Low (1.6) · PM2.5 2.8 µg/m³ · … · Next 24 h: Moderate at 17:00), place name, level, index, pollutant, the four concentrations, the worst level, index and hour of the next 24 hours.

Scene examples​

  • Warn before it gets bad: trigger "degradation forecast", levels High and Very high → send a message "Air quality {{triggerEvent.data.level_label}} expected at {{triggerEvent.data.time}} near {{triggerEvent.data.place_name}}".
  • Close the windows: trigger "air quality degraded", level Moderate and worse → notify, or turn the ventilation down; trigger "back to normal" → turn it back up.
  • Morning briefing: at 7:00, action "get the air quality" → send its summary with the weather.

Troubleshooting​

  • No device in Discovery: the house has no location, or is outside Norway (see the status of the Configuration screen and the Check the places button). Set the location in Settings → Houses.
  • "not a MET Norway station": the code is not in the station list. Use Find a station; codes are case-sensitive for a few local stations (Loallme).
  • "MET Norway does not answer": the API is unreachable; the values of the forecast already read keep being published while it covers the hour.
  • More details: the Logs tab of the integration (LOG_LEVEL=debug for every request).

Limits​

  • A forecast, not a measurement, from a model at the scale of the neighbourhood: a station device gives the forecast at the station, not what it measures.
  • Norway only. The index is the Norwegian one, not the European one.
  • Terms of MET Norway: an identifying User-Agent, normally one request per place per hour, never before the Expires of the previous answer, longer waits after a failure, and a pause on HTTP 429. Data © MET Norway, under the CC BY 4.0 licence (terms).

Configuration settings​

These are the settings Air quality Norway asks for in its configuration screen in Gladys.

SettingTypeRequiredDescription
Air quality forecast in NorwaysectionNoReads the air quality forecast of MET Norway, the Norwegian Meteorological Institute, through its open API (no account). Each house of Gladys located in Norway becomes a device; stations can be added. Not affiliated with MET Norway.
Area around a houseselectNoThe forecast of a house is the one of the area it lies in. Changing it reads the houses again.
StationsstringNoOptional: the codes of measuring stations to follow too, separated by commas (10 at most). The "Find a station" button below gives them.
LanguageselectNoLanguage of the feature names (set when a device is added) and of the scene texts.

How to install Air quality Norway in Gladys​

  1. In Gladys, open Integrations: Air quality Norway appears in the catalog, next to the native integrations, with a community badge.
  2. Click Install. Gladys pulls the Docker image (ghcr.io/guim31/gladys-air-norway:1.0.0), starts it in a sandbox isolated from the core, and generates the integration's interface (devices, discovery and configuration).
  3. Open the Configuration screen of the integration, fill in the settings, and save.
  4. You can also install it directly from its repository URL: https://github.com/guim31/gladys-air-norway.

Air quality Norway requires Gladys >=5.2.0. The catalog inside Gladys refreshes every hour, so a new version becomes available at most one hour after its release.

Not running Gladys yet? It is free and open source: follow the installation guide to get started.

About external integrations​

Air quality Norway is an external integration: a community integration packaged as a Docker container and published on GitHub, that Gladys installs in one click and runs in a sandbox isolated from its core. It is published and maintained by guim31, not by the Gladys core team.

Subscribe to the Gladys Assistant newsletter

A few emails per month about new releases and project news. Sent by Pierre-Gilles Leymarie, founder of the project. Unsubscribe anytime 🙂