Weather alarm from Royal Netherlands Meteorological Institute (KNMI)

Moderator: leecollings

User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Weather alarm from Royal Netherlands Meteorological Institute (KNMI)

Post by FireWizard »

Hello All,

As the previous used weather alarm website http://www.meteoalarm.eu moved to a new European weather alarm site http://www.meteoalarm.org, also the RSS and ATOM feeds used by the python script, provided by @ycahome and all other solutions based on the old website, stopped working.
See: viewtopic.php?t=19519&start=100

As I used previously Node RED to parse the data and send it by MQTT to Domoticz, I created a new flow to do the same with the KNMI Website.

As the European website gets its data from the National Meteorological Bodies, I decided not to use the EU feeds, but the feed presented by KNMI.

So this post is only useful for those living in The Netherlands or those, who are interested in Dutch Weather alarms.

The Dutch website with the map can be visited at https://www.knmi.nl/nederland-nu/weer/w ... en/utrecht.
Insert your province, as Utrecht is the default,

The flow is presented in the picture below:

Screenshot_weeralarm_flow.png
Screenshot_weeralarm_flow.png (16.33 KiB) Viewed 22834 times

Some explanation of the working.

At the far left you will see an "Inject"node, which provides a 10 minute "tick". So the data to Domoticz is updated every 10 minutes.
It requests the data from the KNMI webfeed at https://cdn.knmi.nl/knmi/xml/rss/rss_KN ... wingen.xml
As this is XML data, it is sent through a XML node in order to convert it from a XML string to its JavaScript object representation.
This is used as input in a "Function" node. The Function takes care of the conversion to the Domoticz format.

The contents is as follows:

Code: Select all

var i;
var desc;
var mod_desc;
var al_txt;
var no_al_txt;
for (i = 0; i < msg.payload.rss.channel[0].item.length; i++) {
    if (msg.payload.rss.channel[0].item[i].title[0] === "Waarschuwingen Gelderland") {
        desc = msg.payload.rss.channel[0].item[i].description[0];
        mod_desc = desc.replace(/(<([^>]+)>)/ig, '.'); // Modified description without HTML tags. Tags replaced by . (dot)
        no_al_txt = mod_desc.substring((mod_desc.indexOf(".") + 2), (mod_desc.indexOf(".", (mod_desc.indexOf(".") + 1)) + 1));
        al_txt = mod_desc.substring((mod_desc.indexOf("..") + 2), (mod_desc.indexOf("..", (mod_desc.indexOf("..") + 1)) + 1));
    }
}
switch (desc.substring(5,desc.indexOf("."))) {
    case "Groen":
        msg.payload = { "command": "udevice", "idx": 395, "nvalue": 1, "svalue": no_al_txt };
        break;

   case "Geel" :
        msg.payload = { "command": "udevice", "idx": 395, "nvalue": 2, "svalue": al_txt };
        break;

    case "Oranje":
        msg.payload = { "command": "udevice", "idx": 395, "nvalue": 3, "svalue": al_txt };
        break;

    case "Rood":
        msg.payload = { "command": "udevice", "idx": 395, "nvalue": 4, "svalue": al_txt };
        break;

    default:
        msg.payload = { "command": "udevice", "idx": 395, "nvalue": 0, "svalue": "No Data available" };
        break;
}
return msg
The first lines are some variable declarations. Then we will see a "for" loop.
The user has to change line 7 and insert his/her own desired area (either a province or a coastal area).
It is followed by a "switch case" statement. The user has to replace the number after "idx" for his/her own IDX number of the Domoticz virtual "Alert" sensor.

Remark!
It has been tested with code green, code yellow and code orange.
However I did not see any code red, so we will have to wait in order to test.

If everything is finished you will see:

Screenshot_weeralarm_geel.png
Screenshot_weeralarm_geel.png (45.13 KiB) Viewed 22834 times

And hopefully very soon:

Screenshot_weeralarm_groen.png
Screenshot_weeralarm_groen.png (43.99 KiB) Viewed 22834 times

The complete flow, you will find below:

Code: Select all

[{"id":"6c6dcd5fb912ade7","type":"http request","z":"2275566b.451742","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://cdn.knmi.nl/knmi/xml/rss/rss_KNMIwaarschuwingen.xml","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":350,"y":460,"wires":[["74b6e54b66b937f2"]]},{"id":"206e54fce96bfcf8","type":"inject","z":"2275566b.451742","name":"10 Minute tick","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"600","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":460,"wires":[["6c6dcd5fb912ade7"]]},{"id":"74b6e54b66b937f2","type":"xml","z":"2275566b.451742","name":"","property":"payload","attr":"","chr":"","x":530,"y":460,"wires":[["f1c7fef468771b6a"]]},{"id":"f1c7fef468771b6a","type":"function","z":"2275566b.451742","name":"Function","func":"var i;\nvar desc;\nvar mod_desc;\nvar al_txt;\nvar no_al_txt;\nfor (i = 0; i < msg.payload.rss.channel[0].item.length; i++) {\n    if (msg.payload.rss.channel[0].item[i].title[0] === \"Waarschuwingen Gelderland\") {\n        desc = msg.payload.rss.channel[0].item[i].description[0];\n        mod_desc = desc.replace(/(<([^>]+)>)/ig, '.'); // Modified description without HTML tags. Tags replaced by . (dot)\n        no_al_txt = mod_desc.substring((mod_desc.indexOf(\".\") + 2), (mod_desc.indexOf(\".\", (mod_desc.indexOf(\".\") + 1)) + 1));\n        al_txt = mod_desc.substring((mod_desc.indexOf(\"..\") + 2), (mod_desc.indexOf(\"..\", (mod_desc.indexOf(\"..\") + 1)) + 1));\n    }\n}\nswitch (desc.substring(5,desc.indexOf(\".\"))) {\n    case \"Groen\":\n        msg.payload = { \"command\": \"udevice\", \"idx\": 395, \"nvalue\": 1, \"svalue\": no_al_txt };\n        break;\n\n   case \"Geel\" :\n        msg.payload = { \"command\": \"udevice\", \"idx\": 395, \"nvalue\": 2, \"svalue\": al_txt };\n        break;\n\n    case \"Oranje\":\n        msg.payload = { \"command\": \"udevice\", \"idx\": 395, \"nvalue\": 3, \"svalue\": al_txt };\n        break;\n\n    case \"Rood\":\n        msg.payload = { \"command\": \"udevice\", \"idx\": 395, \"nvalue\": 4, \"svalue\": al_txt };\n        break;\n\n    default:\n        msg.payload = { \"command\": \"udevice\", \"idx\": 395, \"nvalue\": 0, \"svalue\": \"No Data available\" };\n        break;\n}\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":700,"y":460,"wires":[["5b307902260f6b0a"]]},{"id":"5b307902260f6b0a","type":"mqtt out","z":"2275566b.451742","name":"Domoticz In","topic":"domoticz/in","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"2d06e6e96ce54335","x":890,"y":460,"wires":[]},{"id":"cae751d6c4047878","type":"comment","z":"2275566b.451742","name":"Meteoalarm KNMI","info":"","x":570,"y":400,"wires":[]},{"id":"2d06e6e96ce54335","type":"mqtt-broker","name":"Jonas_MQTT_Server","broker":"192.168.10.24","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]
Regards
Last edited by FireWizard on Wednesday 16 November 2022 22:35, edited 1 time in total.
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Weather alarm from Royal Netherlands Meteorological Institute (KNMI)

Post by EdwinK »

Thanks again. If I have everything up again, I'll try this
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
User avatar
andreo
Posts: 42
Joined: Friday 07 August 2015 21:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.3
Location: Anna Paulowna, Netherlands
Contact:

Re: Weather alarm from Royal Netherlands Meteorological Institute (KNMI)

Post by andreo »

Thanks,
Successfully implemented the weather alarm, it works great. Now just waiting for the next storm, looking forward to it.
Latest version of Domoticz and more running on Docker|Raspberry Pi 4-B 8GB Bookworm|RF-Link|Klik Aan Klik Uit|Nefit easy|ESPeasy|P1 power meter|S0PCM-5 through Ser2Net|Alecto WS5500|FrtizBox|Satel Integra|Solis
Greetz Andre.
Vomera
Posts: 184
Joined: Wednesday 06 September 2017 9:11
Target OS: Linux
Domoticz version:
Contact:

Re: Weather alarm from Royal Netherlands Meteorological Institute (KNMI)

Post by Vomera »

Tnx for this! It's the first time i use node red. Didnt know i had it install it (but i use mqtt).
After some trying and figuring out how it works, i get the script working :D
Now indeed see which results it will give, because i want to use the value's with dashticz to give warning weather icons :D
Too bad meteoalarm is down.
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Weather alarm from Royal Netherlands Meteorological Institute (KNMI)

Post by EdwinK »

In the 'debug' log I can see some changes, but the alert button doesn't change. I guess I have done something wrong with the MQTT settings, but can't figure out what/

Never mind. I was using the wrong MQTT plugin. Now the alert icon is changing.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Weather alarm from Royal Netherlands Meteorological Institute (KNMI)

Post by FireWizard »

@EdwinK,

So this issue is solved and the alert has been cleared?

Regards
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Weather alarm from Royal Netherlands Meteorological Institute (KNMI)

Post by EdwinK »

Yes, I do receive alerts atm. :)

I like how the flow is working.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
Jan Jansen
Posts: 229
Joined: Wednesday 30 April 2014 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: Weather alarm from Royal Netherlands Meteorological Institute (KNMI)

Post by Jan Jansen »

@FireWizard,

Thanks again for this nice addition!

Jan
roelv
Posts: 3
Joined: Tuesday 27 February 2018 22:17
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Heerhugowaard, NL
Contact:

Re: Weather alarm from Royal Netherlands Meteorological Institute (KNMI)

Post by roelv »

Hi FireWizard,

Thx for this nice application. I altered the last part of it, so it now delivers the Weatheralert status to my Pushover app instead of Domoticz. So I'm always notified of important weatherchanges on my cell phone. For this I changed the function node a bit (could still be improved though), added a filter and a Pushover node.
Pushover is very reliable and has lots of delivery and attention options and you pay only once for using it (about € 5). Instead you could also use a Telegram node via a (free) Telegram account.

Below: altered Function node

Code: Select all

    {
        "id": "f1c7fef468771b6a",
        "type": "function",
        "z": "953341bb9f649d8c",
        "name": "Function",
        "func": "var i;\nvar desc;\nvar mod_desc;\nvar al_txt;\nvar no_al_txt;\nfor (i = 0; i < msg.payload.rss.channel[0].item.length; i++) {\n    if (msg.payload.rss.channel[0].item[i].title[0] === \"Waarschuwingen Noord-Holland\") {\n        desc = msg.payload.rss.channel[0].item[i].description[0];\n        mod_desc = desc.replace(/(<([^>]+)>)/ig, '.'); // Modified description without HTML tags. Tags replaced by . (dot)\n        no_al_txt = mod_desc.substring((mod_desc.indexOf(\".\") + 2), (mod_desc.indexOf(\".\", (mod_desc.indexOf(\".\") + 1)) + 1));\n        al_txt = mod_desc.substring((mod_desc.indexOf(\"..\") + 2), (mod_desc.indexOf(\"..\", (mod_desc.indexOf(\"..\") + 1)) + 1));\n    }\n}\nswitch (desc.substring(5,desc.indexOf(\".\"))) {\n    case \"Groen\":\n        msg.payload = { \"Weercode Groen\": no_al_txt };\n        break;\n\n   case \"Geel\" :\n        msg.payload = { \"Weercode Geel\": al_txt };\n        break;\n\n    case \"Oranje\":\n        msg.payload = { \"Weercode Oranje\": al_txt };\n        break;\n\n    case \"Rood\":\n        msg.payload = { \"Weercode Rood\": al_txt };\n        break;\n\n    default:\n        msg.payload = { \"Geen gegevens\": no_al_txt };\n        break;\n}\nreturn msg",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 380,
        "y": 300,
        "wires": [
            [
                "86127bc90d5bec32"
            ]
        ]
    }
]
Below: added Filter node

Code: Select all

[
    {
        "id": "86127bc90d5bec32",
        "type": "rbe",
        "z": "953341bb9f649d8c",
        "name": "",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload",
        "topi": "topic",
        "x": 590,
        "y": 300,
        "wires": [
            [
                "92459ad472b1531c",
                "4c85e09a56b801ce"
            ]
        ]
    }
]
Below: Added Pushover node

Code: Select all

[
    {
        "id": "92459ad472b1531c",
        "type": "pushover",
        "z": "953341bb9f649d8c",
        "name": "",
        "device": "",
        "title": "Weercode NH 1",
        "priority": "1",
        "sound": "bike",
        "url": "",
        "url_title": "",
        "html": false,
        "credentials": {},
        "x": 880,
        "y": 260,
        "wires": []
    }
]
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Weather alarm from Royal Netherlands Meteorological Institute (KNMI)

Post by FireWizard »

Hi @roelv,

Thanks for sharing your application.
Perhaps it will inspire members of the Domoticz community.

Regards
User avatar
Hansh
Posts: 19
Joined: Sunday 17 February 2019 14:07
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: Rotterdam
Contact:

Re: Weather alarm from Royal Netherlands Meteorological Institute (KNMI)

Post by Hansh »

hello fire wizard

Your script runs in blocks.

I'm a bigger fan of dzvents for a variety of reasons.
The script you made inspired me to achieve the same result in dzvents.

I've created a new topic to avoid confusion
"KNMI weather alert with dzvents"

Of course I mentioned you as the source

regards
Hansh
All my texts are translated from Dutch to English by Google translate>
Sorry for weird sentence structure
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Weather alarm from Royal Netherlands Meteorological Institute (KNMI)

Post by FireWizard »

Hello @Hansh,

No problem. It is nice that my web scraping in Node-RED inspired you to make something in dZVents.

Regards
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Weather alarm from Royal Netherlands Meteorological Institute (KNMI)

Post by FireWizard »

To all users of the KNMI weather alarm application.

Since approx. 2 weeks I noted that the weather application is not updating its data anymore. This will not be visible for everybody, as it depends on the latest received data. So I looked for the reason and an alternative solution.

The application pulls its data from https://cdn.knmi.nl/knmi/xml/rss/rss_KN ... wingen.xml.

As this URL is still online, the application continues to use outdated data.

I did not find an acceptable alternative, at least to my opinion, other than scraping the data from https://www.knmi.nl/nederland-nu/weer/w ... gelderland or any other area. However, I am not really satisfied with it, as it will give a general weather alarm and not a regional weather alarm. So if a fog alarm is issued by KNMI for the province of e.g. Groningen, you will also get it in other areas.

So I mailed with KNMI:

(In Dutch)
Sinds dinsdag 31 oktober, 22:32:00 u, wordt de XML file (https://cdn.knmi.nl/knmi/xml/rss/rss_KN ... wingen.xml) niet meer bijgewerkt. Betekent dit, dat deze XML feed niet meer beschikbaar is of is dit een storing?

Bij voorbaat dank voor een antwoord.

Met vriendelijke groet.
And I received the following response from KNMI:
Beste

Dank voor uw bericht. Het klopt dat de RSS feeds offline zijn gezet.
We zijn aan het kijken of er een alternatief voorhanden is.

U hoort nog van ons.

Met vriendelijke groet,
As this means that the application still works, but that the received data is useless, I will post my alternative in a next post.
Also other applications, which use the RSS/XML feed will not receive the correct data.

As soon as I do receive an answer from KNMI, I will post it here, in order to keep the Domoticz community updated.
If someone knows a better alternative (URL) to retrieve the data from, please post it here.

Regards
Toulon7559
Posts: 843
Joined: Sunday 23 February 2014 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version: mixed
Location: Hengelo(Ov)/NL
Contact:

Re: Weather alarm from Royal Netherlands Meteorological Institute (KNMI)

Post by Toulon7559 »

The 'problem' is more general than just missing the Alarm-information:
see this Dutch weblink.

The most professional way to get hold of KNMI's Data is via their DeveloperWebportal, but that is not easy.

A simpler and still available, alternatieve access to KNMI's weather-alert information is via weerlive.nl
You need an APIkey, but then get a JSON-file, e.g. by means of following lua-script-line which by geolocation-coordinates is dedicated to a place of your choice.

Code: Select all

result=os.capture('curl -s "http://weerlive.nl/api/json-data-10min.php?key='..api_key..'&locatie='..coord..'
Demonstration-url:

Code: Select all

https://weerlive.nl/api/json-data-10min.php?key=demo&locatie=Amsterdam
Application is free upto a certain quotum of calls per day:
if exceeding the limit, then no further reception of useful info for that day.
Paid API-key is possible, and has plenty more volume.

What you next need is a data-extraction from that JSON-file, as I already realised for myself with a variant of this lua-script.
The JSON-file has a field called 'alarm'
When alarm = 0, then Code = Green and field alarmtxt empty
For alarm = 1, you get in field alarmtxt the text of KNMI's alarm-alert

Not only alarmtxt provided in that JSON-file, but also for the selected geolocation the actual data, and forecast data for 3 days.
Last edited by Toulon7559 on Monday 13 November 2023 15:47, edited 7 times in total.
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Weather alarm from Royal Netherlands Meteorological Institute (KNMI)

Post by FireWizard »

As I mentioned already in my previous post I will share a new Node-RED flow, that uses web scraping from
https://www.knmi.nl/nederland-nu/weer/w ... gelderland or any other area (12 provinces and 3 coastal areas), if you use the correct name in the URL

The page shows the following:

Screenshot_weeralarm_map.png
Screenshot_weeralarm_map.png (65.79 KiB) Viewed 4894 times
I use the text in the upper left corner (in this case "Code geel") and as alarm text I use the first sentence under the header (in this case "Vanmiddag zware windstoten).

In this case the widget looks as follows:

Screenshot_weeralarm_widget_yellow.png
Screenshot_weeralarm_widget_yellow.png (63.93 KiB) Viewed 4894 times
Other texts are possible, but be aware, that these are not to long , as it will not look nice.

Screenshot_weather_alarm_long text.png
Screenshot_weather_alarm_long text.png (100.67 KiB) Viewed 4894 times
This is the reason I use only the first sentence.

As said earlier this information is visible as soon as for one of the areas KNMI issues a weather alarm so it may not apply to your region.

Please find the Node-RED flow below.
Do not forget to insert your own IDX number and the configuration of the MQTT server.

Code: Select all

[
    {
        "id": "f280c34267f25b07",
        "type": "tab",
        "label": "Meteoalarm",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "47228895277fa36c",
        "type": "http request",
        "z": "f280c34267f25b07",
        "name": "Request KNMI Weeralarm",
        "method": "GET",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "https://www.knmi.nl/nederland-nu/weer/waarschuwingen/gelderland",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 420,
        "y": 160,
        "wires": [
            [
                "d54e838f89afb841"
            ]
        ]
    },
    {
        "id": "2042c5058b479a35",
        "type": "comment",
        "z": "f280c34267f25b07",
        "name": "Meteoalarm KNMI",
        "info": "",
        "x": 690,
        "y": 100,
        "wires": []
    },
    {
        "id": "8859f56f79c115f3",
        "type": "inject",
        "z": "f280c34267f25b07",
        "name": "10 Minute tick",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "600",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 160,
        "y": 160,
        "wires": [
            [
                "47228895277fa36c"
            ]
        ]
    },
    {
        "id": "86349c071e6759a9",
        "type": "function",
        "z": "f280c34267f25b07",
        "name": "Function",
        "func": "switch (msg.payload[0]) {\n\n    case \"Code groen\":\n        msg.payload = { \"command\": \"udevice\", \"idx\": 28, \"nvalue\": 1, \"svalue\": msg.payload[1].slice(0, msg.payload[1].indexOf(\".\") + 1) };\n        break;\n\n   case \"Code geel\" :\n        msg.payload = { \"command\": \"udevice\", \"idx\": 28, \"nvalue\": 2, \"svalue\": msg.payload[1].slice(0, msg.payload[1].indexOf(\".\") + 1) };\n        break;\n\n    case \"Code oranje\":\n        msg.payload = { \"command\": \"udevice\", \"idx\": 28, \"nvalue\": 3, \"svalue\": msg.payload[1].slice(0, msg.payload[1].indexOf(\".\") + 1) };\n        break;\n\n    case \"Code rood\":\n        msg.payload = { \"command\": \"udevice\", \"idx\": 28, \"nvalue\": 4, \"svalue\": msg.payload[1].slice(0, msg.payload[1].indexOf(\".\") + 1) };\n        break;\n\n    default:\n        msg.payload = { \"command\": \"udevice\", \"idx\": 28, \"nvalue\": 0, \"svalue\": \"No Data available\" };\n        break;\n}\nreturn msg",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 900,
        "y": 160,
        "wires": [
            [
                "66949beb9bcff093"
            ]
        ]
    },
    {
        "id": "66949beb9bcff093",
        "type": "mqtt out",
        "z": "f280c34267f25b07",
        "name": "Domoticz In",
        "topic": "domoticz/in",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "108bbff65a6cdbf3",
        "x": 1090,
        "y": 160,
        "wires": []
    },
    {
        "id": "d54e838f89afb841",
        "type": "html",
        "z": "f280c34267f25b07",
        "name": "Code/Text Select",
        "property": "payload",
        "outproperty": "payload",
        "tag": "div.alert__heading,p",
        "ret": "text",
        "as": "single",
        "x": 690,
        "y": 160,
        "wires": [
            [
                "86349c071e6759a9"
            ]
        ]
    },
    {
        "id": "108bbff65a6cdbf3",
        "type": "mqtt-broker",
        "name": "",
        "broker": "192.168.10.51",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "autoUnsubscribe": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    }
]
Regards
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Weather alarm from Royal Netherlands Meteorological Institute (KNMI)

Post by FireWizard »

Hello @Toulon7559,

Thanks for your response. I am aware of this and this could be indeed an alternative if KNMI does not offer another solution.
Alarm text is the same as I use, at least the first line.

Screenshot_KNMI_alarmtxt.png
Screenshot_KNMI_alarmtxt.png (7.69 KiB) Viewed 4886 times
alarm 0 is indeed Code Green and alarm 1 is Code Yellow.

What is Code Orange and Code Red?

Regards
Last edited by FireWizard on Tuesday 14 November 2023 9:25, edited 2 times in total.
Toulon7559
Posts: 843
Joined: Sunday 23 February 2014 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version: mixed
Location: Hengelo(Ov)/NL
Contact:

Re: Weather alarm from Royal Netherlands Meteorological Institute (KNMI)

Post by Toulon7559 »

Unfortunately Weerlive.nl only signals by alarm=1 THAT an Alarm is valid, not the sublevel for Code-colours Orange, Yellow and Red.
At this moment, to get that level of detail we must become able to access the data at KNMI's DeveloperPortal:
some work to be done to make it easy, but once we have found a way, a bounty of data becomes accessible ..............
Last edited by Toulon7559 on Monday 13 November 2023 15:49, edited 1 time in total.
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Weather alarm from Royal Netherlands Meteorological Institute (KNMI)

Post by waltervl »

There is also https://feeds.meteoalarm.org/feeds/mete ... etherlands that still shows the info based on KNMI data
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Toulon7559
Posts: 843
Joined: Sunday 23 February 2014 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version: mixed
Location: Hengelo(Ov)/NL
Contact:

Re: Weather alarm from Royal Netherlands Meteorological Institute (KNMI)

Post by Toulon7559 »

Walter,
Indeed from that weblink it is even possible to get alarm-text per province, but data-extraction from the output rss-information is more challenging than extraction from weerlive.nl
;-) Perhaps better apply the time, intelligence and energy to get access to KNMI's DeveloperPortal?
Last edited by Toulon7559 on Tuesday 14 November 2023 9:48, edited 3 times in total.
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Weather alarm from Royal Netherlands Meteorological Institute (KNMI)

Post by FireWizard »

@waltervl and @Toulon7559,

Walter,

I looked to the meteoalarm.org website as well, but their map differs from the KNMI map.

If you look now, all areas show a code "yellow". The meteoalarm.org map does not issue a warning for the 3 coastal provinces (!) and Noord-Brabant.
That looks strange. I trust the KNMI map more than the Meteoalarm.org map.

Toulon7559

The developers portal is maybe the best option and I will certainly have a look to the possibilities.

I'll keep you updated.

Regards
Last edited by FireWizard on Tuesday 14 November 2023 9:28, edited 1 time in total.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests