Coronavirus data for the German state of Hessen

While the existing coronavirus integration in HA is really helpful to pull in data for countries, the source it’s pulling its data from does not provide granularity down to county or even state level for Germany. At least for the state of Hessen however the Hessisches Ministerium für Soziales und Integration (ministry of social affairs) provides the data on their website.

So I sat down and wrote my first integration ever, “Coronavirus Hessen”, copying heavily from the existing integration and the web scraper component:

image

Installation instructions are in the README, HACS works too if you add the repo as a custom repository.

Maybe this helps someone else :slight_smile:

Like the official integration you can create sensors for all of Hessen or individual counties as listed on the ministry’s page, via HA’s own Integrations menu. It uses one updater for all configured sensors, with a scan interval of 12h, since the ministry only updates the page once per day anyhow and I didn’t want to cause too much traffic with polling. I’ll see how well that works in practice, I might yet change it to 6h or something.

Also, since this is my first integration, I’m happy for any kind of pointers on how to do things better where possible. I’m taking this as an opportunity to learn the ropes around HA development as well :wink: I would be especially interested into any hints regarding the two TODO items I listed in the README :sweat_smile:

Great buddy! Is there a way to change the settings in to Bayern?

I fear not. It actually scrapes the web page of the hessian ministry of health, adapting to other websites would require pretty much a completely different implementation. A fork would be the recommended way to go here.

Also, last I checked you might be able to access this kind of data from the RKI arcgis APIs as well now, so a simple rest sensor might all you need. When I created the above a year ago, that was not yet as easy.