COVID-19 Vaccination Tracker

During the last days the country position changed several times. This lead me to read some more documentation and make some more tests to find the generic way to filter a country.

Here‘s the resulting configuration.yaml:

- platform: rest
  name: covid_vaccination_germany
  resource: https://jhucoronavirus.azureedge.net/jhucoronavirus/global_vaccines.json
  json_attributes_path: '$.[?(@.country == "Germany")].data'
  json_attributes:
    - doses_admin
    - raw_full_vac
    - percent_full_vac
    - date
  value_template: 'Germany'
- platform: template
  sensors:
    covid_germany_administered:
      value_template: '{{ states.sensor.covid_vaccination_germany.attributes["doses_admin"] | round(0) }}‘
      unit_of_measurement: '#'
    covid_germany_raw_full:
      value_template: '{{ states.sensor.covid_vaccination_germany.attributes["raw_full_vac"] | round(0) }}'
      unit_of_measurement: '#'
    covid_germany_first:
      value_template: "{{ states('sensor.covid_germany_administered') | int - states('sensor.covid_germany_raw_full') | int }}"
      unit_of_measurement: '#'
    covid_germany_percent_full
      value_template: '{{ states.sensor.covid_vaccination_germany.attributes["percent_full_vac"] | round(2) }}'
      unit_of_measurement: '%'

Just replace “Germany” by any country of your choice, which is include in the JSON.

1 Like