Releases: OpenWonderLabs/node-switchbot
Releases · OpenWonderLabs/node-switchbot
v4.0.0
⚠ BREAKING CHANGES
- Complete rewrite with unified hybrid BLE/API architecture
- No backward compatibility with v3.x - migration required
- Single
SwitchBotclass replacesSwitchBotBLEandSwitchBotOpenAPI - Device access via
switchbot.devicesmanager pattern - Full TypeScript rewrite with comprehensive type definitions
Features
- Hybrid Architecture: Unified BLE-first approach with automatic OpenAPI fallback
- Automatic Discovery: Combined BLE + OpenAPI device discovery in single call
- Smart Fallback: Commands automatically retry via API when BLE fails
- Device Manager: Centralized device management with
get(),list(), andclear()methods - Expanded Device Coverage: Added support and parsing updates across newly modeled devices and accessories in the v4 architecture.
- macOS BLE Support: Enabled BLE functionality on macOS in addition to Linux
- Platform detection now includes macOS (
darwin) using@stoprocent/noble - BLE now works on Linux and macOS systems
- Windows remains unsupported for BLE operations
- Platform detection now includes macOS (
- Bot Password Protection: Added BLE password support for Bot (
WoHand) devices- Password encryption using CRC32 checksums
- Password validation for 4 alphanumeric characters, case-sensitive
- Methods:
setPassword(),clearPassword(),hasPassword() - Automatic encrypted command execution when password is set
- Example:
examples/bot-password.js - Based on homebridge-switchbot PR #1337
- Advanced Resilience Features: Enterprise-grade reliability enhancements
- Retry logic with exponential backoff and jitter
- Circuit breaker pattern to prevent cascading failures
- Connection intelligence tracking per-device success and failure rates
- Custom fallback handler system for logging, metrics, and alerting
- Intelligent connection selection based on historical performance
- Event-Driven: EventEmitter-based architecture for discovery and command events
- TypeScript Native: Written in TypeScript with full type safety and exports
- Custom Errors: Specific error classes for better error handling
- BLE-Only Mode: Works without OpenAPI credentials on Linux/macOS systems
- API-Only Mode: Works without BLE on Windows systems
- Exports and API Surface Updates: Updated
src/index.tsexports for final v4 public API packaging. - Comprehensive Examples: Updated and aligned example files for v4 usage patterns.
Technical Improvements
- Complete ES2022 module implementation
- Improved error handling with custom error classes
- Better connection management and timeout handling
- Enhanced logging with configurable log levels
- Hardened dependency graph with security overrides for vulnerable transitive packages
- Full JSDoc documentation coverage
- Comprehensive TypeScript type definitions for all devices
- Reworked test suite structure and coverage for APIs, devices, and utilities
- Auto-formatting and linting with @antfu/eslint-config
Documentation
- Updated README with v4 quick start and migration guide
- 6 usage examples in
examples/directory - Migration guide from v3.x to v4.0.0
- Added password protection section to BLE.md
- Updated README.md with password examples
- Created comprehensive password protection example
- Updated examples index with
bot-password.js - Updated platform support documentation to reflect macOS BLE support
- Updated Linux-only references to Linux/macOS where applicable
- Added comprehensive prerequisites guidance for BLE setup on macOS and Linux
- macOS: Xcode and Bluetooth permissions requirements
- Linux: system packages, non-root setup, and Raspberry Pi notes
- Based on @stoprocent/noble prerequisites
- Full API documentation via TypeDoc
Tests
- Added 14 comprehensive password protection tests
- Validation for CRC32 encryption, command building, and response parsing
- Extended fallback and retry behavior coverage across BLE/API paths
- 58 test files and 243 passing tests at release validation
Full Changelog: v3.6.8...v4.0.0
v4.0.0-beta.19
**Beta Release**
Version: v4.0.0-beta.19
How To Test Beta Releases
v4.0.0-beta.18
**Beta Release**
Version: v4.0.0-beta.18
How To Test Beta Releases
v4.0.0-beta.17
**Beta Release**
Version: v4.0.0-beta.17
How To Test Beta Releases
v4.0.0-beta.16
**Beta Release**
Version: v4.0.0-beta.16
How To Test Beta Releases
v3.6.8
What's Changed
- Fix WoAirPurifier/WoAirPurifierTable BLE parsing: serviceData fallback, mode mapping, createDevice registration by @Copilot in #329
Full Changelog: v3.6.7...v3.6.8
v3.6.7
v3.6.6
What's Changed
- fix: sync package-lock.json with @stoprocent/noble@^2.3.14 by @Copilot in #324
- feat: Add Plug Mini (EU) support by @Copilot in #325
Full Changelog: v3.6.5...v3.6.6
v3.6.5
What's Changed
- Bump @stoprocent/noble to 2.3.14 by @dnicolson in #322
Full Changelog: v3.6.4...v3.6.5
What's Changed
- Bump @stoprocent/noble to 2.3.14 by @dnicolson in #322
Full Changelog: v3.6.4...v3.6.5
v3.6.4
What's Changed
- Fix BLE parsing for Air Purifier PM2.5 with minimal serviceData by @Copilot in #320
Full Changelog: v3.6.3...v3.6.4