|
| 1 | +# Manual End-to-End Verification |
| 2 | + |
| 3 | +This guide walks through manual end-to-end verification for representative devices (light, fan, curtain, lock) across BLE and OpenAPI paths, and verifies Matter-first behavior with HAP fallback. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- macOS with Bluetooth (for BLE verification) |
| 8 | +- Local development environment set up (Node.js, npm) |
| 9 | +- Homebridge installed locally or available (for running a test instance) |
| 10 | +- SwitchBot devices available (at least one light, one fan, one curtain, one lock) OR corresponding cloud-hub access |
| 11 | +- `openApiToken` when testing OpenAPI path |
| 12 | + |
| 13 | +## Quick setup |
| 14 | + |
| 15 | +1. Install dependencies: |
| 16 | + |
| 17 | +```bash |
| 18 | +npm install --legacy-peer-deps |
| 19 | +``` |
| 20 | + |
| 21 | +2. Build the plugin: |
| 22 | + |
| 23 | +```bash |
| 24 | +npm run build |
| 25 | +``` |
| 26 | + |
| 27 | +3. Recommended: run the watch task which links the plugin and restarts on changes (requires a local Homebridge installation): |
| 28 | + |
| 29 | +```bash |
| 30 | +npm run watch |
| 31 | +``` |
| 32 | + |
| 33 | +Alternative (manual linking): |
| 34 | + |
| 35 | +```bash |
| 36 | +npm run build && npm link |
| 37 | +# then run your Homebridge instance (system/homebridge UI) so it picks up the linked plugin |
| 38 | +``` |
| 39 | + |
| 40 | +## Example platform config snippets |
| 41 | + |
| 42 | +OpenAPI (cloud) path — enable Matter preference: |
| 43 | + |
| 44 | +```json |
| 45 | +{ |
| 46 | + "platform": "SwitchBot", |
| 47 | + "openApiToken": "<YOUR_OPENAPI_TOKEN>", |
| 48 | + "enableMatter": true, |
| 49 | + "preferMatter": true |
| 50 | +} |
| 51 | +``` |
| 52 | + |
| 53 | +BLE (direct) path — specify device by MAC address and prefer Matter: |
| 54 | + |
| 55 | +```json |
| 56 | +{ |
| 57 | + "platform": "SwitchBot", |
| 58 | + "devices": [ |
| 59 | + { "deviceId": "AA:BB:CC:DD:EE:FF", "type": "Light" } |
| 60 | + ], |
| 61 | + "enableMatter": true, |
| 62 | + "preferMatter": true |
| 63 | +} |
| 64 | +``` |
| 65 | + |
| 66 | +## Verification checklist |
| 67 | + |
| 68 | +Run the steps below for each device type; repeat once using BLE and once using OpenAPI (where applicable). |
| 69 | + |
| 70 | +- Start Homebridge (with the plugin linked) and verify the plugin logs indicate Matter registration attempt. |
| 71 | + - Look for log lines: `Attempting Matter registration for ...` or `Homebridge Matter API not available; will fallback to HAP`. |
| 72 | +- Confirm accessories are registered in Matter (if Homebridge Matter child-bridge present) or appear as HAP accessories otherwise. |
| 73 | + |
| 74 | +Device-specific tests |
| 75 | + |
| 76 | +- Light |
| 77 | + - Toggle On/Off from Home app (or Homebridge UI) and confirm device responds. |
| 78 | + - Set brightness to 25%, 50%, 100% and confirm device reports matching levels. |
| 79 | + - If supported, change color temperature and/or color; confirm device applies new values. |
| 80 | + |
| 81 | +- Fan |
| 82 | + - Toggle On/Off and verify. |
| 83 | + - Change rotation speed in steps (e.g., 25%, 50%, 100%). |
| 84 | + - Toggle oscillation / swing and verify position changes. |
| 85 | + |
| 86 | +- Curtain |
| 87 | + - Open and Close via Home app / controller and verify movement. |
| 88 | + - Set specific position (e.g., 50%) and verify accurate reporting. |
| 89 | + |
| 90 | +- Lock |
| 91 | + - Lock and Unlock from controller and verify state. |
| 92 | + - If lock user management supported, add/remove a test user per plugin UI and verify expected behavior. |
| 93 | + |
| 94 | +## Logs & debugging |
| 95 | + |
| 96 | +- Enable verbose logs from Homebridge or the plugin. Example: start Homebridge with a higher log level, or watch console output from `npm run watch`. |
| 97 | +- Capture logs while you perform each operation; note the request path used by the plugin: |
| 98 | + - For OpenAPI: logs will show `https://api.switch-bot.com/v1.0/...` calls. |
| 99 | + - For BLE: logs will show local device discovery / BLE connect attempts. |
| 100 | + |
| 101 | +## Run validation script (optional) |
| 102 | + |
| 103 | +You can run the TypeScript build and unit tests to confirm the codebase is healthy before manual tests: |
| 104 | + |
| 105 | +```bash |
| 106 | +npm run build && npm run test |
| 107 | +``` |
| 108 | + |
| 109 | +## Expected outcomes |
| 110 | + |
| 111 | +- Matter-first registration: when Homebridge Matter API is available and `enableMatter` is true, accessories should be registered as Matter child-bridge accessories and re-used if restored from cache. |
| 112 | +- HAP fallback: when Matter API is not available, the plugin must continue to register HAP accessories and reuse restored accessories by `accessory.context.deviceId`. |
| 113 | +- Hybrid client paths: when `openApiToken` present the plugin should prefer OpenAPI for devices reachable via cloud; when BLE is available and configured the plugin should connect directly via BLE. |
| 114 | +- Logs should show robust retry attempts for transient network errors and per-device retry throttling if configured. |
| 115 | + |
| 116 | +## Next steps I can take |
| 117 | + |
| 118 | +- Create small automated verification scripts that use the Homebridge API test harness to toggle characteristic values (requires more test harness code). |
| 119 | +- Generate a printable checklist or a GitHub issue template for manual verification results. |
| 120 | + |
| 121 | +If you want, I can add the automated verification scripts now — would you prefer a simple script that exercises On/Off and Brightness for lights, or a broader script covering all device types? |
0 commit comments