Skip to content

v4.0.0

v4.0.0 #343

Triggered via push March 7, 2026 01:44
Status Success
Total duration 1m 32s
Artifacts

beta-release.yml

on: push
Matrix: build_and_test / build
build_and_test  /  collect_coverage_reports
build_and_test / collect_coverage_reports
publish  /  publish_npm
35s
publish / publish_npm
Discord Webhooks  /  github-releases-to-discord
4s
Discord Webhooks / github-releases-to-discord
pre-release  /  Create New Github Beta Pre Release
5s
pre-release / Create New Github Beta Pre Release
Fit to window
Zoom out
Zoom in

Annotations

1 warning and 1 notice
Discord Webhooks / github-releases-to-discord
embed field value must be shorter than 1024, got 3237 [`865ab7e`](https://github.com/OpenWonderLabs/node-switchbot/commit/865ab7e70fda3558dc2e1d6caf53cd69cff16e5a) v4.0.0 feat: v4.0.0 - Complete rewrite with hybrid BLE/API architecture and advanced features BREAKING CHANGES: - Complete rewrite with unified hybrid BLE/API architecture - No backward compatibility with v3.x - migration required - Single `SwitchBot` class replaces `SwitchBotBLE` and `SwitchBotOpenAPI` - Device access via `switchbot.devices` manager pattern - Full TypeScript rewrite with comprehensive type definitions Major Features (v4.0.0): - **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(), clear() - **30 Device Types**: Full support for all SwitchBot devices - **Event-Driven**: EventEmitter-based architecture for discovery and commands - **TypeScript Native**: Full type safety and comprehensive type exports - **Custom Errors**: Specific error classes (BLENotAvailableError, DeviceNotFoundError, etc.) - **Flexible Modes**: BLE-only mode (Linux/macOS) or API-only mode (all platforms) Additional Features (Post-4.0.0): - **macOS BLE Support**: Enable BLE on macOS in addition to Linux * Platform detection now includes darwin (macOS) * Windows remains unsupported for BLE operations - **Bot Password Protection**: BLE password support for Bot devices * CRC32 encryption for 4-char alphanumeric passwords * Methods: setPassword(), clearPassword(), hasPassword() * Automatic encrypted command execution - **Advanced Resilience**: Enterprise-grade reliability features * Retry logic with exponential backoff and jitter * Circuit breaker pattern (CLOSED/OPEN/HALF_OPEN states) * Connection intelligence tracking per-device * Custom fallback handler system with logging, metrics, alerting 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 - Full JSDoc documentation coverage - Comprehensive TypeScript type definitions - Move regex patterns to module scope for performance - Fix BLE Noble initialization race conditions - Proper null checks to prevent "Cannot read properties of undefined" Dependencies: - Update @antfu/eslint-config from 5.4.1 to 7.7.0 - Update @types/node from 25.3.3 to 25.3.5 - Update eslint from 9.39.3 to 9.39.4 - Update @stoprocent/noble to ^2.3.17 Documentation: - Add comprehensive prerequisites for BLE setup (macOS, Linux, Raspberry Pi) - Update all "Linux-only" references to "Linux/macOS" - Add password protection section to BLE.md - Create bot-password.js example - Add 6 example files covering all major use cases - Generate TypeDoc API documentation Tests: - 108 comprehensive tests (up from 40 in v3.x) - 14 new password protection tests - Device manager tests - Utilities tests - Error handling tests - Full validation of CRC32 encryption and command building Files Changed: 431 files, 13,604 insertions(+), 12,376 deletions(-)
publish / publish_npm
Published on NPM - 4.0.0-beta.6