thebino / rki_covid

🦠 Custom integration for Home Assistant to monitor covid numbers provided by Robert-Koch Institut
Apache License 2.0
40 stars 11 forks source link

After restart of HA rki covid will not come back #66

Closed damanti-me closed 2 years ago

damanti-me commented 2 years ago

🐛 Describe the bug

Every time after restarting home assistant the sensor of RKI will not come back (receives no new data). Sorry if thats an local error on my system. Tried to :

Workaround: delete integration - restart ha - new setup of integration over GUI

**💥 When did the bug occurred.***

👣 To Reproduce

Steps to reproduce the behavior:

  1. restart home assistant
  2. sensor turns to "not available"

🧐 Expected behavior

Covid sensor should receive values after reboot/restart.

💻 Versions (please complete the following information):

🗄 Logfiles (Configuration > Logs)

🎓 Increase the log level for this custom integration by adding the following lines to the configuration.yaml


2021-11-16 18:41:07 WARNING (MainThread) [homeassistant.components.sensor] Platform rki_covid not ready yet: Data coordinator could not be initialized!; Retrying in background in 30 seconds
2021-11-16 18:41:07 WARNING (MainThread) [homeassistant.components.sensor] Platform rest not ready yet; Retrying in background in 30 seconds
2021-11-16 18:41:24 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.rki_covid
2021-11-16 18:42:25 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.rki_covid
2021-11-16 18:42:25 DEBUG (MainThread) [custom_components.rki_covid.sensor] create sensor from config entry {'county': 'SK xxxxxxx'}

Add regarding log messages from the Logs for more details.
thebino commented 2 years ago

What sensors are in your configuration? There is no district with this name.

'county': 'SK xxxxxxx'

damanti-me commented 2 years ago

It's the name of my hometown which i don't want to share here...

thebino commented 2 years ago

Can you try to remove this sensor, add any other district e.g. Munich and check if it works? Looks like the sensor is not fully set. Since I'm missing the initialization of all the sub-sensors in your log.

MGdev14 commented 2 years ago

Same problem for me. I tried removing and adding a new district but the adding failed (not showing the configuration where you choose the district). I got this error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 98, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 138, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, 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 62, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 71, in post
    result = await self._flow_mgr.async_init(
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 197, in async_init
    flow, result = await task
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 224, in _async_init
    result = await self._async_handle_step(flow, flow.init_step, data, init_done)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 320, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/config/custom_components/rki_covid/config_flow.py", line 40, in async_step_user
    for case in sorted(coordinator.data.values(), key=lambda case: case.name):
AttributeError: 'NoneType' object has no attribute 'values'

Next try is reinstalling it via HACS

damanti-me commented 2 years ago

Can you try to remove this sensor, add any other district e.g. Munich and check if it works? Looks like the sensor is not fully set. Since I'm missing the initialization of all the sub-sensors in your log.

yes i tried. When i selected the RKI Integration in the menu of integration it says in german "der konfigurationsfluss konnte nicht geladen werden." log gives me an error like this: 2021-11-17 21:06:09 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.rki_covid 2021-11-17 21:07:09 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request resp = await self._request_handler(request) File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle resp = await handler(request) File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 220, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 138, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, 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 62, in wrapper result = await method(view, request, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 71, in post result = await self._flow_mgr.async_init( File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 197, in async_init flow, result = await task File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 224, in _async_init result = await self._async_handle_step(flow, flow.init_step, data, init_done) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 320, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) File "/config/custom_components/rki_covid/config_flow.py", line 40, in async_step_user for case in sorted(coordinator.data.values(), key=lambda case: case.name): AttributeError: 'NoneType' object has no attribute 'values'

Thank you for your time!

thebino commented 2 years ago

Thats really strange, I just tried it with the exact same versions and didn't face any errors at all.

2021-11-17 21:11:06 DEBUG (MainThread) [custom_components.rki_covid.sensor] create sensor from config entry {'county': 'LK Ahrweiler'}
2021-11-17 21:11:06 DEBUG (MainThread) [custom_components.rki_covid.sensor] initialize count sensor for LK Ahrweiler
2021-11-17 21:11:06 DEBUG (MainThread) [custom_components.rki_covid.sensor] initialize deaths sensor for LK Ahrweiler
2021-11-17 21:11:06 DEBUG (MainThread) [custom_components.rki_covid.sensor] initialize recovered sensor for LK Ahrweiler
2021-11-17 21:11:06 DEBUG (MainThread) [custom_components.rki_covid.sensor] initialize weekIncidence sensor for LK Ahrweiler
2021-11-17 21:11:06 DEBUG (MainThread) [custom_components.rki_covid.sensor] initialize casesPer100k sensor for LK Ahrweiler
2021-11-17 21:11:06 DEBUG (MainThread) [custom_components.rki_covid.sensor] initialize newCases sensor for LK Ahrweiler
2021-11-17 21:11:06 DEBUG (MainThread) [custom_components.rki_covid.sensor] initialize newDeaths sensor for LK Ahrweiler
2021-11-17 21:11:06 DEBUG (MainThread) [custom_components.rki_covid.sensor] initialize newRecovered sensor for LK Ahrweiler
MGdev14 commented 2 years ago

After reinstalling it in Hacs, adding the district worked and showed data. Then I restarted HACS and the sensors showed unavailable. I got this error:

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.rki_covid Source: helpers/update_coordinator.py:219 Integration: RKI Covid numbers (documentation, issues) First occurred: 21:09:35 (1 occurrences) Last logged: 21:09:35

Error fetching rki_covid data: Error reading data from rki-covid-parser timed-out:

HomeAssistant: core-2021.11.0 HACS: 1.17.2 supervisor-2021.10.8

damanti-me commented 2 years ago

yep same here. Is there a way to remove everything from the integration? I once had it set up over yaml. Before it was possible over the integration site... Dont know if there is anything left... cleaned sensors.yaml deleted integration in HACS

thebino commented 2 years ago

@MGdev14 & @damanti-me did you experience the issue again? Or might it be solved already?

damanti-me commented 2 years ago

@MGdev14 & @damanti-me did you experience the issue again? Or might it be solved already?

yes, the issue persists. I just tried it again. (random restart of HA)

huettenwirt commented 2 years ago

Same here. I have this issue for months now.

After restart of HA, RKI won't fetch any data. I also can't call the integration again. It won't show up at all. Only option to resolve this is to remove all the cities, reboot and re-add them to HA.

I also tried the manual configuration using configuration.yaml, but no difference.

Don't know if it has to do with the kind of HA installation. I'm running HA in Docker, but I don't have any issues with other integrations reg. network comms etc.

HA-Log says "Error fetching rki_covid data: Error reading data from rki-covid-parser timed-out:"

Trying to add a new city after restart of HA leads to "Der Konfigurationsfluss konnte nicht geladen werden".

And here's another log entry from the integration:

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: aiohttp.server Source: custom_components/rki_covid/config_flow.py:40 Integration: RKI Covid numbers (documentation, issues) First occurred: 10:40:32 (2 occurrences) Last logged: 12:57:53

Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request resp = await self._request_handler(request) File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle resp = await handler(request) File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 98, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 138, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, 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 62, in wrapper result = await method(view, request, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 71, in post result = await self._flow_mgr.async_init( File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 197, in async_init flow, result = await task File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 224, in _async_init result = await self._async_handle_step(flow, flow.init_step, data, init_done) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 320, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) File "/config/custom_components/rki_covid/config_flow.py", line 40, in async_step_user for case in sorted(coordinator.data.values(), key=lambda case: case.name): AttributeError: 'NoneType' object has no attribute 'values'

damanti-me commented 2 years ago

After a complete wipe and new setup of home assistant the error message is gone so far. core-2021.11.5 python 3.9.6 intelNUC

skynan22 commented 2 years ago

The same problem here. After a restart of HA all RKI numbers are not available anymore. Deutschland, BL Bayern, LK Forchheim & LK Kelheim are being integrated.

What helps is to manually uninstall & completely new install RKI Zahlen Add-On in HACS Add-Ons after deleting all sources (Deutschland, BL Bayern etc.) integrated before ... what a waste of time.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

huettenwirt commented 2 years ago

No changes here. The issue remains and renders this integration unusable since any restart of HA leaves me with "unavailable" for the numbers in lovelace. Maybe after restart some connection is not established before the container is ready? It's a pity this doesn't work. It was nice to see this information in HA. Now I need to start my Corona Warn App to see these numbers... Would be great if this is going to be resolved in the future...

Best regards, Huettenwirt

thebino commented 2 years ago

Please try again with the latest version 1.5.7

dimafemabo commented 2 years ago

I have version 1.5.8 and the Home assistant version 2022-3-1 unfortunately exactly the same behavious as described above. Would be great to find a solution. Despite the above it is such a a great integration! Cheers Dietger