8000 TP-Link Smart Home integration no longer working for L920-5 Smart LED Strip after update to new version · Issue #121119 · home-assistant/core · GitHub
[go: up one dir, main page]

Skip to content
TP-Link Smart Home integration no longer working for L920-5 Smart LED Strip after update to new version #121119
@szabo-s-samuel

Description

@szabo-s-samuel

The problem

After upgrading to the latest Home Assistant Core (2024.7.0), the TP-Link Smart Home Integration reported an issue with my L920-5 Smart LED Strip device. After not being able to reload the configuration, I removed the device and tried to add it again, but the process resulted in an error, and I was not able to add the device back. According to the logs both issues (the initial issue and the inability to add the device back after removal) is caused by the same error.
The issue appears to be coming from the python-kasa library, as trying to connect to the device through the kasa python CLI tool results in the same error as well.

What version of Home Assistant Core has the issue?

core-2024.7.0

What was the last working version of Home Assistant Core?

core-2024.6.4

What type of installation are you running?

Home Assistant OS

Integration causing the issue

TP-Link Smart Home (tplink)

Link to integration documentation on our website

https://www.home-assistant.io/integrations/tplink

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Log details #1 (ERROR):
Logger: homeassistant.config_entries
Source: config_entries.py:586
First occurred: 21:34:41 (3 occurrences)
Last logged: 21:40:54

Error setting up entry [REDACTED] L920 for tplink
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 586, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tplink/__init__.py", line 165, in async_setup_entry
    device: Device = await Device.connect(config=config)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/kasa/device.py", line 233, in connect
    return await connect(host=host, config=config)  # type: ignore[arg-type]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/kasa/device_factory.py", line 71, in connect
    return await _connect(config, protocol)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/kasa/device_factory.py", line 110, in _connect
    await device.update()
  File "/usr/local/lib/python3.12/site-packages/kasa/smart/smartdevice.py", line 181, in update
    module._post_update_hook()
  File "/usr/local/lib/python3.12/site-packages/kasa/smart/modules/lightpreset.py", line 45, in _post_update_hook
    brightness=preset_state["brightness"],
               ~~~~~~~~~~~~^^^^^^^^^^^^^^
KeyError: 'brightness'


Log details #2 (ERROR):
Logger: aiohttp.server
Source: /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:421
First occurred: 21:42:09 (10 occurrences)
Last logged: 23:11:35

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, 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 77, 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 85, 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/config/config_entries.py", line 222, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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/helpers/data_entry_flow.py", line 122, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 368, in async_configure
    result = await self._async_configure(flow_id, user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 415, in _async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 518, in _async_handle_step
    result: _FlowResultT = await getattr(flow, method)(user_input)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tplink/config_flow.py", line 276, in async_step_user_auth_confirm
    device = await self._async_try_connect(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tplink/config_flow.py", line 425, in _async_try_connect
    self._discovered_device = await Device.connect(config=config)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/kasa/device.py", line 233, in connect
    return await connect(host=host, config=config)  # type: ignore[arg-type]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/kasa/device_factory.py", line 71, in connect
    return await _connect(config, protocol)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/kasa/device_factory.py", line 110, in _connect
    await device.update()
  File "/usr/local/lib/python3.12/site-packages/kasa/smart/smartdevice.py", line 181, in update
    module._post_update_hook()
  File "/usr/local/lib/python3.12/site-packages/kasa/smart/modules/lightpreset.py", line 45, in _post_update_hook
    brightness=preset_state["brightness"],
               ~~~~~~~~~~~~^^^^^^^^^^^^^^
KeyError: 'brightness'

Additional information

Unfortunately I was unable to provide the diagnostic data, as I could no longer download it after removing the device.
I am going to raise the issue at the python-kasa side as well, please let me know if you would like me to link the ticket here as well!

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0