GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Expose better authentication errors by blakeembrey · Pull Request #1742 · python-kasa/python-kasa

Conversation

@blakeembrey

@blakeembrey blakeembrey commented Aug 20, 2026

Copy link
Copy Markdown

I was trying to set up the P316M but run into a bunch of issues, these failures would have helped me a lot earlier. I'm sure it could still be further improved, but it's what worked for me.

Debug process:

  1. Username/password many times that kept failing (obd_src=tss)
  2. Removed and re-added device (obd_src=tplink, still didn't work)
  3. Factory reset and re-add (worked)

Prior to diving into this package I had assumed the board was either broken or unsupported. I tried more than I should have to re-authenticate in the home assistant UI.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@blakeembrey
Expose better authentication errors
d6a2f6c
github-advanced-security[bot]
github-advanced-security Bot found potential problems Aug 20, 2026
View reviewed changes
Comment thread kasa/smart/smartdevice.py Dismissed

Uh oh!

There was an error while loading. Please reload this page.

@codecov

codecov Bot commented Aug 20, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.47619% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.27%. Comparing base (a29d061) to head (d6a2f6c).

Files with missing lines Patch % Lines
kasa/smart/smartdevice.py 88.23% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1742      +/-   ##
==========================================
- Coverage   93.29%   93.27%   -0.02%     
==========================================
  Files         157      157              
  Lines        9932     9967      +35     
  Branches     1022     1030       +8     
==========================================
+ Hits         9266     9297      +31     
- Misses        471      473       +2     
- Partials      195      197       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rytilahti
rytilahti requested changes Aug 21, 2026
View reviewed changes

@rytilahti rytilahti left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Hi @blakeembrey and thanks for your PR! I think this would be really useful addition, I added a couple of things that should be taken care of before this can be merged.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread kasa/smart/smartdevice.py
return error

@staticmethod
def _is_owner_hash(owner: Any) -> TypeGuard[str]:

@rytilahti rytilahti Aug 21, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Could we avoid typeguard import, set correct type for the input parameter, and make it return a regular bool?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread kasa/smart/smartdevice.py
supplied_owner = hashlib.md5( # noqa: S324
credentials.username.encode()
).hexdigest()
if supplied_owner.casefold() != owner.casefold():

@rytilahti rytilahti Aug 21, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Would you mind moving this logic into a better place (likely to the corresponding auth protocol) and make it reusable?

Logic to detect mistyped username (I always assumed it'd be incorrect casing) would be useful, and we could try that to help people with issues like:

  • tplink: detect wrong e-mail case on auth failure and suggest the fix home-assistant/core#177516 (review), and
  • Problems discovering HS103P2 plug on Raspberry Pi #1741

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rytilahti rytilahti added the enhancement New feature or request label Aug 21, 2026
@rytilahti rytilahti added this to the 0.12 milestone Oct 24, 2026
@rytilahti rytilahti modified the milestones: 0.12, 0.13 Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@rytilahti rytilahti rytilahti requested changes
+1 more reviewer
@github-advanced-security github-advanced-security[bot] github-advanced-security[bot] left review comments
Reviewers whose approvals may not affect merge requirements

Requested changes must be addressed to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

enhancement New feature or request

Projects

None yet

Milestone

0.13

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@blakeembrey @rytilahti @github-advanced-security
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.