I use the COVID-19 integration. There is publically available data on the number of vaccines given. Is it possible to add this to the integration? Some good news for once?
I’ve been getting data from Johns Hopkins for some time now.
I’ve built this simple python script.
Feel free to use it (remember to replace your country’s name).
You can implement it in HA, as a command_line sensor.
import requests
import json
p = 'https://jhucoronavirus.azureedge.net/jhucoronavirus/global_vaccines.json'
page = requests.get(p)
data = json.loads(page.content)
counter = 0
def find():
global counter
if(data[counter]['country'] == 'Greece'):
x = data[counter]
doses = int(x['data']['doses_admin'])
full = int(x['data']['raw_full_vac'])
per = x['data']['percent_full_vac']
percent = round(float(per),1)
f = json.dumps({"Percent":percent,"Doses":doses,"Completed":full})
print (f)
else:
counter = counter + 1
find()
find ()
For anyone trying to get this working for the US you need to change json_attributes_path: "$.[56].data" to json_attributes_path: "$.[150].data" I found the object number by pasting the json from https://jhucoronavirus.azureedge.net/jhucoronavirus/global_vaccines.json into http://jsonviewer.stack.hu/ and was able to browse it in the viewer by payload and numbers. Anyone needing any other country can use the same site to explore the payload numbers
Actually Germany changed to 53 and I needed to change my YAML multiple times.
On my iPad I’m using the “search on page” function and search "country“. When I’ve found Germany the counted result minus 1 is the necessary number.
It’s my actual workaround as I didn’t had the time to find out how JSON could be checked for needed country yet. Perhaps some experts can provide us a useful hint before.
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.
Sorry if my comments below might be controversial or offending. I haven’t been on here long so hope it’s not taken as spam or as a bot … etc etc
If anyone has researched the true science of what is going lately it looks like the Covid Pandemic is rapidly evolving into an Endemic…
What does that mean. ?
You can now go back to your life again . Enjoy life and have some fun before you forget what fun is.
Having an actual “App” on HA just for Covid is getting into “over fear” territory if you ask me , but that’s just my opinion. You only have to turn the TV on every day to get showered but that stuff 24/7…
Do you really need (up to the nearest second) updates on your HA Dashboard, or have your lights automatically turn on when a new Covid case comes up with in the last 10 minute . Lol. Really …
There are a billion things out there trying to kill you every day…
Driving a car, riding a motorcycle, drinking alcohol, smoking, mother Nature in general… Those are more likely to statistically kill you than Covid…
Maybe this App has had its day… Just saying …. why do you have it ?