Skip to content

Instantly share code, notes, and snippets.

@kingo55
Last active September 7, 2020 09:20
Show Gist options
  • Save kingo55/4e928b715e833fe656274680889a23a7 to your computer and use it in GitHub Desktop.
Save kingo55/4e928b715e833fe656274680889a23a7 to your computer and use it in GitHub Desktop.
Get alerts when COVID cases rise in your Melbourne suburb with Home Assistant

Get alerts when COVID cases rise in your Melbourne suburb with Home Assistant

Using the State Government's postcode data, you can scrape active cases from your suburb and recieve notifications/alerts when the situation changes.

1. Add a CLI sensor

Update it to replace 3182 with your suburb's postcode:

sensor:
  - platform: command_line
    name: 3182 active COVID
    command: "curl -L 'https://docs.google.com/spreadsheets/d/e/2PACX-1vTwXSqlP56q78lZKxc092o6UuIyi7VqOIQj6RM4QmlVPgtJZfbgzv0a3X7wQQkhNu8MFolhVwMy4VnF/pub?gid=0&output=csv' | grep ^3182 | awk -F, '{print $3}'"
    unit_of_measurement: cases

2. Add notifications for your phone (or other service)

Here's an example of an automation using the Home Assistant app to get updates:

automation:
  - alias: Notify change in COVID cases
    trigger:
      - platform: state
        entity_id: sensor.3182_active_covid
    action:
      service: notify.mobile_app_pixel_xl
      data_template:
        title:  St Kilda COVID cases updated
        message: "Now {{ states('sensor.3182_active_covid') }} active cases"

And it works great in Lovelace.

Whilst I wish I'd thought of this sooner, we're prepared if there's ever a 3rd wave of cases to hit our suburb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment