Stookwijzer (for Dutch users only)

Moderator: leecollings

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

Stookwijzer (for Dutch users only)

Post by FireWizard »

Hi,

As the previous URL for "Stookalert" has been taken offline at the end of January 2025,
I hereby publish a new Node-RED flow for the "Stookwijzer".
See topic ; viewtopic.php?p=323436#p323436

For background of "Stookwijzer", see: https://iplo.nl/thema/lucht/houtstook-stookwijzer/

The new Node-RED flow uses the Lat/Lon coördinates as inserted in the "Settings" page of Domoticz.

Screenshot_Stookwijzer_Node-RED.png
Screenshot_Stookwijzer_Node-RED.png (37.08 KiB) Viewed 1778 times

The top row of nodes collect the geographical coördinates for your location.

The first "Inject" node injects the IP address of your device with the Domoticz application.
So you have to insert the correct IP address in the Inject node.

The first HTTP node requests the Lat/Lon coördinates from Domoticz.

These coördinates give the Lat/Lon values in WGS 84 format. This is equal to EPSG 4326.
However the new RIVM API uses a different system, EPSG 28992. This is based on the x, y coördinates of
Onze Lieve Vrouwetoren (Amersfoort). See: https://nl.wikipedia.org/wiki/Onze_Liev ... mersfoort)

For EPSG, see: https://epsg.io/

The conversion from EPSG 4326 to EPSG 28992 is rather complex, but fortunately epsg.io has an API, which does the hard work.

So the Lat/Lon coördinates of Domoticz are inserted in a HTTP request to the epsg.io API and the x, y coördinates are,
in case of a valid response, stored in a Node-RED flow variable.

If Node-RED is restarted or the flow is redeployed, the Lat/Lon data is collected and
a request to the (complex) new API of RIVM will be made.

It will require a bounding box, based on the x, y co-ordinates, which is set in the change node,
followed by a HTTP request node to RIVM API for "Stookwijzer".

The data is parsed from the response and only the data for the next 6 hours is used, together with the latest available time,
wind speed and LKI.

To use it, do the following:

1. Create a "Dummy" device (does nothing) and a virtual sensor of the type "Alert".
Note the idx number of this sensor.

2. Insert the IP address of your Domoticz device, including the used port number.

3. Insert the noted idx number in the first line of the "Function" node (before the MQTT-Out node.

4. Configure your MQTT node.

The data is collected from the RIVM API every 6 hours and so we need a timer, that triggers the lower part of the flow every 6 hours.
The "node-red-contrib-cron-plus" node is used for this. So install that one with the "Palette Manager".

Finally:
Burn your wood in a responsible way.

Regards

The flow:

Code: Select all

[
    {
        "id": "a446df5948eb661c",
        "type": "tab",
        "label": "Stookwijzer",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "df3ceeac39b0a9a0",
        "type": "http request",
        "z": "a446df5948eb661c",
        "name": "HTTP Domoticz",
        "method": "GET",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "http://{{{ip}}}/json.htm?type=command&param=getsettings",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 500,
        "y": 100,
        "wires": [
            [
                "634a641fea351fa6"
            ]
        ]
    },
    {
        "id": "ef4cc1c86321fc0f",
        "type": "inject",
        "z": "a446df5948eb661c",
        "name": "Request Home Coordinates",
        "props": [
            {
                "p": "ip",
                "v": "192.168.1.1:8080",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "x": 240,
        "y": 100,
        "wires": [
            [
                "df3ceeac39b0a9a0"
            ]
        ]
    },
    {
        "id": "634a641fea351fa6",
        "type": "http request",
        "z": "a446df5948eb661c",
        "name": "HTTP EPSG",
        "method": "GET",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "https://epsg.io/srs/transform/{{{payload.Location.Longitude}}},{{{payload.Location.Latitude}}}.json?key=default&s_srs=4326&t_srs=28992",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 770,
        "y": 100,
        "wires": [
            [
                "7a5b56b0404ba3de"
            ]
        ]
    },
    {
        "id": "f12c06af180d0a52",
        "type": "http request",
        "z": "a446df5948eb661c",
        "name": "Request RIVM Stookwijzer",
        "method": "GET",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "https://data.rivm.nl/geo/alo/wms?service=WMS&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetFeatureInfo&FORMAT=image/png&TRANSPARENT=true&QUERY_LAYERS=stookwijzer_v2&LAYERS=stookwijzer_v2&servicekey=82b124ad-834d-4c10-8bd0-ee730d5c1cc8&STYLES=&BUFFER=1&EXCEPTIONS=INIMAGE&info_format=application/json&feature_count=1&I=139&J=222&WIDTH=256&HEIGHT=256&CRS=EPSG:28992&BBOX={{{x_min}}}%2C{{{y_min}}}%2C{{{x_max}}}%2C{{{y_max}}}",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 720,
        "y": 180,
        "wires": [
            [
                "38741d8f4c1483f3"
            ]
        ]
    },
    {
        "id": "38741d8f4c1483f3",
        "type": "function",
        "z": "a446df5948eb661c",
        "name": "Prepare Domoticz",
        "func": "let idx = 123;\nlet runtime = msg.payload.features[0].properties.model_runtime;\nlet lki = msg.payload.features[0].properties.lki.toString();\nlet wind = msg.payload.features[0].properties.wind_bft.toString();\nlet level = msg.payload.features[0].properties.advies_0 + 2;\n\nmsg.payload = { \"command\": \"udevice\", \"idx\": idx, \"nvalue\": level, \"svalue\": \"Laatst bijgewerkt: \" + runtime + \"\\nWindsnelheid: \" + wind + \" Bft.\\nLKI: \" + lki };\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 990,
        "y": 180,
        "wires": [
            [
                "b871d94dc598d43e"
            ]
        ]
    },
    {
        "id": "b871d94dc598d43e",
        "type": "mqtt out",
        "z": "a446df5948eb661c",
        "name": "To Domoticz",
        "topic": "domoticz/in",
        "qos": "0",
        "retain": "false",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "f8a872af.a6898",
        "x": 1230,
        "y": 180,
        "wires": []
    },
    {
        "id": "f0682fef54f8b981",
        "type": "change",
        "z": "a446df5948eb661c",
        "name": "Set bbox",
        "rules": [
            {
                "t": "set",
                "p": "x_min",
                "pt": "msg",
                "to": "x_min",
                "tot": "flow"
            },
            {
                "t": "set",
                "p": "y_min",
                "pt": "msg",
                "to": "y_min",
                "tot": "flow"
            },
            {
                "t": "set",
                "p": "x_max",
                "pt": "msg",
                "to": "x_min + 10",
                "tot": "jsonata"
            },
            {
                "t": "set",
                "p": "y_max",
                "pt": "msg",
                "to": "y_min + 10",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 480,
        "y": 180,
        "wires": [
            [
                "f12c06af180d0a52"
            ]
        ]
    },
    {
        "id": "f6587744b1ba764e",
        "type": "cronplus",
        "z": "a446df5948eb661c",
        "name": "Request Stookwijzer every 6 h",
        "outputField": "payload",
        "timeZone": "",
        "storeName": "",
        "commandResponseMsgOutput": "output1",
        "defaultLocation": "52.17928818043169 5.606535673141479",
        "defaultLocationType": "fixed",
        "outputs": 1,
        "options": [
            {
                "name": "schedule1",
                "topic": "morning",
                "payloadType": "default",
                "payload": "",
                "expressionType": "cron",
                "expression": "0 0 10 * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            },
            {
                "name": "schedule2",
                "topic": "afternoon",
                "payloadType": "default",
                "payload": "",
                "expressionType": "cron",
                "expression": "0 0 16 * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            },
            {
                "name": "schedule3",
                "topic": "evening",
                "payloadType": "default",
                "payload": "",
                "expressionType": "cron",
                "expression": "0 0 22 * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            },
            {
                "name": "schedule4",
                "topic": "night",
                "payloadType": "default",
                "payload": "",
                "expressionType": "cron",
                "expression": "0 0 4 * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 230,
        "y": 180,
        "wires": [
            [
                "f0682fef54f8b981"
            ]
        ]
    },
    {
        "id": "7a5b56b0404ba3de",
        "type": "switch",
        "z": "a446df5948eb661c",
        "name": "Check Response",
        "property": "statusCode",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "200",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 990,
        "y": 100,
        "wires": [
            [
                "41cb4bfd4ef8fc89"
            ]
        ]
    },
    {
        "id": "41cb4bfd4ef8fc89",
        "type": "change",
        "z": "a446df5948eb661c",
        "name": "Store x and y",
        "rules": [
            {
                "t": "set",
                "p": "x_min",
                "pt": "flow",
                "to": "payload.results[0].x",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "y_min",
                "pt": "flow",
                "to": "payload.results[0].y",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1220,
        "y": 100,
        "wires": [
            [
                "f0682fef54f8b981"
            ]
        ]
    },
    {
        "id": "f8a872af.a6898",
        "type": "mqtt-broker",
        "name": "Jonas_MQTT_Server",
        "broker": "mqtt.jonasnet.nl",
        "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": ""
    }
]
Last edited by FireWizard on Saturday 08 February 2025 15:27, edited 2 times in total.
User avatar
FireWizard
Posts: 1893
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Stookwijzer (for Dutch users only)

Post by FireWizard »

Hi,

Thanks to @waltervl, who pointed me to another forum https://forum.samenmeten.nl/t/zichtbaar ... advies/674,
I have been been able to simplify to previous published flow.
See: https://forum.samenmeten.nl/t/zichtbaar ... advies/674

The forum article shows that it should be possible to request the RIVM URL directly, without the conversion from
the Lat/Lon coördinates to the Dutch "Rijksdriehoekscoördinaten".
This avoids the HTTP Request to the external epsg.io API and so also the check for a valid response.
On the other hand, I had to add another "Function" node in order to convert the Domoticz (string) coördinates to
numerical values, so that I could calculate the correct bbox values.

Therefore the contents of the "Set bbox" node has been slightly changed and also the URL in "Request RIVM Stookwijzer" has been changed.

See the new flow:

Screenshot_Stookwijzer_Node-RED_v2.png
Screenshot_Stookwijzer_Node-RED_v2.png (37.2 KiB) Viewed 1753 times

The code of the new flow:

Code: Select all

[
    {
        "id": "9336e6c93c27d0f6",
        "type": "http request",
        "z": "97d61cf0e838a60a",
        "name": "HTTP Domoticz",
        "method": "GET",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "http://{{{ip}}}/json.htm?type=command&param=getsettings",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 500,
        "y": 460,
        "wires": [
            [
                "8f4b1d9c3b9c5c0a"
            ]
        ]
    },
    {
        "id": "797420760fbbf875",
        "type": "inject",
        "z": "97d61cf0e838a60a",
        "name": "Request Home Coordinates",
        "props": [
            {
                "p": "ip",
                "v": "192.168.1.10:8080",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "x": 240,
        "y": 460,
        "wires": [
            [
                "9336e6c93c27d0f6"
            ]
        ]
    },
    {
        "id": "8a0ee6185b37d21b",
        "type": "change",
        "z": "97d61cf0e838a60a",
        "name": "Set bbox",
        "rules": [
            {
                "t": "set",
                "p": "x_min",
                "pt": "msg",
                "to": "x_min",
                "tot": "flow"
            },
            {
                "t": "set",
                "p": "y_min",
                "pt": "msg",
                "to": "y_min",
                "tot": "flow"
            },
            {
                "t": "set",
                "p": "x_max",
                "pt": "msg",
                "to": "x_min + 0.000001",
                "tot": "jsonata"
            },
            {
                "t": "set",
                "p": "y_max",
                "pt": "msg",
                "to": "y_min + 0.000001",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 480,
        "y": 540,
        "wires": [
            [
                "0f909136f328e11c"
            ]
        ]
    },
    {
        "id": "0f909136f328e11c",
        "type": "http request",
        "z": "97d61cf0e838a60a",
        "name": "Request RIVM Stookwijzer",
        "method": "GET",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "https://data.rivm.nl/geo/alo/wms?service=WMS&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetFeatureInfo&QUERY_LAYERS=stookwijzer_v2&LAYERS=stookwijzer_v2&info_format=application/json&feature_count=2&I=0&J=0&WIDTH=1&HEIGHT=1&CRS=CRS:84&BBOX={{{x_min}}},{{{y_min}}},{{{x_max}}},{{{y_max}}}",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 740,
        "y": 540,
        "wires": [
            [
                "dc234130aa937959"
            ]
        ]
    },
    {
        "id": "8f4b1d9c3b9c5c0a",
        "type": "function",
        "z": "97d61cf0e838a60a",
        "name": "Convert string to number",
        "func": "let lon = parseFloat(msg.payload.Location.Longitude);\nlet lat = parseFloat(msg.payload.Location.Latitude);\n\n\nmsg.payload = {\n    Lon: lon,\n    Lat: lat\n}\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 750,
        "y": 460,
        "wires": [
            [
                "8cc3a84dd45a6880"
            ]
        ]
    },
    {
        "id": "8cc3a84dd45a6880",
        "type": "change",
        "z": "97d61cf0e838a60a",
        "name": "Store Lon and Lat",
        "rules": [
            {
                "t": "set",
                "p": "x_min",
                "pt": "flow",
                "to": "payload.Lon",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "y_min",
                "pt": "flow",
                "to": "payload.Lat",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1010,
        "y": 460,
        "wires": [
            [
                "8a0ee6185b37d21b"
            ]
        ]
    },
    {
        "id": "775bcc3a7df0bb2b",
        "type": "cronplus",
        "z": "97d61cf0e838a60a",
        "name": "Request Stookwijzer every 6 h",
        "outputField": "payload",
        "timeZone": "",
        "storeName": "",
        "commandResponseMsgOutput": "output1",
        "defaultLocation": "52.17928818043169 5.606535673141479",
        "defaultLocationType": "fixed",
        "outputs": 1,
        "options": [
            {
                "name": "schedule1",
                "topic": "morning",
                "payloadType": "default",
                "payload": "",
                "expressionType": "cron",
                "expression": "0 0 10 * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            },
            {
                "name": "schedule2",
                "topic": "afternoon",
                "payloadType": "default",
                "payload": "",
                "expressionType": "cron",
                "expression": "0 0 16 * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            },
            {
                "name": "schedule3",
                "topic": "evening",
                "payloadType": "default",
                "payload": "",
                "expressionType": "cron",
                "expression": "0 0 22 * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            },
            {
                "name": "schedule4",
                "topic": "night",
                "payloadType": "default",
                "payload": "",
                "expressionType": "cron",
                "expression": "0 0 4 * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 230,
        "y": 540,
        "wires": [
            [
                "8a0ee6185b37d21b"
            ]
        ]
    },
    {
        "id": "dc234130aa937959",
        "type": "function",
        "z": "97d61cf0e838a60a",
        "name": "Prepare Domoticz",
        "func": "let idx = 123;\nlet runtime = msg.payload.features[0].properties.model_runtime;\nlet lki = msg.payload.features[0].properties.lki.toString();\nlet wind = msg.payload.features[0].properties.wind_bft.toString();\nlet level = msg.payload.features[0].properties.advies_0 + 2;\n\nmsg.payload = { \"command\": \"udevice\", \"idx\": idx, \"nvalue\": level, \"svalue\": \"Laatst bijgewerkt: \" + runtime + \"\\nWindsnelheid: \" + wind + \" Bft.\\nLKI: \" + lki };\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1010,
        "y": 540,
        "wires": [
            [
                "3b68fc1db446fb04"
            ]
        ]
    },
    {
        "id": "3b68fc1db446fb04",
        "type": "mqtt out",
        "z": "97d61cf0e838a60a",
        "name": "To Domoticz",
        "topic": "domoticz/in",
        "qos": "0",
        "retain": "false",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "505116152204ef7f",
        "x": 1230,
        "y": 540,
        "wires": []
    },
    {
        "id": "505116152204ef7f",
        "type": "mqtt-broker",
        "name": "Jonas_MQTT_Server",
        "broker": "mqtt.jonasnet.nl",
        "port": 1883,
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": 4,
        "keepalive": 60,
        "cleansession": true,
        "autoUnsubscribe": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthRetain": "false",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closeRetain": "false",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willRetain": "false",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    }
]
Regards
janpep
Posts: 270
Joined: Thursday 14 March 2024 10:11
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: Stookwijzer (for Dutch users only)

Post by janpep »

FireWizard wrote: Friday 07 February 2025 16:42 These co-ordinates give the Lat/Lon values in WGS 84 format. This is equal to EPSG 4326.
However the new RIVM API uses a different system, EPSG 28992.
I also found out that RIVM stoookalert stopped working. Thanks for pointing me in the right direction.
However, I am not familiar with node red, and for now I want to keep it that way.
I already work with different syntaxes from so many languages, that I prefer to stick to the way I know, until it is really necessary to do it differently. In this case, I prefer to modify my script with dzvents.

I think I understand your explanation about getting the coordinates in a different format, and I can call the api for that.
What I do not understand is the Bbox. Is that a rectangle around the current location?
How you then calculate the coordinates for the Bbox. Can you say something about that?

In addition, I played with it manually. At a local level, it is quite similar to the solution I had already made with Dutch local 'Stookwijzer' based on local LKI and Windspeed.
There I also calculate the average prediction of the desired number of hours (with color code) and also show the expected LKI and wind speed. I consider that more complete and informative. So maybe I stick with that and will drop this one.
Previously, the RIVM only provided information for the entire province. There is little point in doing it twice locally, but I still wanted to see how things are and what the results are.
Dz on Ubuntu VM on DS718+ behind FRITZ!Box.
EvoHome; MELCloud; P1 meter; Z-Stick GEN5; Z-Wave-js-ui; Sonoff USB-Dongle Plus-E; Zigbee2Mqtt; MQTT; Greenwave powernodes 1+6; Fibaro switch, plugs, smoke; FRITZ!DECT 200. Scripts listed in profile interests.
User avatar
waltervl
Posts: 5853
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Stookwijzer (for Dutch users only)

Post by waltervl »

I have a dzvents script that I have to rebuild for this: https://github.com/waltervl/Domoticz-dzVents-Stookalert
You can take it as a base...
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
FireWizard
Posts: 1893
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Stookwijzer (for Dutch users only)

Post by FireWizard »

Hello @janpep.

You wrote:
I already work with different syntax's from so many languages, that I prefer to stick to the way I know, until it is really necessary to do it differently. In this case, I prefer to modify my script with dzvents.
I fully understand that and I would also stay with the languages, that feels comfortable.
I think I understand your explanation about getting the coordinates in a different format, and I can call the API for that.
That is not necessary anymore, if you use the second solution, that I published.
The first used URL has a query argument "CRS=EPSG:28992¨, while the second used URL has the query argument: "CRS=CRS:84"
So, with the second URL you can use the "standard" Lat/Lon coordinates in WGS84 format.
What I do not understand is the Bbox. Is that a rectangle around the current location?
How you then calculate the coordinates for the Bbox. Can you say something about that?
Indeed, a bbox or bounding box is a rectangular shape, and is also used as a box around detected objects in case of object detection.
A clear explanation you may find at: https://medium.com/@rajdeepsingh/a-quic ... 2119ddb76b
I concluded that RIVM uses the PASCAL VOC format.

And the coordinates are your Lat/Lon values, which become the x_min and y_min values (the coordinates for top-left corner of the bounding box)
I simple calculate the x_max and y_max (the coordinates for bottom-right corner of the bounding box) by adding 0.00001 to the coordinates of x_min and y_min. That creates a very small bbox and is sufficient for the RIVM API

More on bboxes: https://bboxconverter.readthedocs.io/en ... guide.html
There I also calculate the average prediction of the desired number of hours (with color code) and also show the expected LKI and wind speed. I consider that more complete and informative. So maybe I stick with that and will drop this one.
There is more data available in the response of the API then I use to Domoticz, so maybe you can use that other values.

Regards
janpep
Posts: 270
Joined: Thursday 14 March 2024 10:11
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: Stookwijzer (for Dutch users only)

Post by janpep »

waltervl wrote: Saturday 08 February 2025 13:59 I have a dzvents script that I have to rebuild for this: https://github.com/waltervl/Domoticz-dzVents-Stookalert
You can take it as a base...
With respect, but it looks like this script used my script as a base :-)
This is still the old route. My main question was about understanding the BBox coordinates and how they are calculated.
For the remaining stuff and new URL I already rebuild my dzvents script.
Dz on Ubuntu VM on DS718+ behind FRITZ!Box.
EvoHome; MELCloud; P1 meter; Z-Stick GEN5; Z-Wave-js-ui; Sonoff USB-Dongle Plus-E; Zigbee2Mqtt; MQTT; Greenwave powernodes 1+6; Fibaro switch, plugs, smoke; FRITZ!DECT 200. Scripts listed in profile interests.
janpep
Posts: 270
Joined: Thursday 14 March 2024 10:11
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: Stookwijzer (for Dutch users only)

Post by janpep »

FireWizard wrote: Saturday 08 February 2025 14:28 That is not necessary anymore, if you use the second solution, that I published.
The first used URL has a query argument "CRS=EPSG:28992¨, while the second used URL has the query argument: "CRS=CRS:84"
So, with the second URL you can use the "standard" Lat/Lon coordinates in WGS84 format.
Thank you very much for the explanation and the given information. I will look into it.
Dz on Ubuntu VM on DS718+ behind FRITZ!Box.
EvoHome; MELCloud; P1 meter; Z-Stick GEN5; Z-Wave-js-ui; Sonoff USB-Dongle Plus-E; Zigbee2Mqtt; MQTT; Greenwave powernodes 1+6; Fibaro switch, plugs, smoke; FRITZ!DECT 200. Scripts listed in profile interests.
janpep
Posts: 270
Joined: Thursday 14 March 2024 10:11
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: Stookwijzer (for Dutch users only)

Post by janpep »

OK. I have it working in dzVents script. Thank you.
With the Alert level, the code color, the message, the LKI and Windspeed of current time.
I will add the 6 hour, 12 hour and 18 hour forecast colored for the code in html.
After some more fine tuning and testing I will publish the script in a separate topic to avoid confusion with your approach.
Edit: Already implemented the forcast times (calculated from the first time)
RIVM-fromnewURL2.png
RIVM-fromnewURL2.png (51 KiB) Viewed 1429 times
Last edited by janpep on Saturday 08 February 2025 21:55, edited 2 times in total.
Dz on Ubuntu VM on DS718+ behind FRITZ!Box.
EvoHome; MELCloud; P1 meter; Z-Stick GEN5; Z-Wave-js-ui; Sonoff USB-Dongle Plus-E; Zigbee2Mqtt; MQTT; Greenwave powernodes 1+6; Fibaro switch, plugs, smoke; FRITZ!DECT 200. Scripts listed in profile interests.
janpep
Posts: 270
Joined: Thursday 14 March 2024 10:11
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: Stookwijzer (for Dutch users only)

Post by janpep »

I looked at the site https://www.atlasleefomgeving.nl/stookwijzer. It looks like it is updated at fixed times 4, 10, 16 and 22 hr.
Dz on Ubuntu VM on DS718+ behind FRITZ!Box.
EvoHome; MELCloud; P1 meter; Z-Stick GEN5; Z-Wave-js-ui; Sonoff USB-Dongle Plus-E; Zigbee2Mqtt; MQTT; Greenwave powernodes 1+6; Fibaro switch, plugs, smoke; FRITZ!DECT 200. Scripts listed in profile interests.
User avatar
FireWizard
Posts: 1893
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Stookwijzer (for Dutch users only)

Post by FireWizard »

Hi @janpep,
It looks like it is updated at fixed times 4, 10, 16 and 22 hr.
Yes, you are correct and in fact their website and also the API response is updated some minutes before those times.
Therefore I query the API only every 6 hours at 04:00h, 10:00h, 16:00h and 22:00h.
That is sufficient to get the most recent data.

Regards
janpep
Posts: 270
Joined: Thursday 14 March 2024 10:11
Target OS: Linux
Domoticz version: 2025.1
Location: Netherlands
Contact:

Re: Stookwijzer (for Dutch users only)

Post by janpep »

FireWizard wrote: Sunday 09 February 2025 14:36 Therefore I query the API only every 6 hours at 04:00h, 10:00h, 16:00h and 22:00h.
That is sufficient to get the most recent data.
Yes, it is what it is. I think I already prefer my own (hourly updated) Dutch local 'Stookwijzer'.
At the moment I am looking to the 10 hr RIVM alert, while situation is changed in the past 5 hours.
RIVM-fromnewURL3.png
RIVM-fromnewURL3.png (20.38 KiB) Viewed 870 times
Dz on Ubuntu VM on DS718+ behind FRITZ!Box.
EvoHome; MELCloud; P1 meter; Z-Stick GEN5; Z-Wave-js-ui; Sonoff USB-Dongle Plus-E; Zigbee2Mqtt; MQTT; Greenwave powernodes 1+6; Fibaro switch, plugs, smoke; FRITZ!DECT 200. Scripts listed in profile interests.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest