Coronavirus broke

Coronavirus Integration was working and then 0.106.5 it broke:

The worldwide works but the US one doesn’t. Have two separate additions one for each. Get:

2020-03-04 19:53:44 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 278, in async_add_entities
for entity in new_entities
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 275, in
self._async_add_entity(
File “/usr/src/homeassistant/homeassistant/components/coronavirus/sensor.py”, line 15, in
for info_type in (“confirmed”, “recovered”, “deaths”, “current”)
File “/usr/src/homeassistant/homeassistant/components/coronavirus/sensor.py”, line 30, in init
self.name = f"{coordinator.data[country].country} Coronavirus {info_type}"
TypeError: ‘NoneType’ object is not subscriptable

Note I deleted the integration and added again and then was working. Rebooted and same error again and both are reporting unavailable.

1 Like

Same here (but for Australia)

Australia working here
image

I noticed the same problem. Remove and re-add them. The format changed for some reason. For example, for recovered, I believe it was originally sensor.us_recovered but now it’s showing as sensor.us_coronavirus_recovered. Worldwide was always sensor.worldwide_coronavirus_recovered which is why it still works.

EDIT: Saw that you had removed and readded and problem started again after restart. Not sure why as I’ve restarted multiple times trying to track down a harmony remote issue and it still reports properly.

That’s funny. I’m actually playing with Harmony remote issues as well.

Mine still ‘breaks’ after every restart

I deleted mine and re-added integration. Worked fine until a restart. Please confirm yours “survives” a restart.

same here, broke after update

To humour you I restarted just now and yes it survives a restart. Still working fine.

Odd. After reinstalling the coronavirus integration and selecting US did also see the entity names changed. Woke up this morning and Wordwide was working and US was showing unavailable. Removed and added again and my lovelace card started up again.

Looks like Broke again.

2020-03-07 14:10:58 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 278, in async_add_entities
    for entity in new_entities
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 275, in <listcomp>
    self._async_add_entity(
  File "/usr/src/homeassistant/homeassistant/components/coronavirus/sensor.py", line 15, in <genexpr>
    for info_type in ("confirmed", "recovered", "deaths", "current")
  File "/usr/src/homeassistant/homeassistant/components/coronavirus/sensor.py", line 30, in __init__
    self.name = f"{coordinator.data[country].country} Coronavirus {info_type}"
TypeError: 'NoneType' object is not subscriptable

Bet if I install AGAIN it will come back. Love this integration but having some minor challenges.

I blame Trump!

Gotta be some kind of conspiracy. Now I can’t even add it back in. I select coronavirus integration and a little window opens probably to pick the location and then the main integration list comes back on top of it and can’t add another one. Pick something else and those seem to work.

AttributeError: 'NoneType' object has no attribute 'values'
2020-03-07 14:45:15 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 135, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 123, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 130, in post
    return await super().post(request)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 50, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 62, in post
    handler, context={"source": config_entries.SOURCE_USER}
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 109, in async_init
    result = await self._async_handle_step(flow, flow.init_step, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 172, in _async_handle_step
    result: Dict = await getattr(flow, method)(user_input)
  File "/usr/src/homeassistant/homeassistant/components/coronavirus/config_flow.py", line 30, in async_step_user
    coordinator.data.values(), key=lambda case: case.country
AttributeError: 'NoneType' object has no attribute 'values'

Maybe try another one.
I think the data sources change now that there’s more traffic.

Thanks was just about to try this and Worldwide started working again. So tried adding my US one back in and worked this time.

image

Ugh, think I’ll just wait and hope things get fixed for a while before finding another integration.

image

Mine is broken as well. Removed integration and upon adding it back it only allows worldwide as a selection option.

which is the polling update interval? Can it be changed?

Quit for me a couple of hours ago. I was able to reinstall it for US, but still “unavailable”.

Edit: It’s back

Coronavirus Integration via NR straight from WHO. Import the below config and change the country name node.

[{"id":"10cbe271.08c8ae","type":"www-request","z":"39d45ee1.7a82b2","name":"","method":"GET","ret":"txt","url":"https://services.arcgis.com/5T5nSi527N4F7luB/arcgis/rest/services/COVID_19_CasesByCountry(pt)_VIEW/FeatureServer/0/query?f=json&where=1%3D1&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&orderByFields=cum_conf%20desc&resultOffset=0&resultRecordCount=115&cacheHint=true","follow-redirects":true,"persistent-http":true,"tls":"","x":510,"y":200,"wires":[["4e4d99e0.686f28"]]},{"id":"b15d752e.3c4af8","type":"inject","z":"39d45ee1.7a82b2","name":"","topic":"","payload":"","payloadType":"date","repeat":"1800","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":200,"wires":[["6e45df48.472e5"]]},{"id":"4e4d99e0.686f28","type":"json","z":"39d45ee1.7a82b2","name":"Convert to object","property":"payload","action":"","pretty":false,"x":730,"y":200,"wires":[["cbb8b069.848d5"]]},{"id":"cbb8b069.848d5","type":"function","z":"39d45ee1.7a82b2","name":"calculate","func":"obj = msg.payload;\ncountry = flow.get(\"country\");\nvar errorProp = 'error';\nif(obj.hasOwnProperty(errorProp)){\n    msg.payload = {'total_cases': '0', 'total_death': '0', 'total_cases_country': '0', 'total_cases_country_death': '0'}\n}\nelse\n{\n    total_cases = 0;\n    total_death = 0;\n    total_cases_country = 0;\n    total_cases_country_death = 0;\n    \n    for (const key of obj.features) \n    {   total_cases = total_cases + key.attributes.cum_conf;\n        total_death = total_death + key.attributes.cum_death;\n\n        if(key.attributes.ADM0_NAME == country)\n            {\n                total_cases_country = total_cases_country + key.attributes.cum_conf;\n                total_cases_country_death = total_cases_country_death + key.attributes.cum_death;\n            }\n    }\n    msg.payload = {'total_cases': total_cases, 'total_death': total_death, 'total_cases_country': total_cases_country, 'total_cases_country_death': total_cases_country_death}\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":940,"y":200,"wires":[["5967ddab.b63364","be521acc.58ee48","93a9cbb8.aea688","890ca730.2bd008"]]},{"id":"6e45df48.472e5","type":"change","z":"39d45ee1.7a82b2","name":"Country Name","rules":[{"t":"set","p":"country","pt":"flow","to":"INDIA","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":200,"wires":[["10cbe271.08c8ae"]]},{"id":"f1c50216.cdb31","type":"comment","z":"39d45ee1.7a82b2","name":"Fetch COVID19 Cases","info":"","x":140,"y":160,"wires":[]},{"id":"5967ddab.b63364","type":"ha-entity","z":"39d45ee1.7a82b2","name":"Covid19 Wordwide","server":"82494656.b2ac98","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"Covid19 Wordwide Cases"},{"property":"device_class","value":"none"},{"property":"icon","value":"mdi:biohazard"},{"property":"unit_of_measurement","value":""}],"state":"payload.total_cases","stateType":"msg","attributes":[{"property":"name","value":"covid19","valueType":"str"}],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":1190,"y":80,"wires":[[]]},{"id":"be521acc.58ee48","type":"ha-entity","z":"39d45ee1.7a82b2","name":"Covid19 Wordwide Deaths","server":"82494656.b2ac98","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"Covid19 Wordwide Deaths"},{"property":"device_class","value":"none"},{"property":"icon","value":"mdi:emoticon-dead"},{"property":"unit_of_measurement","value":""}],"state":"payload.total_death","stateType":"msg","attributes":[{"property":"name","value":"covid19_death","valueType":"str"}],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":1220,"y":140,"wires":[[]]},{"id":"93a9cbb8.aea688","type":"ha-entity","z":"39d45ee1.7a82b2","name":"Covid19 Country Specific","server":"82494656.b2ac98","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"Covid19 India Cases"},{"property":"device_class","value":"none"},{"property":"icon","value":"mdi:biohazard"},{"property":"unit_of_measurement","value":""}],"state":"payload.total_cases_country","stateType":"msg","attributes":[{"property":"name","value":"covid19_india","valueType":"str"}],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":1210,"y":200,"wires":[[]]},{"id":"890ca730.2bd008","type":"ha-entity","z":"39d45ee1.7a82b2","name":"Covid19 Country Specific Deaths","server":"82494656.b2ac98","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"Covid19 India Deaths"},{"property":"device_class","value":"none"},{"property":"icon","value":"mdi:emoticon-dead"},{"property":"unit_of_measurement","value":""}],"state":"payload.total_cases_country_death","stateType":"msg","attributes":[{"property":"name","value":"covid19_india_death","valueType":"str"}],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":1240,"y":260,"wires":[[]]},{"id":"82494656.b2ac98","type":"server","z":"","name":"Home Assistant"}]

image