Repository navigation
feat: port pySwitchbot 3.2.0-3.8.1 - #362
Merged
Merged
Conversation
New in pySwitchbot 3.2.0-3.8.1: - UWB Lock, Lock Nano and Lock Ultra Max: lock models with pySwitchbot's commands, advertisement parsing and product IDs. - Lock Ultra Quick Key: getQuickKey / setQuickKey (WoSmartLockUltra), and half lock. - Bot inverse direction: setInverseDirection keeps the mode and strength; getModeSettings reads them. - Hub 4, Plug Mini (IT) and Outdoor Plug (EU) OpenAPI device types. Fixes found while porting: - Product IDs: newer products have no model byte and are identified by the 4-byte product ID at the end of the service data. node-switchbot only knew model bytes, so no such product was recognised over BLE. The lookup is ported; the lock family is listed. - Lock commands never matched the lock protocol (the Lock Pro "lock" sent the lock info command, 57 0f 4f). Locks now use pySwitchbot's per-model tables, picked from the device type. - Lock state was read from service data byte 1 and by a raw GATT read of an encrypted lock. It now comes from the manufacturer data in advertisements, with pySwitchbot's layout for each lock family. Not applicable: the Circulator Fan Pro firmware query and the RGBICWW ceiling light power state (no such classes here), the Lock Ultra basic-info battery fix (node-switchbot does not read lock basic info), and the encryption-key verification disconnect (no such flow here). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TYWa2RXoWsaUTWh76oNv8s
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
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.
What
This ports pySwitchbot 3.2.0 through 3.8.1:
3.2.0,
3.2.1,
3.3.0,
3.3.1,
3.3.2,
3.4.0,
3.5.0,
3.6.0,
3.7.0,
3.8.0,
3.8.1.
It also fixes three lock and product-ID bugs found while porting. Each new lock depends on them.
Ported from pySwitchbot
WoSmartLockUltra(Lock Ultra, Ultra Max, UWB Lock, grouped as in pySwitchbot) andWoSmartLockNano.WoSmartLockUltra.getQuickKey()/setQuickKey(), plushalfLock().WoHand.setInverseDirection(), which keeps the mode and strength, andgetModeSettings().WoHub4, with theHub 4OpenAPI device type.Fixes found while porting
_find_model_from_service_data_suffix). node-switchbot only knew model bytes, so it never recognised any of these products over BLE. pySwitchbot lists 29 of them, including Hub 3, the Lock Ultra and Lock Vision family, Floor Lamp, the RGBICWW lights and Climate Panel.findProductId/PRODUCT_ID_MODEL_MAP.57 0f 4f 01 00.4fis the lock info command; pySwitchbot locks with57 0f 4e 01 01 00 00 00.57 0f 4e 01 00instead of57 0f 4e 01 01 10 00.LOCK_COMMANDS), chosen by the lock model from the device type. That covers lock, unlock, unlock without unlatch, info, notifications, and half lock on the Lock Ultra.WoSmartLockCommands/WoSmartLockProCommandsexports are kept as@deprecated.src/utils/lock-advertisement.ts).Not applicable here
Follow-ups, not in this PR
These product IDs are known from pySwitchbot, but node-switchbot's BLE status or commands for them aren't ported yet, so they stay cloud-only:
Tests
test/utils/lock-advertisement.test.ts: every lock family, using pySwitchbot's own advertisement fixtures and expected values.test/devices/pyswitchbot-3.8.test.ts:57034b10/57034b11).510 tests pass. Build and lint pass.
Migration notes (homebridge-switchbot)
Lock Ultra/Smart Lock Ultranow createWoSmartLockUltra, a subclass ofWoSmartLockPro, soinstanceof WoSmartLockProstill holds.Lock Ultra Max,UWB Lock,Lock Nano,Hub 4,Plug Mini (IT),Outdoor Plug (EU).setKey({ keyId, encryptionKey })) for BLE commands, as before.Labelled
minor(6.1.0).Generated by Claude Code