Toekomstbestendige KNMI Weerwaarschuwingen voor Domoticz (MQTT v5 + GeoJSON Polygonen)

Python and python framework

Moderator: leecollings

Post Reply
User avatar
Hansh
Posts: 23
Joined: Sunday 17 February 2019 14:07
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026-3
Location: Rotterdam
Contact:

Toekomstbestendige KNMI Weerwaarschuwingen voor Domoticz (MQTT v5 + GeoJSON Polygonen)

Post by Hansh »

Beste Domoticz-gebruikers,

(English text below)

Aangezien de oudere KNMI-feeds en XML-structuren verouderd raken en worden uitgefaseerd, ben ik achter de schermen bezig geweest met het ontwikkelen van een moderne, robuuste en toekomstbestendige oplossing om officiële KNMI-weerwaarschuwingen te integreren in Domoticz.

Het nieuwe script maakt gebruik van het officiële KNMI Data Platform en is gebouwd volgens de modernste standaarden.

Belangrijkste kenmerken van deze nieuwe opzet:

MQTT v5 over WebSockets (TLS): Maakt gebruik van de officiële KNMI Notification Service met ondersteuning voor Session Expiry Intervals om gemiste berichten na een herverbinding netjes op te halen.

GeoJSON & Ruimtelijke Filtering (shapely): Geen grove provincie-indelingen meer, maar een exacte polygoon-check op basis van de GPS-coördinaten van je eigen Domoticz-installatie.

Asynchrone Architectuur: Opgezet met een ontkoppelde achtergrond-thread (loop_forever) voor de netwerkverbinding en een veilige Queue worker voor de file-verwerking, zodat Domoticz of de MQTT-lus nooit vastloopt.

Tijdzone-bewust: Automatische omzetting van UTC-tijdstempels naar lokale Nederlandse tijd (Europe/Amsterdam) inclusief correcte dagweergave.

Robuuste Bewaking: Ingebouwde heartbeat-monitoring om verbindingsproblemen tijdig te signaleren zonder log-spam.

Status:
De code is inmiddels volledig geschreven, geoptimaliseerd en doorgrond (beschikbaar in zowel een Nederlandse als een Engelstalige variant). Zodra het KNMI de definitieve overstap maakt naar deze nieuwe opzet, zal ik het volledige script en de configuratie-instructies hier op het forum publiceren, zodat iedereen hiermee aan de slag kan!

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Dear Domoticz users,

As the older KNMI feeds and XML structures are becoming obsolete and are being phased out, I have been working behind the scenes to develop a modern, robust, and future-proof solution for integrating official KNMI weather warnings into Domoticz.

The new script utilizes the official KNMI Data Platform and has been built according to the latest standards.

Key features of this new setup:

MQTT v5 over WebSockets (TLS): Leverages the official KNMI Notification Service, with support for "Session Expiry Intervals" to ensure that any messages missed during a disconnection are correctly retrieved upon reconnection.

GeoJSON & Spatial Filtering (using the 'shapely' library): Moves beyond broad, province-based categorization by performing precise polygon checks based on the GPS coordinates of your specific Domoticz installation.

Asynchronous Architecture: Designed with a decoupled background thread (`loop_forever`) for network connectivity and a secure queue worker for data processing, ensuring that neither Domoticz nor the MQTT loop ever freezes.

Timezone-Aware: Automatically converts UTC timestamps to local Dutch time (Europe/Amsterdam), including the correct display of the day.

Robust Monitoring: Includes built-in heartbeat monitoring to promptly detect connection issues without flooding your logs.

Status:
The code is now fully written, optimized, and thoroughly tested (available in both Dutch and English versions). As soon as the KNMI completes the transition to this new system, I will publish the full script and configuration instructions here on the forum, so that everyone can get started with it! If you already have any ideas, questions, or suggestions, please feel free to share them here.
Mocht je nu al ideeën, vragen of suggesties hebben, laat het hier vooral weten.
All my texts are translated from Dutch to English by Google translate>
Sorry for weird sentence structure
Post Reply