Daily coronavirus update with basic scraper sensor and notifications through Alexa integration

Tags: #<Tag:0x00007f7807413d28> #<Tag:0x00007f7807413c38>

Kudos to Home-Assistant who recently added a Coronavirus integration. My initial setup included information for Canada and also Worldwide. As I wanted something more regional, I though why not use the scrape sensor and retrieve data at the province level. So I did just that based on Quebec official COVID-19 page that is updated once a day, right before our PM’s press conference around 1 PM.

As a bonus, since we have to work from home and have three kids to entertain as well, I though Alexa could tell us the actual results because we don’t always have time to watch the press conference or the news. This was fairly easy since I already had the Alexa Media Player integration for some other automations in the house.

Thought you might appreciate the result. :sunglasses:

Lovelace card

Alexa demo

1 Like

JF, I like what you did but can you post your code? Transcribing it from a video is no fun.

It was in a Costco today and saw some guy sneeze into his hand. That made several people (including me) turn 180 degrees and give the guy a lot more than 2 meters of “social distancing”. I then watched him pick up and examine a bag of chips (just looking, not buying) and move on to handle some other product.

I’d like to think it was all part of Juste Pour Rire! and there was a hidden camera somewhere recording my disgusted reaction. However, I think he was just inexcusably ignorant and even Juste Pour Rire wouldn’t stoop this low for a cheap laugh.

Stay safe and thanks for sharing your project.

Hey Taras,

Of course I can share. It’s my first post here in the HA community forum so I need to make an habit of sharing code as well.


  - platform: scrape
    name: Coronavirus QC
    resource: https://www.quebec.ca/en/health/health-issues/a-z/2019-coronavirus/situation-coronavirus-in-quebec/
    select: "#c47903 > div > div > p:nth-child(1)"


- id: coronavirus_outbreak_update
  alias: Coronavirus outbreak update
  - platform: time
    at: '09:30:00'
  - platform: time
    at: '12:30:00'
  - platform: time
    at: '18:30:00'
  - condition: state
    entity_id: input_boolean.quarantine
    state: 'on'
  - service: notify.alexa_media
        type: announce
        - group.alexas
      message: 'Hey guys. Time for the Coronavirus Update. {{states("sensor.coronavirus_qc") }}'

You’ll notice that there is an input_boolean in the condition that must be on for the entire automation to be triggered. I conveniently called it Quarantine Mode and placed in somewhere in my dashboard to activate/deactivate.

I use the same input_boolean to make Alexa tell the kids to go play outside or go read in their rooms at some key moments in the day.

If you ever use the integration or make it better, please share it back!

1 Like