feat(bot): add inverse direction controls - #543
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 6 files with indirect coverage changes 🚀 New features to boost your workflow:
|
|
@bluetoothbot review |
Reviewed. Two blockers, both in First: Second: Also unverified: whether firmware pre-applies the setting before advertising. Author tested with bit cleared, so flip branch never ran on hardware.
|
PR Review — feat(bot): add inverse direction controlsThe new read/set API is solid; the Specific strengths:
🔴 Blocking
1. Device-reported bit silently overrides the caller's `inverse_mode` option — breaking change for existing users
|
bluetoothbot
left a comment
There was a problem hiding this comment.
Caution
Critical issues found.
- Device-reported bit silently overrides the caller's
inverse_modeoption — breaking change for existing users - Inversion is applied to press-mode bots, where
isOnis a hardcoded sentinel — yields a permanent wrongTrue - The core premise — that the advertised
isOnneeds flipping by the device bit — is not verified by the stated hardware testing
|
Addressed the review in
The updated CI is green. @bluetoothbot review |
|
❌ Permission denied. Only users with write access can trigger bot commands. |
|
Hi @bdraco, I addressed the bot review by removing the |
|
❌ Permission denied. Only users with write access can trigger bot commands. |
Summary
is_on()andinverse_modebehavior unchangedWhy
SwitchBot Bot stores its reverse on/off direction setting on the device, but local BLE clients had no focused API to read and change it while preserving the other mode settings.
This was reproduced on a physical Bot connected directly to Home Assistant over Bluetooth: the device had its reverse-direction bit enabled, so on/off actions operated in the opposite physical direction. Clearing the setting through this new BLE API restored the expected behavior without the SwitchBot app, cloud access, or a device reset.
Following review, this PR is intentionally limited to reading and changing the persistent device setting. It no longer changes logical on/off state calculation or advertisement override behavior.
The Home Assistant entity that exposes this setting will be submitted separately after a PySwitchbot release containing this API is available.
Testing
Contribution responsibility
This implementation was AI-assisted. Responsible human: @bingxyz, who reviewed the implementation and behavior, tested it on their physical device, and authorized this submission.
Fixes #209