DWD WarnApp Sensor (amtliche Warnungen des deutschen Wetterdienstes)

Due to the latest bad weather events I have created a new sensor.

5 Likes

This is great!
Since yesterday i have a generic camera with Weatherwarning Pictures from DWD
Maybe a feature for your app?

- platform: generic
  still_image_url: http://www.dwd.de/DWD/warnungen/warnstatus/SchilderMS.jpg
  name: DWD Warnungen

Links here. Thanks @RubenKelevra

Hi @runningman84, thank you for your hard work, integrating the sensor into HA.
I followed the PR and think it’s not easy.

There’s a little problem with the docs:

sensor:
  - platform: dwdwarnapp

Results in Error on HA start:

Failed config
  General Errors: 
    - Platform not found: sensor.dwdwarnapp

If i use - platform: dwd_weather_warnings like statet in your PR, everything works.

yes the docs were still using the old name, this is a fix for the docs:
https://github.com/home-assistant/home-assistant.github.io/pull/3335

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