-
Notifications
You must be signed in to change notification settings - Fork 29
Add support for SwitchBot Hub3 device #302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…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>
Co-authored-by: donavanbecker <9875439+donavanbecker@users.noreply.github.com>
Co-authored-by: donavanbecker <9875439+donavanbecker@users.noreply.github.com>
donavanbecker
approved these changes
Aug 24, 2025
Copilot
AI
changed the title
[WIP] Feature Request: Support for Hub3
Add support for SwitchBot Hub3 device
Aug 24, 2025
Copilot finished work on behalf of
donavanbecker
August 24, 2025 04:20
donavanbecker
approved these changes
Aug 24, 2025
Collaborator
|
@copilot Resolve conflicts |
…witchbot into copilot/fix-301 # Conflicts: # docs/assets/hierarchy.js # docs/assets/navigation.js # docs/assets/search.js # docs/classes/Advertising.html # docs/classes/SwitchBotBLE.html # docs/classes/SwitchBotOpenAPI.html # docs/classes/SwitchbotDevice.html # docs/classes/WoBlindTilt.html # docs/classes/WoBulb.html # docs/classes/WoCeilingLight.html # docs/classes/WoContact.html # docs/classes/WoCurtain.html # docs/classes/WoHand.html # docs/classes/WoHub2.html # docs/classes/WoHumi.html # docs/classes/WoHumi2.html # docs/classes/WoIOSensorTH.html # docs/classes/WoKeypad.html # docs/classes/WoLeak.html # docs/classes/WoPlugMiniJP.html # docs/classes/WoPlugMiniUS.html # docs/classes/WoPresence.html # docs/classes/WoRelaySwitch1.html # docs/classes/WoRelaySwitch1PM.html # docs/classes/WoRemote.html # docs/classes/WoSensorTH.html # docs/classes/WoSensorTHPlus.html # docs/classes/WoSensorTHPro.html # docs/classes/WoSensorTHProCO2.html # docs/classes/WoSmartLock.html # docs/classes/WoSmartLockPro.html # docs/classes/WoStrip.html # docs/enums/LogLevel.html # docs/enums/SwitchBotBLEModel.html # docs/enums/SwitchBotBLEModelFriendlyName.html # docs/enums/SwitchBotBLEModelName.html # docs/enums/SwitchBotModel.html # docs/hierarchy.html # docs/interfaces/AdvertisementData.html # docs/interfaces/Chars.html # docs/interfaces/ErrorObject.html # docs/interfaces/NobleTypes.html # docs/interfaces/Params.html # docs/interfaces/Rule.html # docs/interfaces/ServiceData.html # docs/interfaces/SwitchBotBLEDevice.html # docs/interfaces/WebhookDetail.html # docs/interfaces/ad.html # docs/interfaces/body.html # docs/interfaces/bodyChange.html # docs/interfaces/deleteWebhookResponse.html # docs/interfaces/device.html # docs/interfaces/deviceList.html # docs/interfaces/deviceStatus.html # docs/interfaces/deviceStatusRequest.html # docs/interfaces/deviceWebhook.html # docs/interfaces/deviceWebhookContext.html # docs/interfaces/devices.html # docs/interfaces/infraredRemoteList.html # docs/interfaces/irdevice.html # docs/interfaces/pushResponse.html # docs/interfaces/queryWebhookResponse.html # docs/interfaces/setupWebhookResponse.html # docs/interfaces/switchbot.html # docs/interfaces/updateWebhookResponse.html # docs/interfaces/webhookRequest.html # docs/modules.html # docs/types/MacAddress.html # docs/types/batteryCirculatorFan.html # docs/types/batteryCirculatorFanServiceData.html # docs/types/batteryCirculatorFanStatus.html # docs/types/batteryCirculatorFanWebhookContext.html # docs/types/blindTilt.html # docs/types/blindTiltServiceData.html # docs/types/blindTiltStatus.html # docs/types/blindTiltWebhookContext.html # docs/types/bot.html # docs/types/botServiceData.html # docs/types/botStatus.html # docs/types/botWebhookContext.html # docs/types/ceilingLight.html # docs/types/ceilingLightPro.html # docs/types/ceilingLightProServiceData.html # docs/types/ceilingLightProStatus.html # docs/types/ceilingLightProWebhookContext.html # docs/types/ceilingLightServiceData.html # docs/types/ceilingLightStatus.html # docs/types/ceilingLightWebhookContext.html # docs/types/circulatorFanStatus.html # docs/types/circulatorFanWebhookContext.html # docs/types/colorBulb.html # docs/types/colorBulbServiceData.html # docs/types/colorBulbStatus.html # docs/types/colorBulbWebhookContext.html # docs/types/contactSensor.html # docs/types/contactSensorServiceData.html # docs/types/contactSensorStatus.html # docs/types/contactSensorWebhookContext.html # docs/types/curtain.html # docs/types/curtain3.html # docs/types/curtain3ServiceData.html # docs/types/curtain3WebhookContext.html # docs/types/curtainServiceData.html # docs/types/curtainStatus.html # docs/types/curtainWebhookContext.html # docs/types/floorCleaningRobotS10.html # docs/types/floorCleaningRobotS10Status.html # docs/types/floorCleaningRobotS10WebhookContext.html # docs/types/hub2.html # docs/types/hub2ServiceData.html # docs/types/hub2Status.html # docs/types/hub2WebhookContext.html # docs/types/humidifier.html # docs/types/humidifier2ServiceData.html # docs/types/humidifier2Status.html # docs/types/humidifier2WebhookContext.html # docs/types/humidifierServiceData.html # docs/types/humidifierStatus.html # docs/types/humidifierWebhookContext.html # docs/types/indoorCam.html # docs/types/indoorCameraWebhookContext.html # docs/types/keypad.html # docs/types/keypadDetectorServiceData.html # docs/types/keypadTouch.html # docs/types/keypadTouchWebhookContext.html # docs/types/keypadWebhookContext.html # docs/types/lock.html # docs/types/lockPro.html # docs/types/lockProServiceData.html # docs/types/lockProStatus.html # docs/types/lockProWebhookContext.html # docs/types/lockServiceData.html # docs/types/lockStatus.html # docs/types/lockWebhookContext.html # docs/types/meter.html # docs/types/meterPlus.html # docs/types/meterPlusServiceData.html # docs/types/meterPlusStatus.html # docs/types/meterPlusWebhookContext.html # docs/types/meterPro.html # docs/types/meterProCO2ServiceData.html # docs/types/meterProCO2Status.html # docs/types/meterProCO2WebhookContext.html # docs/types/meterProServiceData.html # docs/types/meterProStatus.html # docs/types/meterProWebhookContext.html # docs/types/meterServiceData.html # docs/types/meterStatus.html # docs/types/meterWebhookContext.html # docs/types/motionSensor.html # docs/types/motionSensorServiceData.html # docs/types/motionSensorStatus.html # docs/types/motionSensorWebhookContext.html # docs/types/onadvertisement.html # docs/types/ondiscover.html # docs/types/outdoorMeter.html # docs/types/outdoorMeterServiceData.html # docs/types/outdoorMeterStatus.html # docs/types/outdoorMeterWebhookContext.html # docs/types/panTiltCamWebhookContext.html # docs/types/pantiltCam.html # docs/types/pantiltCam2k.html # docs/types/plug.html # docs/types/plugMini.html # docs/types/plugMiniJPServiceData.html # docs/types/plugMiniJPWebhookContext.html # docs/types/plugMiniStatus.html # docs/types/plugMiniUSServiceData.html # docs/types/plugMiniUSWebhookContext.html # docs/types/plugStatus.html # docs/types/plugWebhookContext.html # docs/types/relaySwitch1Context.html # docs/types/relaySwitch1PMContext.html # docs/types/relaySwitch1PMServiceData.html # docs/types/relaySwitch1PMStatus.html # docs/types/relaySwitch1ServiceData.html # docs/types/relaySwitch1Status.html # docs/types/remote.html # docs/types/remoteServiceData.html # docs/types/robotVacuumCleanerS1.html # docs/types/robotVacuumCleanerS1Plus.html # docs/types/robotVacuumCleanerS1PlusStatus.html # docs/types/robotVacuumCleanerS1PlusWebhookContext.html # docs/types/robotVacuumCleanerS1Status.html # docs/types/robotVacuumCleanerS1WebhookContext.html # docs/types/robotVacuumCleanerServiceData.html # docs/types/stripLight.html # docs/types/stripLightServiceData.html # docs/types/stripLightStatus.html # docs/types/stripLightWebhookContext.html # docs/types/waterLeakDetector.html # docs/types/waterLeakDetectorServiceData.html # docs/types/waterLeakDetectorStatus.html # docs/types/waterLeakDetectorWebhookContext.html # src/device.ts # src/types/ble.ts # src/types/devicelist.ts # src/types/devicestatus.ts # src/types/devicewebhookstatus.ts
Contributor
Author
Conflicts have been successfully resolved! ✅ The merge conflicts with beta-3.6.0 have been resolved in commit c033d96. Key changes made: Resolved Conflicts:
Post-Resolution Validation:
The PR is now ready for review with Hub3 support fully integrated into the beta-3.6.0 codebase. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds complete support for the SwitchBot Hub3 device, addressing the feature request for devices with Device Type "Hub 3".
Changes Made
Device Support
SwitchBotModel,SwitchBotBLEModel,SwitchBotBLEModelName,SwitchBotBLEModelFriendlyName)WoHub3class extendingSwitchbotDevicewith full BLE functionalityType Definitions
hub3ServiceDatatype for BLE advertisement parsinghub3Statustype for device status responseshub3type for device list entrieshub3WebhookContexttype for webhook supportImplementation Details
The Hub3 implementation follows the same pattern as the existing Hub2 support:
W3302100(following Hub2 pattern)V(distinct from Hub2's lowercase 'v')Testing
Usage Example
The implementation ensures backward compatibility while adding full support for Hub3 devices as requested in the original issue.
Fixes #301.
💡 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.