| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Codecov Report❌ Patch coverage is 96.89655% with 9 lines in your changes missing coverage. Please review.
@@ Coverage Diff @@
## master #1729 +/- ##
==========================================
+ Coverage 93.29% 93.39% +0.10%
==========================================
Files 157 159 +2
Lines 9932 10222 +290
Branches 1022 1052 +30
==========================================
+ Hits 9266 9547 +281
- Misses 471 475 +4
- Partials 195 200 +5 ☔ View full report in Codecov by Harness.
|
Sorry, something went wrong.
|
|
||
|
|
||
| def _sha256(payload: bytes) -> bytes: | ||
| return hashlib.sha256(payload).digest() # noqa: S324 |
There was a problem hiding this comment.
CodeQL False Positive: SHA256 is required by the DLKLAP handshake (auth-hash derivation), not password storage. Mirrors the existing _sha256 in klaptransport.py, which carries the same # noqa: S324. Safe to dismiss.
Sorry, something went wrong.
|
Thanks for this work @tedholtz Hope it gets committed so I can test it out! |
Sorry, something went wrong.
|
I have 2 locks, a DL105 and a DL110. I was able to get them both working with this by adding the models in device_fixtures and changing _ensure_device_id to look up the MAC address for the IP and match on that: mac = get_mac_address(ip=self._host)
mac = mac.replace(":", "").upper()
locks = [d for d in devices if d.get("deviceMac") == mac]
|
Sorry, something went wrong.
@rale thanks for testing. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
Adds first-class support for the TP-Link DL100 smart lock via a new
DlklapTransport and a Lock SmartModule. Closes #1693.
The DL100 speaks DLKLAP, a proprietary KLAP variant that runs over plain
HTTP :80 and requires a cloud-assisted handshake0 step to mint a
per-session controlKey before the usual KLAP handshake1/handshake2 and
AES-128-CBC session encryption. This transport implements that full pipeline
and slots into the existing Transport / Protocol / Device layering.
What is DLKLAP?
Standard KLAP handshakes are fully local. DLKLAP inserts two cloud round-trips:
also wakes the lock's radio).
per-session controlKey.
keys (lsk/ldk/iv) used for /app/request.
Full protocol write-up is in #1693.
Changes
handshake0 → control-key → handshake1 → handshake2 → session-key derivation,
session caching, and single-retry re-handshake on failure. Handshakes are
serialized (asyncio.Lock) since a second handshake0 invalidates the first
control key (device error 15033).
is_locked, lock(), unlock(), battery, battery_low.
DeviceFamily.SmartTapoLock = "SMART.TAPOLOCK", DeviceType.Lock, the
SMART.DLKLAP → (SmartProtocol, DlklapTransport) mapping in
device_factory.py, and the SMART.TAPOLOCK → DeviceType.Lock mapping in
smartdevice.py.
redacted DL100 fixture folded into the parametrized SMART suite.
Behavior notes for reviewers
deliberate: the 33-byte binary handshake0 body must be sent verbatim, and
wrapping middleware re-encodes the text/plain payload and breaks the
handshake. Happy to revisit if there's a preferred integration point.
TP-Link's private CA (not a public root), so TLS verification is disabled for
that one request only (# noqa: S501 with a comment). The cloud login
call, which carries the account password, stays fully verified.
battery_detect component, so the generic BatterySensor never loads.
(bolt extended), 1 = UNLOCKED. Confirmed against decompiled
EnumDoorLockStatus and the live device — not inverted.
Testing
(module presence, is_locked polarity, lock()/unlock() payload with
owner-forbidden fields excluded, battery).
including the test_devtools.py fixture round-trip check.
device_factory.connect() → update() — is_locked=True (lock_status 0),
battery_level=81, battery_low=False.
Known limitations / follow-ups
cloud device list has no LAN IP), so it picks the sole SMART.TAPOLOCK.
A future config override could address multi-lock setups.
(getVolume → UNKNOWN_METHOD_ERROR); handled gracefully (module marked
unavailable). Cosmetic device quirk, not a bug.