Coronavirus Integration

Note: Please, be aware that this post may contain affiliate links.

Clipped screenshot of my layout of the Coronavirus data
My layout (instructions below)

Thanks to the wonderful Folks at Home Assistant, you can now follow the progress of the Coronavirus in Home Assistant.

In this post, I’m going to show you an easy way and an easier way to display Coronavirus data for your country. Then you can keep an eye on those figures.

This is thanks to the other group of people responsible at the Johns Hopkins University.

The special integration is part of update 0.106.3, more details on it can be found on the Home Assistant Blog

You may notice that in some of the images my entities go like “sensor.uk_confirmed” instead of “sensor.uk_coronavirus_confirmed”. This is due to the updates in 0.106.4

Step 1: Add the integration

In this post, I’m going to show you how to set up the data and show you a couple of ways to display it.

Go to the Configuration page in your instance of Home Assistant, and click on “Integrations”.

Then click on the plus icon in the lower right corner, and search for the “Coronavirus” integration.

You can then either find your country or select “Worldwide” at the top, in order to get global figures. Once that’s done you will then receive the notification saying the integration was added successfully.

Step 2: Add the card

The easy option

Click on the plus icon to add a card.

If it’s just the stats your interested in, and you’re happy with the default presentation, then select the “Glance” card type.

Screenshot of the cards available when adding a card to Lovelace

Type “sensor.worldwide_coronavirus_” for the worldwide stats in the entities box for the worldwide stats (obviously). Or if you’re after your country then replace “worldwide” with your country code, for example, here in the UK it would be “sensor.uk_coronavirus_” (although I have used the US in the screenshots).

Screenshot of the filtered entity results showing only the Coronavirus entities

You have 4 statistics available to you: they are

  • Confirmed cases eg sensor.uk_coronavirus_confirmed
  • Current cases eg sensor.uk_coronavirus_current
  • Deaths eg sensor.uk_coronavirus_deaths
  • Recovered eg sensor.uk_coronavirus_recovered

Screenshot of the 4 available Coronavirus results selected

Then add the same for as many countries as you added integrations.

Screenshot of 8 entities selected, 4 for a country and 4 worldwide

Manual option

Screenshot of my personal setup of the Coronavirus statistics
I chose to go for a more custom option

I have gone for a more aesthetically pleasing layout, and no doubt others will pass the figures through to InfluxDB and Grafana for charts (let me know if you want me to go through this option also).

Instead of going for the “Glance” card, select “Manual card”

You can see that the icons I have used are the same ones that are in the Home Assistant Blog post linked to at the top of the page.

I have also added sections with labels instead of having several titles and/or verbose labels on the entities themselves

type: 'custom:vertical-stack-in-card'
title: Coronavirus
cards:
  - type: entities
    entities:
      - type: section
        label: United Kingdom
  - type: glance
    entities:
      - entity: sensor.uk_coronavirus_confirmed
        name: Confirmed
        icon: 'mdi:emoticon-neutral-outline'
      - entity: sensor.uk_coronavirus_current
        name: Current
        icon: 'mdi:emoticon-frown-outline'
      - entity: sensor.uk_coronavirus_deaths
        name: Deaths
        icon: 'mdi:emoticon-sad-outline'
      - entity: sensor.uk_coronavirus_recovered
        name: Recovered
        icon: 'mdi:emoticon-happy-outline'
  - type: entities
    entities:
      - type: section
        label: Worldwide
  - type: glance
    entities:
      - entity: sensor.worldwide_coronavirus_confirmed
        name: Confirmed
        icon: 'mdi:emoticon-neutral-outline'
      - entity: sensor.worldwide_coronavirus_current
        name: Current
        icon: 'mdi:emoticon-frown-outline'
      - entity: sensor.worldwide_coronavirus_deaths
        name: Deaths
        icon: 'mdi:emoticon-sad-outline'
      - entity: sensor.worldwide_coronavirus_recovered
        name: Recovered
        icon: 'mdi:emoticon-happy-outline'
    columns: 4
    show_icon: true
    show_state: true

You can also see that I have used the “Vertical Stack In Card”, by the brilliant 16-year-old developer Ofek Ashery (Twitter link), which can be found at https://github.com/ofekashery/vertical-stack-in-card and can be added through HACS.

Step 3: Tidy up

I may even go 1 step further and remove the “people” unit of measurement, but that is for later.

Grandadevans

I am a disabled veteran of 3 tours of Iraq and a tour of Afghanistan as part of the British Army. No longer able to work as I have to lay down on a sofa-bed in my living room 20-ish hours a day. I'm hoping to be able to make a living blogging about my Home Automation /Smart Home journey and maybe regain some dignity in life.

Leave a Reply