Repository navigation
Conversation
Codecov Report❌ Patch coverage is
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
PR Review — feat(curtain): add validated opt-in diagnostics and charging statesSolid, well-tested opt-in diagnostics. One concern blocks merge: the new status-byte check now runs on every curtain's basic update, and it was only checked against Curtain 3 fixtures. What's good:
What needs attention:
🟡 Important
1. Basic-info status check now applies to every curtain, but was only checked against Curtain 3 fixtures
|
bluetoothbot
left a comment
There was a problem hiding this comment.
Warning
Important issues found.
- Basic-info status check now applies to every curtain, but was only checked against Curtain 3 fixtures
|
Note No code changes since the last review ( |
2 similar comments
|
Note No code changes since the last review ( |
|
Note No code changes since the last review ( |
Only Curtain 3 replies have been validated against the spec, so the 0x01 success-status check now applies to Curtain 3 only. Older curtains, blind tilt and roller shade keep the original acceptance and second-slot detection, and their fixtures use a 0x00 status byte again. Also: - fall back to the advertised deviceChain before any basic or chain read - read basic info once per diagnostic update instead of twice - map charging wire codes explicitly instead of by enum order, and make the legacy stateOfCharge mapping a module-level constant Behaviour change for consumers: stateOfCharge for charge code 4 is now fully_charged (was solar_not_charging) and code 5 is now solar_not_charging (was charging_error), matching the Curtain 3 spec. Code 6 is charging_error and no longer raises IndexError. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c91ab94 to
267c9c3
Compare
Curtain charging codes 4–6 currently decode incorrectly or raise an indexing error, and short diagnostic replies can partially update cached data. Decode all seven documented states, retain unknown raw codes, and validate successful response status and length before replacing each page snapshot.
Add explicit
refresh_diagnostics()and opt-inset_diagnostics_interval(900)polling for Curtain 3. Diagnostics become due independently of advertisement freshness, run during stationary updates, expose per-page observation timestamps, and preserve cached values after failed reads. Basic updates reach subscribers first; optional Bluetooth failures do not fail successful movement commands. The chain query provides the topology needed to decode paired diagnostic pages without treating zero battery or settings as absence.Validation:
This is a draft pending physical-device validation. Responses are protocol fixtures; paired hardware, USB charging, and solar-specific behavior have not been validated on hardware. Motor snapshots and cached setting accessors are prepared on dependent branches and will be submitted separately after this PR merges. Touch-to-Open writes remain gated on app captures; no guessed setter bytes are included.
Protocol reference: https://github.com/OpenWonderLabs/SwitchBotAPI-BLE/blob/latest/devicetypes/curtain3.md