Skip to content

Instantly share code, notes, and snippets.

@shermozle
Created September 7, 2020 10:53
Show Gist options
  • Save shermozle/4228352889cbbdec3a531cfba7beeef9 to your computer and use it in GitHub Desktop.
Save shermozle/4228352889cbbdec3a531cfba7beeef9 to your computer and use it in GitHub Desktop.
Get Australian COVID-19 numbers into Home Assistant

Show COVID-19 numbers in Home Assistant

Using Juliette's amazing COVID-19 Data site to chart numbers in Home Assistant. Inspired by Rob Kingston's gist as tweeted.

1. Add CLI sensors

  - platform: command_line
    name: NSW new COVID
    command: "curl -L 'https://infogram.com/api/live/data/426204011/1597015595690/' | jq '.[\"data\"][0][8][1] | tonumber'"
    unit_of_measurement: cases
  - platform: command_line
    name: VIC new COVID
    command: "curl -L 'https://infogram.com/api/live/data/426204011/1597015595690/' | jq '.[\"data\"][0][8][2] | tonumber'"
    unit_of_measurement: cases
  - platform: command_line
    name: QLD new COVID
    command: "curl -L 'https://infogram.com/api/live/data/426204011/1597015595690/' | jq '.[\"data\"][0][8][3] | tonumber'"
    unit_of_measurement: cases
  - platform: command_line
    name: SA new COVID
    command: "curl -L 'https://infogram.com/api/live/data/426204011/1597015595690/' | jq '.[\"data\"][0][8][4] | tonumber'"
    unit_of_measurement: cases
  - platform: command_line
    name: WA new COVID
    command: "curl -L 'https://infogram.com/api/live/data/426204011/1597015595690/' | jq '.[\"data\"][0][8][5] | tonumber'"
    unit_of_measurement: cases
  - platform: command_line
    name: TAS new COVID
    command: "curl -L 'https://infogram.com/api/live/data/426204011/1597015595690/' | jq '.[\"data\"][0][8][6] | tonumber'"
    unit_of_measurement: cases
  - platform: command_line
    name: NT new COVID
    command: "curl -L 'https://infogram.com/api/live/data/426204011/1597015595690/' | jq '.[\"data\"][0][8][7] | tonumber'"
    unit_of_measurement: cases
  - platform: command_line
    name: ACT new COVID
    command: "curl -L 'https://infogram.com/api/live/data/426204011/1597015595690/' | jq '.[\"data\"][0][8][8] | tonumber'"
    unit_of_measurement: cases
  - platform: command_line
    name: National new COVID
    command: "curl 'https://infogram.com/api/live/data/521336555/1596507705151/' |jq '.[\"data\"][0][-1][1] | tonumber'"
    unit_of_measurement: cases

Then you can use the new metrics in charts for the dashboard. Or do something with notifications, something I haven't really got my head around yet and will crib from Rob.

I can see a problem doing notifications with these numbers. If one of them is the same two days in a row, there'll be no change to notify on.

@philhawthorne
Copy link

If one of them is the same two days in a row, there'll be no change to notify on.

You can always setup an automation to trigger the notification at the same time every day, so that even if the numbers don't change you still get a notification

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