Skip to content

[WIP] Feature Request: Bots with Password Support#310

Closed
Copilot wants to merge 3 commits intolatestfrom
copilot/fix-26
Closed

[WIP] Feature Request: Bots with Password Support#310
Copilot wants to merge 3 commits intolatestfrom
copilot/fix-26

Conversation

Copy link
Contributor

Copilot AI commented Sep 4, 2025

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original issue description:

Do you have any plans to support SwitchBots with password? Otherwise I'll try to implement it myself, my current notes to this topic are:

  • It seems that using a password is quite simple, see this, by sending command 0x5711 + password + on/off instead of 0x5701 + on/off at this point in your code
  • The + password thing is also not a real challenge to implement, see here
    In Python the password string is generated by
data = password.encode()
crc = zlib.crc32(data)
self.password = crc.to_bytes(4, 'big')

using String.encode(), zlib.crc32(), Int.to_bytes()

Fixes #26.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits August 21, 2025 00:27
…sitory (#300)

This PR adds a comprehensive `.github/copilot-instructions.md` file that
provides GitHub Copilot coding agents with detailed instructions on how
to work effectively in the node-switchbot codebase.

## Key Features

**Validated Commands and Timing**: Every command has been tested from a
clean environment with actual timing measurements:
- `npm install`: ~5-25 seconds (varies by cache)
- `npm run build`: ~5 seconds (TypeScript compilation)
- `npm run test`: ~1 second (12 tests)
- `npm run lint`: ~3 seconds (ESLint validation)

**Platform-Specific Requirements**: Clear documentation of constraints:
- BLE functionality requires Linux-based OS only (Raspbian, Ubuntu,
etc.)
- Windows and macOS are NOT supported for BLE operations
- Node.js versions: ^20, ^22, or ^24 required
- ES Modules: Project uses `"type": "module"`

**Development Workflow**: Step-by-step instructions for common tasks:
- Bootstrap and setup procedures
- Build, test, and lint validation cycles
- Adding new device support
- Working with both BLE and OpenAPI interfaces

**Manual Validation Scenarios**: Specific tests to run after making
changes:
```javascript
// Basic functionality validation
const { SwitchBotBLE, SwitchBotOpenAPI } = require('./dist/index.js');
const ble = new SwitchBotBLE(); // Should not throw
const api = new SwitchBotOpenAPI('test', 'test'); // Should not throw
```

**Timeout Warnings**: Explicit "NEVER CANCEL" warnings with timeout
recommendations for all build operations to prevent premature
cancellation of long-running commands.

## Project Structure Documentation

The instructions include comprehensive information about:
- Source code organization (`src/switchbot-ble.ts`,
`src/switchbot-openapi.ts`, device classes)
- Configuration files (TypeScript, ESLint, package.json)
- Build output structure (`dist/` directory)
- Documentation generation (TypeDoc)

## Validation Completed

All instructions have been thoroughly validated by:
- Following step-by-step procedures from a clean environment
- Testing basic functionality scenarios
- Verifying ES module imports work correctly
- Confirming full development workflow chain
- Measuring actual timing for all operations

The instructions follow the required imperative tone ("Run [this
command]", "Do not do [this]") and provide exhaustive guidance for
GitHub Copilot agents to work effectively in this TypeScript Node.js
library for controlling SwitchBot devices via Bluetooth Low Energy and
OpenAPI.

Fixes #299.

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: donavanbecker <9875439+donavanbecker@users.noreply.github.com>
## [3.6.0](https://github.com/OpenWonderLabs/node-switchbot/releases/tag/v3.6.0) (2025-08-27)

### What's Changed
- Housekeeping and update dependencies
- **BREAKING**: Fixed compatibility with `@stoprocent/noble` v2.3.4 and `@stoprocent/bluetooth-hci-socket` v2.2.3
- **Enhancement**: Added comprehensive input validation utilities (`ValidationUtils` class)
- **Enhancement**: Improved error handling with more descriptive error messages
- **Enhancement**: Added command constants to replace magic numbers for better maintainability
- **Enhancement**: Enhanced type safety with proper TypeScript assertions
- **Enhancement**: Improved buffer validation with configurable minimum length
- **Enhancement**: Better resource cleanup in error scenarios with try-catch-finally blocks
- **Enhancement**: Removed deprecated parameter checker in favor of modern validation
- **Fix**: Updated `noble._state` to `noble.state` for compatibility with newer noble versions
- **Fix**: Enhanced NobleTypes interface to properly support newer noble version
- **Code Quality**: Improved JSDoc documentation throughout device classes
- **Code Quality**: Standardized validation across all device classes
- **Docs**: Updated BLE.md and OpenAPI.md for new validation and error handling features
- **Internal**: Refactored device instantiation logic for consistency
- **Internal**: Improved test coverage for validation utilities and error scenarios
- **Chore**: Synced package scripts and documentation with latest development workflow

**Full Changelog**: v3.5.1...v3.6.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Bots with Password Support

2 participants