Skip to content

Releases: OpenWonderLabs/node-switchbot

v4.0.0

11 Apr 01:26

Choose a tag to compare

⚠ 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

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(), and clear() 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
  • 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.ts exports 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

11 Apr 01:24

Choose a tag to compare

v4.0.0-beta.19 Pre-release
Pre-release
**Beta Release**

Version: v4.0.0-beta.19
How To Test Beta Releases

v4.0.0-beta.18

22 Mar 11:40

Choose a tag to compare

v4.0.0-beta.18 Pre-release
Pre-release
**Beta Release**

Version: v4.0.0-beta.18
How To Test Beta Releases

v4.0.0-beta.17

10 Mar 15:38

Choose a tag to compare

v4.0.0-beta.17 Pre-release
Pre-release
**Beta Release**

Version: v4.0.0-beta.17
How To Test Beta Releases

v4.0.0-beta.16

10 Mar 00:42

Choose a tag to compare

v4.0.0-beta.16 Pre-release
Pre-release
**Beta Release**

Version: v4.0.0-beta.16
How To Test Beta Releases

v3.6.8

05 Mar 12:27

Choose a tag to compare

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

05 Mar 07:04

Choose a tag to compare

What's Changed

Full Changelog: v3.6.6...v3.6.7

v3.6.6

25 Feb 18:23

Choose a tag to compare

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

19 Feb 20:49

Choose a tag to compare

What's Changed

Full Changelog: v3.6.4...v3.6.5

What's Changed

Full Changelog: v3.6.4...v3.6.5

v3.6.4

18 Feb 01:19

Choose a tag to compare

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