mariusz-ostoja-swierczynski / tech-controllers

TECH Controllers integration for Home Assistant
MIT License
91 stars 66 forks source link

[Bug]: failing when adding multiple controllers at once #127

Closed daroga0002 closed 41 minutes ago

daroga0002 commented 3 hours ago

The problem

When I trying to test integration under emodule tech test account and add all 4 controllers at once I get errors. When adding one by one there is no issue

What version of Tech Controllers integration has the issue?

current master

What version of Home Assistant Core has the issue?

2024.10.3

What was the last working version of Tech Controller integration?

No response

Diagnostics information

image

Anything in the logs that might be useful for us?

2024-10-21 07:55:49.704 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/home/vscode/.local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 477, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.12/site-packages/aiohttp/web_app.py", line 559, in _handle
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/components/http/ban.py", line 85, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/components/http/auth.py", line 242, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/components/http/headers.py", line 32, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/components/http/decorators.py", line 81, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/components/config/config_entries.py", line 222, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/components/http/data_validator.py", line 74, in wrapper
    return await method(view, request, data, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/helpers/data_entry_flow.py", line 122, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/data_entry_flow.py", line 370, in async_configure
    result = await self._async_configure(flow_id, user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/data_entry_flow.py", line 417, in _async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.12/site-packages/homeassistant/data_entry_flow.py", line 520, in _async_handle_step
    result: _FlowResultT = await getattr(flow, method)(user_input)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/tech-controllers/custom_components/tech/config_flow.py", line 186, in async_step_select_controllers
    return await self._async_finish_controller(user_input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/tech-controllers/custom_components/tech/config_flow.py", line 142, in _async_finish_controller
    self._create_config_entry(controller=controller)
  File "/workspaces/tech-controllers/custom_components/tech/config_flow.py", line 214, in _create_config_entry
    return ConfigEntry(
           ^^^^^^^^^^^^
TypeError: ConfigEntry.__init__() missing 1 required keyword-only argument: 'discovery_keys'

Additional information

No response

anarion80 commented 3 hours ago

It works fine on 2024.9.2. Let me check on 2024.10.3 - there was some change in HA related to this discovery_keys.

daroga0002 commented 2 hours ago

this seems be change https://github.com/home-assistant/core/pull/126563, I was able to fix it under https://github.com/daroga0002/tech-controllers/tree/bump-dependencies but then it is incompatible with earlier version of HA than 2024.10.* (but only on bulk additions of controllers)

daroga0002 commented 2 hours ago

I have opened https://github.com/mariusz-ostoja-swierczynski/tech-controllers/pull/128 but please feel free to modify it if you will found better way to handle compatibility with HA