Skip to main content

KNMI smart home integration, free and open source

KNMI integration for Gladys Assistant

Official Dutch weather (KNMI via Weerlive): observations, forecasts and KNMI warnings.

The official weather of the Netherlands in Gladys: the observations, forecasts and warnings of the KNMI (Koninklijk Nederlands Meteorologisch Instituut), read through the free Weerlive.nl API. Made for the Dutch living in France, for people near the Belgian–Dutch border, and for anyone with a house in the Netherlands.

Developed without a Weerlive account: feedback welcome. The integration is built and tested against real Weerlive answers (published by the python-weerlive and ha-knmi projects), not against the live service. Please report what works and what does not in the issues.

This integration is not affiliated with KNMI nor with Weerlive.

Presentation​

  • One device per place: a Gladys house (its location), Dutch towns or coordinates, five places at most.
  • Each device shows the temperature, the feels-like temperature, humidity, air pressure, wind (Beaufort, km/h and direction), visibility, the precipitation forecast for the coming hour, the conditions, sunrise and sunset, and the KNMI warning: its colour (green, yellow, orange, red), its title and text, and the next warning announced.
  • A scene trigger New KNMI warning, with the KNMI text ready for a notification.
  • A dashboard widget KNMI forecast: live values, warnings, sun and the 5-day forecast.
  • Read-only: nothing can be controlled.

Prerequisites​

  • Gladys Assistant 5.2.0 or later (house picker in the configuration, widgets, scene triggers).
  • A free Weerlive API key: fill in the form on weerlive.nl/delen.php with your email address; the key arrives by email. Weerlive reserves the free key for personal and hobby use.
  • Internet access for Gladys (the integration calls weerlive.nl).
  • The install screen asks for access to the location of your houses: it is only used for the house you pick in the configuration.

Configuration​

Open Integrations → KNMI → Configuration.

Weerlive API key​

Paste the key received by email. It is stored in the Gladys configuration, never in the logs.

Places​

  • Gladys house: follow the weather at the location of this house (set in Settings → Houses). The coordinates are sent to Weerlive rounded to two decimals, about 1 km.
  • Other places: Dutch towns (Amsterdam, 's-Hertogenbosch) or coordinates (52.09,5.12), separated by semicolons. Weerlive picks the nearest station: the Test the connection button tells you which place it found.
  • Five places at most, house included.

Then open the Discovery tab and add the devices you want: only the added devices are read.

Refresh and quota​

The free key allows 300 requests a day, and Weerlive refreshes its data every 10 minutes. The integration reads each added place every 10 minutes at most (the Refresh interval field), and slows down by itself with several places so that all of them stay under 240 requests a day: 12 minutes with two places, 18 with three, 30 with five. The last reading is kept in /data, so a restart of Gladys does not spend the quota again, and showing the widget never makes a request.

Language​

Language of the texts (French by default) names the features of new devices and writes the conditions and dates. Feature names are fixed when a device is added. The KNMI warning texts stay in Dutch, as the KNMI writes them.

Devices​

Every feature is read-only.

FeatureValue
Temperature, feels like°C
Humidity%
Air pressurehPa
Wind (Beaufort)0 to 12
Wind speedkm/h
Wind directiondegrees (0 = from the north, 90 = from the east)
Visibilitykm
Precipitation, coming hourmm forecast for the hour in progress
Conditionssunny, cloudy, showers… in the chosen language
Sunrise, sunsetlocal time of the Netherlands (same as France and Belgium)
KNMI warning level0 green, 1 yellow, 2 orange, 3 red
KNMI warning, texttitle and text of the KNMI, in Dutch
Weather alarm1 when Weerlive flags a weather alarm for the region
Next KNMI warning levelcolour of the next warning announced (0 when none)
Next KNMI warning fromits start, or "None"

Widget​

Add the KNMI forecast widget to a dashboard and pick a place. It shows the place and the current conditions, three live tiles (temperature, feels like, wind), the 5-day forecast (minimum and maximum, chance of rain, wind), the warning in force and the next one with their colours, sunrise and sunset, and the Dutch KNMI text when a warning is in force. It is built from the last reading: it costs no request.

Scene trigger​

New KNMI warning fires once per new warning:

  • In force now: a yellow, orange or red warning starts for the place, or another warning replaces it;
  • Announced for later: the KNMI announces a warning starting later, the first time this colour and start are seen.

Filters: the place, the colours, when. Variables for the actions: place, level (yellow, orange, red), level_number (1 to 3), phase (current, upcoming), title and text (in Dutch, for a warning in force), starts_at (ISO date). The first reading after the installation only records what is in force, and a restart never fires the same warning twice. The end of a warning is not an event: use the KNMI warning level feature (= 0).

Configuration action​

Test the connection reads the first place once (one request of the quota) and tells you whether the key is accepted, which place Weerlive found, how many requests are left today and the pace of the readings.

Scene examples​

  • Storm warning: trigger New KNMI warning, colours orange and red, In force now → send a message "KNMI {{triggerEvent.data.level}} warning: {{triggerEvent.data.title}}".
  • Close the awnings: trigger Device state on Wind (Beaufort) of your house, ≥ 6 → close the awnings or the shutters.
  • The night before: trigger New KNMI warning, Announced for later → a notification with starts_at, to bring the garden furniture in.

Troubleshooting​

  • "Weerlive refused the API key": check the key received by email, without spaces.
  • "Daily Weerlive limit reached": the readings resume after midnight, Dutch time. Fewer places or a longer interval help; the Test button also spends one request.
  • "Weerlive does not answer": an outage of the service or of the Internet access of Gladys. The readings resume by themselves.
  • No value on a device: check that the device was added in the Discovery tab.
  • Odd place: Weerlive takes the nearest station; type another town or coordinates.
  • More details: set LOG_LEVEL=debug on the container and read its logs.

Limits​

  • The data covers the Netherlands: a place far from it gets the nearest Dutch station, or nothing.
  • The warning texts are in Dutch, as the KNMI publishes them.
  • At most five places per key, and a reading every 10 minutes at best.
  • Weerlive says its free key is for personal and hobby use.
  • Developed without a Weerlive account, tested on real published answers.

Configuration settings​

These are the settings KNMI asks for in its configuration screen in Gladys.

SettingTypeRequiredDescription
Getting startedsectionNoThe weather comes from the KNMI through the Weerlive.nl API. Ask for a free API key on weerlive.nl (an email address is enough): it allows 300 requests a day, so each place is read every 10 minutes at most, slower with several places. Not affiliated with KNMI or Weerlive.
Weerlive API keysecretYesThe key received by email from weerlive.nl.
Gladys houseselectNoFollow the weather at the location of this house (sent to Weerlive rounded to about 1 km).
Other placesstringNoDutch towns or "latitude,longitude", separated by semicolons. Five places at most, house included.
Refresh intervalselectNoSlowed down automatically with several places, to stay within the 300 daily requests.
Language of the textsselectNoFeature names of new devices, conditions and dates. The KNMI warning texts stay in Dutch.

How to install KNMI in Gladys​

  1. In Gladys, open Integrations: KNMI 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-knmi:1.0.1), 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-knmi.

KNMI 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​

KNMI 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 🙂