Skip to content

feat(air-purifier): add verified filter usage reset (pySwitchbot 3.1.0) - #346

Merged
donavanbecker merged 1 commit into
latestfrom
feat/pyswitchbot-3.1.0
Oct 24, 2026
Merged

donavanbecker merged 1 commit into
latestfrom
feat/pyswitchbot-3.1.0

Conversation

@donavanbecker

Copy link
Copy Markdown
Contributor

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 cryptography dependency bump, not applicable here.

What

resetFilterUsage(): Promise<boolean> on WoAirPurifier (also used by Air Purifier Table) and WoAirPurifierPM25, matching pySwitchbot's reset_filter_usage:

  1. Send 57 0F 4C 09 once, never retried, and require status 0x01.
  2. Read the usage with 57 0F 4D 09. Return true only if the device reports 0 used hours (bytes 1–2, big-endian).
  3. Otherwise throw CommandFailedError: reset rejected, read rejected, could not be verified (no or short reply), or still reports N used hours.

sendBLECommand gains retry and validateResponse options, so a command can be sent once and its reply read raw.

Limitations

  • BLE only. The OpenAPI has no filter reset command.
  • Encrypted connections are refused before anything is sent. pySwitchbot decrypts replies (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

  • homebridge-switchbot: none needed now. No accessory exposes a filter reset, and HomeKit's Filter Maintenance service would also need filter-life data the status doesn't provide.
  • SwitchBotAPI-BLE: documents the two commands (separate PR).

Checks

Build, 402 tests (+14, mirroring pySwitchbot's cases) and lint pass. Labelled minor (5.2.0).


Generated by Claude Code

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
@donavanbecker donavanbecker added the minor minor version change label Oct 24, 2026 — with Claude
@donavanbecker
donavanbecker merged commit ce4d6ed into latest Oct 24, 2026
2 checks passed
@donavanbecker
donavanbecker deleted the feat/pyswitchbot-3.1.0 branch October 24, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor minor version change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants