Flow to display the UV index of the DWD

The "Deutscher Wetterdiest" (German Weather Service) serves as the source.

Only data for Germany!

The data is updated only once a day at 10:00 a.m. by the DWD. Therefore only one query time is given here.

This should be shifted temporally possibly, so that not everyone queries the data at the same time.

Example UI:

UI

Homepage

[{"id":"e2da901a.575fb8","type":"inject","z":"1e47caf.81f0ab5","name":"Täglich um 10:10","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"10 11 * * *","once":false,"onceDelay":0.1,"x":290,"y":1160,"wires":[["41658588.c74dfc"]]},{"id":"63447279.db06b4","type":"http request","z":"1e47caf.81f0ab5","name":"Data from DWD","method":"GET","ret":"obj","paytoqs":false,"url":"https://opendata.dwd.de/climate_environment/health/alerts/uvi.json","tls":"498c6e5f.1070f","proxy":"","authType":"basic","x":1100,"y":1160,"wires":[["597d86f0.684828"]]},{"id":"2f375f4f.5acc98","type":"ui_gauge","z":"1e47caf.81f0ab5","name":"UV-Index, Donut","group":"f3226a92.995758","order":6,"width":2,"height":"3","gtype":"donut","title":"","label":"","format":"{{msg.payload.Index}}","min":0,"max":"11","colors":["#087379","#ffbf00","#c80000"],"seg1":"2","seg2":"7","x":1580,"y":1160,"wires":[]},{"id":"597d86f0.684828","type":"function","z":"1e47caf.81f0ab5","name":"DWD, UV-Index-Text","func":"var iUV = -1;\n\nfor (i = 0; i < msg.payload.content.length; i++) {\n    if (msg.payload.content[i].city == msg.city) {\n        iUV = msg.payload.content[i].forecast.today;\n    }\n}\n\nmsg.payload.Index = iUV\n\nswitch (true) {\n    case (iUV > 0 && iUV <= 2):\n        msg.payload.UvText    = \"Niedrig\";\n        msg.payload.UvMessage = \"Kein Schutz erforderlich.\";\n        break;\n    case (iUV >= 3 && iUV <= 5):\n        msg.payload.UvText    = \"Mäßig\";\n        msg.payload.UvMessage = \"Schutz erforderlich.\";\n        break;\n    case (iUV >= 6 && iUV <= 7):\n        msg.payload.UvText    = \"Hoch\";\n        msg.payload.UvMessage = \"Schutz erforderlich.<br>Mittags den Schatten suchen.\";\n        break;\n    case (iUV >= 8 && iUV <= 10):\n        msg.payload.UvText    = \"Sehr hoch\";\n        msg.payload.UvMessage = \"Zusätzlicher Schutz erforderlich.<br>Aufenthalt im Freien möglichst vermeiden.<br><u>Aufenthalt im Freien zwischen 11 und 15 Uhr vermeiden.</u>\";\n        break;\n    case (iUV >= 11):\n        msg.payload.UvText    = \"Extrem\";\n        msg.payload.UvMessage = \"Zusätzlicher Schutz erforderlich.<br>Aufenthalt im Freien möglichst vermeiden.<br><u>Im Haus bleiben.</u>\";\n        break;\n    default:\n        msg.payload.UvText    = \"ERR\";\n        msg.payload.UvMessage = \"ERR\";\n}\n\nnode.status({text: msg.city + \": \" + msg.payload.UvText});\n\nreturn msg;","outputs":1,"noerr":0,"x":1300,"y":1160,"wires":[["88c83bc5.ecae78","2f375f4f.5acc98"]]},{"id":"88c83bc5.ecae78","type":"ui_text","z":"1e47caf.81f0ab5","group":"f3226a92.995758","order":7,"width":4,"height":"3","name":"UV-Index Empfehlung, Text","label":"UV-Index: {{msg.payload.Index}}, {{msg.payload.UvText}}","format":"{{msg.payload.UvMessage}}","layout":"col-center","x":1620,"y":1200,"wires":[]},{"id":"3d86d871.05ddf8","type":"comment","z":"1e47caf.81f0ab5","name":"Abfrage UV-Index","info":"","x":1100,"y":1120,"wires":[]},{"id":"ed972e78.f1d428","type":"ui_dropdown","z":"1e47caf.81f0ab5","name":"","label":"Stadt / Gebiet","tooltip":"","place":"Stadt","group":"f3226a92.995758","order":5,"width":0,"height":0,"passthru":true,"multiple":false,"options":[{"label":"Arkona","value":"Arkona","type":"str"},{"label":"Berlin","value":"Berlin","type":"str"},{"label":"Bonn","value":"Bonn","type":"str"},{"label":"Bremen","value":"Bremen","type":"str"},{"label":"Cottbus","value":"Cottbus","type":"str"},{"label":"Dresden","value":"Dresden","type":"str"},{"label":"Düsseldorf","value":"Düsseldorf","type":"str"},{"label":"Frankfurt/Main","value":"Frankfurt/Main","type":"str"},{"label":"Freiburg","value":"Freiburg","type":"str"},{"label":"Großer Arber","value":"Großer Arber","type":"str"},{"label":"Hahn","value":"Hahn","type":"str"},{"label":"Hamburg","value":"Hamburg","type":"str"},{"label":"Hannover","value":"Hannover","type":"str"},{"label":"Kahler Asten","value":"Kahler Asten","type":"str"},{"label":"Kassel","value":"Kassel","type":"str"},{"label":"Kiel","value":"Kiel","type":"str"},{"label":"Konstanz","value":"Konstanz","type":"str"},{"label":"Leipzig","value":"Leipzig","type":"str"},{"label":"List auf Sylt","value":"List auf Sylt","type":"str"},{"label":"Magdeburg","value":"Magdeburg","type":"str"},{"label":"Marienleuchte","value":"Marienleuchte","type":"str"},{"label":"München","value":"München","type":"str"},{"label":"Neubrandenburg","value":"Neubrandenburg","type":"str"},{"label":"Norderney","value":"Norderney","type":"str"},{"label":"Nürnberg","value":"Nürnberg","type":"str"},{"label":"Osnabrück","value":"Osnabrück","type":"str"},{"label":"Regensburg","value":"Regensburg","type":"str"},{"label":"Rostock","value":"Rostock","type":"str"},{"label":"Sankt Peter-Ording","value":"Sankt Peter-Ording","type":"str"},{"label":"Seehausen","value":"Seehausen","type":"str"},{"label":"Stuttgart","value":"Stuttgart","type":"str"},{"label":"Ulm","value":"Ulm","type":"str"}],"payload":"","topic":"","x":700,"y":1160,"wires":[["f9ea14ba.4e07b8"]]},{"id":"41658588.c74dfc","type":"change","z":"1e47caf.81f0ab5","name":"Default: Stadt / Gebiet","rules":[{"t":"set","p":"payload","pt":"msg","to":"München","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":1160,"wires":[["ed972e78.f1d428"]]},{"id":"f9ea14ba.4e07b8","type":"change","z":"1e47caf.81f0ab5","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"city","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":900,"y":1160,"wires":[["63447279.db06b4"]]},{"id":"498c6e5f.1070f","type":"tls-config","z":"","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":false},{"id":"f3226a92.995758","type":"ui_group","z":0,"name":"Wetterlage","tab":"2e9e8174.f36d1e","order":1,"disp":true,"width":"6","collapse":false},{"id":"2e9e8174.f36d1e","type":"ui_tab","z":"","name":"Wetter","icon":"wb_sunny","order":1,"disabled":false,"hidden":false}]

Flow Info

Created 4 years, 9 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x2)
  • comment (x1)
  • function (x1)
  • http request (x1)
  • inject (x1)
  • tls-config (x1)
Other

Tags

  • UV
  • DWD
  • Deutscher
  • Wetterdienst
  • Index
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option