Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump python-kasa to 0.5.4 for tplink #103038

Merged
merged 3 commits into from
Nov 1, 2023

Conversation

rytilahti
Copy link
Member

@rytilahti rytilahti commented Oct 29, 2023

Proposed change

This bumps python-kasa to the newest maintenance release which contains variety of reliability improvements which may fix some of the linked issues. In addition, pydantic v2 (c.f., #99218) support is also included.

Full changelog: https://github.com/python-kasa/python-kasa/releases/tag/0.5.4

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@home-assistant
Copy link

Hey there @TheGardenMonkey, mind taking a look at this pull request as it has been labeled with an integration (tplink) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of tplink can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign tplink Removes the current integration label and assignees on the pull request, add the integration domain after the command.

@rytilahti rytilahti marked this pull request as ready for review October 30, 2023 00:05
@rytilahti rytilahti mentioned this pull request Oct 30, 2023
66 tasks
Copy link
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried this on production and got

2023-10-29 19:33:06.230 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry TP-LINK_Power Strip_5C33 HS300(US) for tplink
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 399, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tplink/__init__.py", line 94, in async_setup_entry
    found_mac = dr.format_mac(device.mac)
                              ^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/kasa/smartdevice.py", line 86, in wrapped
    raise SmartDeviceException(
kasa.exceptions.SmartDeviceException: You need to await update() to access the data

@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant bot marked this pull request as draft October 30, 2023 00:36
@bdraco
Copy link
Member

bdraco commented Oct 30, 2023

I'm traveling so I can't do live debugging but when I get back home tomorrow I can dig in more (or Tuesday if I'm too jet lagged)

@rytilahti
Copy link
Member Author

rytilahti commented Oct 30, 2023

Tested on all the devices I have on a clean install, the only issue I encountered was that the KL130 bulb does not get recognized during the initial discovery (but bulbs are known to be flaky, starting the discovery flow again discovers it).
image

I wasn't able to figure out at once why the device wouldn't be initialized (as discover_single performs an update), so I'll be waiting for your findings.

@bdraco
Copy link
Member

bdraco commented Oct 31, 2023

confirmed the issue on my dev install as well now that I'm home.

debugging.....

2023-10-31 15:36:55.556 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry TP-LINK_Power Strip_5C33 HS300(US) for tplink
Traceback (most recent call last):
  File "/Users/bdraco/home-assistant/homeassistant/config_entries.py", line 402, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bdraco/home-assistant/homeassistant/components/tplink/__init__.py", line 94, in async_setup_entry
    found_mac = dr.format_mac(device.mac)
                              ^^^^^^^^^^
  File "/Users/bdraco/home-assistant/venv/lib/python3.11/site-packages/kasa/smartdevice.py", line 86, in wrapped
    raise SmartDeviceException(
kasa.exceptions.SmartDeviceException: You need to await update() to access the data

@bdraco
Copy link
Member

bdraco commented Oct 31, 2023

My test branch was dirty. When I reset it and removed prior changes, the problem went away.

Sorry for the side trip.

@bdraco bdraco marked this pull request as ready for review October 31, 2023 20:46
@home-assistant home-assistant bot requested a review from bdraco October 31, 2023 20:46
@bdraco
Copy link
Member

bdraco commented Oct 31, 2023

The problem is actually in connect_single

I will send a PR to fix it

@bdraco bdraco added this to the 2023.11.0 milestone Oct 31, 2023
@bdraco
Copy link
Member

bdraco commented Oct 31, 2023

The problem is actually in connect_single

I will send a PR to fix it

python-kasa/python-kasa#538
#103150

@bdraco
Copy link
Member

bdraco commented Oct 31, 2023

Thanks @rytilahti

@bdraco bdraco merged commit f944c68 into home-assistant:dev Nov 1, 2023
53 checks passed
frenck pushed a commit that referenced this pull request Nov 1, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Nov 2, 2023
@rytilahti rytilahti deleted the tplink/bump/0.5.4 branch November 18, 2023 15:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants