sander1988 / Indego

Home Assistant Custom Component for Bosch Indego Lawn Mower
Apache License 2.0
96 stars 29 forks source link

Indego integration not working after update to HA 2024.11 #251

Closed wimb0 closed 1 week ago

wimb0 commented 2 weeks ago

Checklist

The problem

Indego Integration does not start on Home Assistant 2024.11

Expected behavior

A working integration

Steps to reproduce

Update to HA 2024.11

Environment

Logs

Logger: homeassistant.config_entries
Bron: config_entries.py:3227
Eerst voorgekomen: 09:28:40 (3 gebeurtenissen)
Laatst gelogd: 09:28:51

Error occurred loading flow for integration indego: cannot import name 'DATA_STORAGE' from 'homeassistant.components.application_credentials' (/usr/src/homeassistant/homeassistant/components/application_credentials/__init__.py)
Logger: homeassistant.config_entries
Bron: config_entries.py:604
Eerst voorgekomen: 09:21:30 (2 gebeurtenissen)
Laatst gelogd: 09:24:22

Error importing platform config_flow from integration indego to set up indego configuration entry: cannot import name 'DATA_STORAGE' from 'homeassistant.components.application_credentials' (/usr/src/homeassistant/homeassistant/components/application_credentials/__init__.py)
Logger: homeassistant.util.loop
Bron: util/loop.py:136
Eerst voorgekomen: 09:24:22 (1 gebeurtenissen)
Laatst gelogd: 09:24:22

Detected blocking call to import_module with args ('custom_components.indego.config_flow',) inside the event loop by integration 'config' at homeassistant/components/config/config_entries.py, line 120: await hass.config_entries.async_reload(entry_id) (offender: /usr/src/homeassistant/homeassistant/loader.py, line 1300: return importlib.import_module(f"{self.pkg_path}.{platform_name}")), please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+config%22 For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#import_module Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module> sys.exit(main()) File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 189, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 477, in _handle_request resp = await request_handler(request) File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 559, in _handle return await handler(request) File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 210, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 86, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware response = await handler(request) File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle result = await handler(request, **request.match_info) File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 120, in post await hass.config_entries.async_reload(entry_id)

Additional information

Tried removing and re-installing the integration, but that throws the same errors as above.

kimzeuner commented 2 weeks ago

i had the same error this morning after upgrading to 2024.11.0 Seems as changing line 9 in custom_components/indego/config_flow.py from

from homeassistant.components.application_credentials import ClientCredential, async_import_client_credential, DOMAIN as AC_DOMAIN, DATA_STORAGE as AC_DATA_STORAGE

to

from homeassistant.components.application_credentials import ClientCredential, async_import_client_credential, DOMAIN as AC_DOMAIN, DATA_COMPONENT as AC_DATA_STORAGE

fixed it. Maybe @sander1988 can check if this is all that has to be changed ?! Should i write a PR or will you do the change ?

LarsLautrup commented 2 weeks ago

i had the same error this morning after upgrading to 2024.11.0 Seems as changing line 9 in custom_components/indego/config_flow.py

I can confirm, that this does indeed fix the problem. Thanks!! 👍

Lehcsi1984 commented 2 weeks ago

same error this morning after upgrading to 2024.11.0. i tryed changing line 9. Not Working.

When i try to add the indego integration: "500 Internal Server Error Server got itself in trouble"

Indego component release with the issue: 5.7.5 Last working Indego component release (if known):5.7.5 Home Assistant release with the issue: 2024.11.0 Last working Home Assistant release (if known): 2024.10.3 Operating system: HOAS OS on Pi5 8Gb

wimb0 commented 2 weeks ago

I tried the fix from @kimzeuner , but I also get the "500 Internal Server Error Server got itself in trouble"

I the logs the following error is then found:

Logger: aiohttp.server
Bron: /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:448
Eerst voorgekomen: 13:21:29 (3 gebeurtenissen)
Laatst gelogd: 13:22:57

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 477, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 559, in _handle
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 210, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 86, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper
    return await method(view, request, data, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 172, in post
    return await self._post_impl(request, data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 179, in _post_impl
    return await super()._post_impl(request, data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 84, in _post_impl
    result = await self._flow_mgr.async_init(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1301, in async_init
    flow, result = await self._async_init(flow_id, handler, context, data)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1336, in _async_init
    result = await self._async_handle_step(flow, flow.init_step, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 517, in _async_handle_step
    result: _FlowResultT = await getattr(flow, method)(user_input)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/indego/config_flow.py", line 130, in async_step_user
    credentials = self.hass.data[AC_DOMAIN][AC_DATA_STORAGE].async_client_credentials(DOMAIN)
                  ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
TypeError: 'ApplicationCredentialsStorageCollection' object is not subscriptable 
Lehcsi1984 commented 2 weeks ago

Hy. I was wrong. I allready deleted the indego integration. After a restore and editing the Line 9....working. Dont deleted the indego entity or integration. Just edit and restart.

sander1988 commented 2 weeks ago

Did you test with the latest dev version? My last commit did prepare some fixes for changes that are announced to stop working in HA 2025.1 and 2025.6.

This is probably something else, but just to be sure.

sander1988 commented 2 weeks ago

@kimzeuner - Please make a PR with the fix you described. I will try to test it soon.

sander1988 commented 2 weeks ago

This is where it was changed in the latest release: https://github.com/home-assistant/core/commit/20d4031ed4f6638b2ae192a7b792284ddd769bda

Not sure if changing the import on our side is enough. Might break/corrupt HA component storage due to domain. But that's based on what is see in the code, can't test right now.

kimzeuner commented 2 weeks ago

I will test the latest dev tomorrow and will let you know if it works. If not, i will open the PR.

kimzeuner commented 2 weeks ago

i just tested the latest dev version (5.7.6 is correct ?!) and the error as described in the first post is back. After changing line 9 in the config_flow.py the integration is working again. Created PR #252

papaeng89 commented 2 weeks ago

changing line 9 in custom_components/indego/config_flow.py It's work for me

Thanks kimzeuner

sander1988 commented 1 week ago

Version 5.7.7 has just been released with HA 2024.11 support.

wimb0 commented 1 week ago

Thanks! The integration is working fine again. I can succesfully install and configure version 5.7.7.

kimzeuner commented 1 week ago

Also here everything seems to work fine after the update! Thanks