Repository navigation
feat(air-purifier): add verified filter usage reset (pySwitchbot 3.1.0) - #346
Merged
Merged
Conversation
Port sblibs/pySwitchbot#583, released in pySwitchbot 3.1.0. `resetFilterUsage()` on WoAirPurifier (and Air Purifier Table) and WoAirPurifierPM25 sends 57 0F 4C 09 once, never retried, and requires status 0x01. It then reads the usage with 57 0F 4D 09 and returns true only when the device reports 0 used hours. Otherwise it throws CommandFailedError: reset rejected, read rejected, could not be verified (no or short reply), or still N used hours. BLE only: the OpenAPI has no filter reset command. node-switchbot does not decrypt BLE replies yet, so on an encrypted connection the readback cannot be checked, and the reset is refused before anything is sent rather than reported as done. sendBLECommand gains options `retry` and `validateResponse` so a command can be sent once and its reply read raw. 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.
Ports pySwitchbot 3.1.0, whose only functional change is sblibs/pySwitchbot#583, verified filter usage reset for air purifiers. The release's other change is a
cryptographydependency bump, not applicable here.What
resetFilterUsage(): Promise<boolean>onWoAirPurifier(also used by Air Purifier Table) andWoAirPurifierPM25, matching pySwitchbot'sreset_filter_usage:57 0F 4C 09once, never retried, and require status0x01.57 0F 4D 09. Returntrueonly if the device reports 0 used hours (bytes 1–2, big-endian).CommandFailedError: reset rejected, read rejected, could not be verified (no or short reply), or still reports N used hours.sendBLECommandgainsretryandvalidateResponseoptions, so a command can be sent once and its reply read raw.Limitations
result[4:]); node-switchbot doesn't yet, so the readback can't be checked. Reporting an unverified reset as done would defeat the feature. Supporting it needs reply decryption, which should be verified on hardware first.Follow-ups
Checks
Build, 402 tests (+14, mirroring pySwitchbot's cases) and lint pass. Labelled
minor(5.2.0).Generated by Claude Code