Skip to content

KP125M(US) 1.4.1 TPAP validation: fixture + blank-credential fallback - #8

Open
RayWangyangMa wants to merge 2 commits into
ZeliardM:feature/tpapfrom
RayWangyangMa:tpap-kp125m-validation
Open

RayWangyangMa wants to merge 2 commits into
ZeliardM:feature/tpapfrom
RayWangyangMa:tpap-kp125m-validation

Conversation

@RayWangyangMa

Copy link
Copy Markdown

KP125M(US) fw 1.4.1 TPAP validation + fixture + one small transport fix

My KP125M(US) (hw 1.0) recently got firmware 1.4.1 Build 260721 pushed and switched to TPAP — same situation as the two KP125M reports at the bottom of python-kasa#1590. Discovery announces:

"tpap_preferred": true,
"tpap": { "tls": 0, "dac": 1, "noc": 1, "pake": [2], "port": 80 },
"mgt_encrypt_schm": { "is_support_https": false, "http_port": 80, "encrypt_type": "TPAP", "lv": 2 }

so this is the plain-HTTP (tls: 0) SPAKE2+ path with dac/noc flags set. KLAP is fully shut off on this firmware (handshake1 returns 403), so this branch is the only local-control path left.

Validation against the real plug (this branch, unmodified)

Area Result
Discover.discover_single with credentials OK — resolves to SmartProtocol + TpapTransport + SmartDevice + http
TPAP handshake over plain HTTP :80 OK
Full update() (device info, usage, energy monitoring, emeter batches) OK
turn_on() / turn_off() round-trip + re-update OK
Repeated sessions / reconnects OK

Works first try — nice job on this transport.

What this PR adds

  1. tests/fixtures/smart/KP125M(US)_1.0_1.4.1.json — dumped with devtools/dump_devinfo.py from the real device (existing fixtures for this model stop at 1.2.3, pre-TPAP), plus the SUPPORTED.md regen.

  2. Blank-credential fallback in TpapTransport.__init__ — the new fixture caught this: test_features_all[KP125M(US)_1.0_1.4.1.json-SMART] failed with AuthenticationError: Tapo plug requires authentication. The CLI test connects without credentials; SmartDevice.update() requires credentials or credentials_hash on the transport. KlapTransport falls back to blank Credentials() at init when neither is supplied, but TpapTransport didn't, so both stayed None and update() raised before the (fake) transport was ever used. The fix mirrors the KLAP behavior:

if (
    not self._credentials or self._credentials.username is None
) and not self._credentials_hash:
    self._credentials = Credentials()

Real-device behavior is unchanged (a blank-credential SPAKE2+ handshake still fails with an auth error at the transport, same as KLAP's).

Tests

pytest tests/test_cli.py tests/test_discovery.py tests/test_device_factory.py tests/test_deviceconfig.py tests/transports/
10669 passed, 196 skipped

Real-device toggle re-verified after the transport change. Happy to run more targeted tests on this hardware if useful — this plug drives my 3D-printer exhaust fans, so it's permanently on my LAN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant