DWD WarnApp Sensor (amtliche Warnungen des deutschen Wetterdienstes)

You wouldn’t have example code to deal with weather alerts above a certain level?

Take a look here:

Thanks a lot

Documentation of the DWD sensor (https://www.home-assistant.io/components/sensor.dwd_weather_warnings/) mentions that the warning level ranges from 0 to 4, but mine shows 10:

grafik

How to interpret that?
I haven’t found any warning level details on the DVD homepage.

Thanks.

Then you should run! :joy:

Just kidding. I found one documentation on the DWD page: Wetterwarnungen. However, it also states warning levels ranging from 0 to 4. I don’t know which data basis is used for the DWD component. In the json-file, I also found the level 10.

{“regionName”:“Berlin”,“start”:1533718800000,“end”:1533834000000,“type”:8,“state”:“Berlin”,“level":10,“stateShort”:“BL”,“description”:“Am Mittwoch wird eine extreme Wärmebelastung erwartet.\nAm Donnerstag wird eine starke Wärmebelastung erwartet.\n”,“altitudeStart”:null,“altitudeEnd”:200,“headline”:“Amtliche WARNUNG vor HITZE”,“instruction”:” An beiden Tagen ist mit einer zusätzlichen Belastung aufgrund verringerter nächtlicher Abkühlung insbesondere im dicht bebauten Stadtgebiet von Berlin zu rechnen.Heute ist der 2. Tag der Warnsituation in Folge.\n",“event”:“HITZE”}]

No idea what this means. So I guess, the component works correctly but the interpretation of the data is somehow misleading.

Edit: to be honest, level 10 is even too small for the current heat :sweat:

DWD Warning stopped working.
Seeing this error the whole day every 15 minutes in my log.

2018-08-31 21:37:24 ERROR (SyncWorker_4) [homeassistant.components.sensor.rest] Error fetching data: <PreparedRequest [GET]> from https://www.dwd.de/DWD/warnungen/warnapp_landkreise/json/warnings.json?jsonp=loadWarnings failed with HTTPSConnectionPool(host=‘www.dwd.de’, port=443): Max retries exceeded with url: /DWD/warnungen/warnapp_landkreise/json/warnings.json?jsonp=loadWarnings (Caused by SSLError(SSLError(1, ‘[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)’),))
2018-08-31 21:37:24 ERROR (SyncWorker_4) [homeassistant.components.sensor.dwd_weather_warnings] Unable to fetch data from DWD-Weather-Warnings

Can someone confirm this?

EDIT: Also my generic cameras with pictures from dwd stopped working.
When i open the api url or the images in my browser, they work.
Has HA a problem with it?

1 Like

When I open the api url in a browser, I get the following error:

“SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data”

I think the json result is malformatted.

Github issue:

Actually the result depends from browser to browser. Firefox is throwing the error you mentioned, Chrome is working fine.

Depends which certs are included in the browsers or operating systems CA cert chain.
Chrome includes the intermediate CA certs of https://www.pki.dfn.de/ueberblick-dfn-pki/ which have been used to issue the cert “www.dwd.de”, which enabled Chrome to fully validate the cert, but Mozilla is lacking those CA certs.
I have added the two missing CA certs into my RasPis /etc/ssl/certs, now wget works, but home-assistant still doesn’t.

After adding the missing CA certs to lib/python3.5/site-packages/certifi/cacert.pem the DWD weather warnings are working!

Is it possible to do this in hassio?

I would think so, if you know how. You have to find out how to ssh to your RasPi (AFAIR port 222, instead of the hass.io-container which listens on default ssh-port 22) and find out where the files are. (in my case: /srv/homeassistant, then see above)

Or wait until the certs are updated in one of the next versions, which would be the correct solution.

where exactly did you get the two CA certs? here? https://www.pki.dfn.de/wurzelzertifikate/globalroot2/

I had the exact same thing in my head. Maybe exported the cert from the homepage?

I googled the names of the intermediate certs that I saw in the ‘www.dwd.de’-cert, payed attention that what I’ve found was from DFN-websites, compared the cert-fingerprints and downloaded them:
https://www.pki.dfn.de/fileadmin/PKI/zertifikate/DFN-Verein_Certification_Authority_2.pem
http://cdp.pca.dfn.de/dfn-ca-global-g2/pub/cacert/cacert.pem

2 Likes

that worked. thanks!

After sending an email to dwd about the cert, i got an answer today that they made some modifications.
Everything works now as before, no need to copy the certs.

THX to DWD! :+1:

3 Likes

Wow, thank you for your effort :+1:

Thanks for the plugin!

Occasionally, I see some “sensor xxx is taking over 10 seconds” log entries. That’s why I started changing the component so it uses the new WFS API instead of the JSON file. While the JSON file contains all regions, WFS allows filtering.
I looked at the data and realised that no warning level in terms of integer is provided. Nevertheless, there is a key “dwd:SEVERITY” containing a string rating.
Does any of you know how to map e.g. “Moderate” to an integer value?

My current progress and an example API response (attached at the end) can be found here:

Thanks!