FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add TD21(EU) device fixture by Smugaski · Pull Request #1786 · python-kasa/python-kasa · GitHub

Repository navigation

Add TD21(EU) device fixture - #1786

Merged
rytilahti merged 3 commits into
python-kasa:masterfrom
Smugaski:add-td21-fixture
Oct 13, 2026
Merged

rytilahti merged 3 commits into
python-kasa:masterfrom
Smugaski:add-td21-fixture

Conversation

Smugaski commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Add TD21(EU) device fixture

Adds a device fixture for the Tapo TD21 doorbell, hardware 2.0 (EU), firmware 1.1.5 Build 260423 Rel.6435n.

Changes

  • Adds tests/fixtures/smartcam/TD21(EU)_2.0_1.1.5.json.
  • Regenerates the supported-device lists in README.md and SUPPORTED.md with devtools/generate_supported.py.

No library code changes were needed. The device connects over the existing smartcam protocol (SMART.TAPODOORBELL, AES over HTTPS on port 443) and is picked up as a Doorbell.

Notes

  • The fixture's discovery_result block is hand-written, not captured. The TD21 does not answer UDP discovery (kasa discover times out), so it was modelled on the D130 fixture using the TD21's real model, hardware version and firmware version. It is needed because the discovery and device-factory tests expect it for every smartcam fixture.
  • The dump was generated with devtools/dump_devinfo.py against the device directly, using --device-family SMART.TAPODOORBELL --encrypt-type AES --https. Device IDs, MAC suffix, device name, SSID and location are redacted.

Testing

  • All tests parametrized on the TD21 fixture pass locally (108 passed, 2 skipped).
  • pre-commit formatting hooks pass on the changed files, and the supported-devices generator produces no further changes.
  • I could not get a clean full-suite run on Windows: the run intermittently hangs in asyncio's loopback socketpair() setup, in different tests each time and also on an unmodified checkout. Relying on CI for the full run.

Not included

The device also reports ring, chimeCtrl, quickResponse and doorbellNightVision components. They are not exposed as features yet, and I left that for a separate change.

codecov Bot commented Oct 7, 2026 •
edited
Loading

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.43%. Comparing base (ff26187) to head (3ce876f).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1786      +/-   ##
==========================================
+ Coverage   93.41%   93.43%   +0.02%     
==========================================
  Files         159      159              
  Lines       10113    10116       +3     
  Branches     1043     1044       +1     
==========================================
+ Hits         9447     9452       +5     
+ Misses        472      471       -1     
+ Partials      194      193       -1     

☔ 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.

rytilahti added the new device New device supported due to fixture being added label Oct 12, 2026

rytilahti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks @Smugaski, I saw that you mention that the discovery information is prepared manually, this is good to know!

I think this is good to go, but we should figure out a way to mark such manually maintained items to let the readers know that it is not a real device response. I will think on it a bit before merging, but if you have an idea, please feel free to let me know and/or adjust the fixture file.

The TD21 does not answer UDP discovery, so the discovery_result block is not a real device response. Add a _comment key next to error_code and result so readers can tell. The key sits outside the result dict that is parsed into the discovery model, and the fixture round-trip and discovery tests still pass.

Copy link
Copy Markdown
Contributor Author

Thanks for taking a look!
On marking the hand-written block, here are two options.

  1. The first is a _comment key inside discovery_result, next to error_code and result, saying it's manually created and what it was modelled on. I tried this locally: it stays out of the result dict that gets parsed into the discovery model, and the TD21 tests (including the fixture round-trip in test_smartcam_fixtures) still pass.

  2. The second is to leave the fixture as it is and rely on the PR description, which already says the block is hand-written and modelled on the D130 fixture.

I'm happy to do either, or something different if you have a convention in mind. I didn't want to invent one in a fixture-only PR. Please let me know which you'd prefer, or if you have any other ideas in mind.

Copy link
Copy Markdown
Member

Having a _comment sounds good, as it doesn't require checking the PR, thanks! I can adjust the other manually constructed fixtures to follow your example.

Copy link
Copy Markdown
Contributor Author

Pushed the _comment to the PR. For reference, I put it directly inside discovery_result so it stays clear of the result dict that gets parsed.

The CLI prints through rich, which wraps at 80 columns when output is not a terminal. The long comment wrapped and broke the exact-match comparison in test_discover_raw. Keep the comment short enough to stay on one line.

Copy link
Copy Markdown
Contributor Author

Pushed a small follow-up: the first _comment was too long and failed test_discover_raw in CI. kasa discover raw prints through rich, which wraps at 80 columns when output isn't a terminal, and the test compares the output exactly. I shortened it to "Manually created, not a real device response." (the line is 64 columns). Worth knowing for the other manually built fixtures: the whole printed line, including indentation, has to stay under 80 columns, so a short generic comment works best.

rytilahti merged commit f1a8d38 into python-kasa:master Oct 13, 2026
21 of 22 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new device New device supported due to fixture being added

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL