@switchbot/homebridge-switchbot 5.0.0-beta.109 → 5.0.0-beta.110

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/config.schema.json +4 -0
  2. package/dist/device-types.d.ts +18 -2
  3. package/dist/device-types.d.ts.map +1 -1
  4. package/dist/device-types.js +71 -0
  5. package/dist/device-types.js.map +1 -1
  6. package/dist/deviceFactory.d.ts.map +1 -1
  7. package/dist/deviceFactory.js +1 -0
  8. package/dist/deviceFactory.js.map +1 -1
  9. package/dist/homebridge-ui/endpoints/config.d.ts +0 -3
  10. package/dist/homebridge-ui/endpoints/config.d.ts.map +1 -1
  11. package/dist/homebridge-ui/endpoints/config.js +40 -9
  12. package/dist/homebridge-ui/endpoints/config.js.map +1 -1
  13. package/dist/homebridge-ui/endpoints/devices.d.ts.map +1 -1
  14. package/dist/homebridge-ui/endpoints/devices.js +59 -2
  15. package/dist/homebridge-ui/endpoints/devices.js.map +1 -1
  16. package/dist/homebridge-ui/public/css/styles.css +254 -0
  17. package/dist/homebridge-ui/public/index.html +23 -168
  18. package/dist/homebridge-ui/public/js/api.d.ts +4 -0
  19. package/dist/homebridge-ui/public/js/api.d.ts.map +1 -1
  20. package/dist/homebridge-ui/public/js/api.js +14 -0
  21. package/dist/homebridge-ui/public/js/api.js.map +1 -1
  22. package/dist/homebridge-ui/public/js/api.ts +17 -1
  23. package/dist/homebridge-ui/public/js/app.js +556 -44
  24. package/dist/homebridge-ui/public/js/app.js.map +3 -3
  25. package/dist/homebridge-ui/public/js/app.ts +2 -1
  26. package/dist/homebridge-ui/public/js/devices-delete.d.ts +1 -0
  27. package/dist/homebridge-ui/public/js/devices-delete.d.ts.map +1 -1
  28. package/dist/homebridge-ui/public/js/devices-delete.js +108 -1
  29. package/dist/homebridge-ui/public/js/devices-delete.js.map +1 -1
  30. package/dist/homebridge-ui/public/js/devices-delete.ts +124 -1
  31. package/dist/homebridge-ui/public/js/devices.d.ts +1 -0
  32. package/dist/homebridge-ui/public/js/devices.d.ts.map +1 -1
  33. package/dist/homebridge-ui/public/js/devices.js +10 -0
  34. package/dist/homebridge-ui/public/js/devices.js.map +1 -1
  35. package/dist/homebridge-ui/public/js/devices.ts +10 -0
  36. package/dist/homebridge-ui/public/js/discovery.d.ts.map +1 -1
  37. package/dist/homebridge-ui/public/js/discovery.js +130 -4
  38. package/dist/homebridge-ui/public/js/discovery.js.map +1 -1
  39. package/dist/homebridge-ui/public/js/discovery.ts +158 -4
  40. package/dist/homebridge-ui/public/js/modals.d.ts.map +1 -1
  41. package/dist/homebridge-ui/public/js/modals.js +71 -26
  42. package/dist/homebridge-ui/public/js/modals.js.map +1 -1
  43. package/dist/homebridge-ui/public/js/modals.ts +74 -27
  44. package/dist/homebridge-ui/public/js/render.d.ts +57 -0
  45. package/dist/homebridge-ui/public/js/render.d.ts.map +1 -1
  46. package/dist/homebridge-ui/public/js/render.js +286 -13
  47. package/dist/homebridge-ui/public/js/render.js.map +1 -1
  48. package/dist/homebridge-ui/public/js/render.ts +331 -11
  49. package/dist/homebridge-ui/utils/device-migration.d.ts +35 -0
  50. package/dist/homebridge-ui/utils/device-migration.d.ts.map +1 -0
  51. package/dist/homebridge-ui/utils/device-migration.js +111 -0
  52. package/dist/homebridge-ui/utils/device-migration.js.map +1 -0
  53. package/dist/platform.js +2 -2
  54. package/dist/platform.js.map +1 -1
  55. package/docs/variables/default.html +1 -1
  56. package/package.json +1 -1
  57. package/src/device-types.ts +85 -0
  58. package/src/deviceFactory.ts +1 -0
  59. package/src/homebridge-ui/endpoints/config.ts +54 -10
  60. package/src/homebridge-ui/endpoints/devices.ts +62 -3
  61. package/src/homebridge-ui/public/css/styles.css +254 -0
  62. package/src/homebridge-ui/public/index.html +23 -168
  63. package/src/homebridge-ui/public/js/api.ts +17 -1
  64. package/src/homebridge-ui/public/js/app.ts +2 -1
  65. package/src/homebridge-ui/public/js/devices-delete.ts +124 -1
  66. package/src/homebridge-ui/public/js/devices.ts +10 -0
  67. package/src/homebridge-ui/public/js/discovery.ts +158 -4
  68. package/src/homebridge-ui/public/js/modals.ts +74 -27
  69. package/src/homebridge-ui/public/js/render.ts +331 -11
  70. package/src/homebridge-ui/utils/device-migration.ts +144 -0
  71. package/src/platform.ts +2 -2
  72. package/todo/COMPLETED.md +189 -0
  73. package/todo/README.md +59 -0
  74. package/todo/TODO.md +205 -0
  75. package/todo/mockups/filtering-sorting.svg +112 -0
  76. package/todo/mockups/modal-switchbot-theme.svg +66 -0
  77. package/todo/mockups/signal-strength-visualization.svg +94 -0
  78. package/TODO.md +0 -564
@@ -0,0 +1,189 @@
1
+ # Completed TODOs
2
+
3
+ This file tracks all completed features and improvements for the SwitchBot Homebridge Plugin.
4
+
5
+ ---
6
+
7
+ ## Code Refactoring & Architecture
8
+
9
+ ### Server-Side Refactoring ✅ COMPLETED
10
+
11
+ - [x] **Split `server.ts` into modular structure**
12
+ - [x] Created `src/homebridge-ui/endpoints/discovery.ts` - Discovery endpoint
13
+ - [x] Created `src/homebridge-ui/endpoints/config.ts` - Config management endpoint
14
+ - [x] Created `src/homebridge-ui/endpoints/devices.ts` - Device CRUD operations
15
+ - [x] Created `src/homebridge-ui/endpoints/credentials.ts` - Credentials endpoint
16
+ - [x] Created `src/homebridge-ui/utils/config-parser.ts` - Config parsing helpers
17
+ - [x] Created `src/homebridge-ui/utils/logger.ts` - Logging utility
18
+ - [x] Updated `src/homebridge-ui/server.ts` - Main entry point (imports and registers endpoints)
19
+
20
+ **Status:** Server endpoints are fully modularized and organized by concern.
21
+
22
+ ---
23
+
24
+ ## Bug Fixes
25
+
26
+ ### Invalid Device Type Validation ✅ COMPLETED
27
+
28
+ - [x] **Fix invalid device type in config schema validation**
29
+ - [x] **Issue:** Config validation rejects devices with invalid `configDeviceType` values (e.g., "Lock Vision Pro" is not in valid enum)
30
+ - [x] **Error:** "Value is not accepted. Valid values: ..." error shown in Homebridge UI
31
+ - [x] **Root Cause:** Device types in existing configs may not match current DEVICE_TYPES enum (legacy names, typos, or renamed devices)
32
+ - [x] **Affected Devices:** Any device with `configDeviceType` not matching DEVICE_TYPES enum
33
+ - [x] **Solution:** Implemented device type validation migration and auto-correction
34
+
35
+ **Implementation:**
36
+ - Added `normalizeDeviceType()` — Validates and maps invalid types to valid equivalents
37
+ - Added `isValidDeviceType()` — Checks if device type is in DEVICE_TYPES enum
38
+ - Added `getValidDeviceTypes()` — Returns set of all valid device types
39
+ - Created `src/homebridge-ui/utils/device-migration.ts` — Migration utilities for batch validation
40
+ - Updated `src/homebridge-ui/endpoints/config.ts` — Device loading now validates types and warns about invalid ones
41
+ - Added migration mapping: `"Lock Vision Pro"` → `"Keypad Vision Pro"` (and others)
42
+ - Config endpoint returns `validationWarnings` with invalid device types and suggestions
43
+
44
+ **Status:** Device type validation is now automatic. Invalid types are detected and suggestions provided to users. Auto-correction mappings handle legacy/typo device names.
45
+
46
+ ---
47
+
48
+ ### Client-Side Refactoring
49
+
50
+ #### Phase 1: Quick Wins
51
+
52
+ ##### Extract DEVICE_TYPES constant ✅ COMPLETED
53
+
54
+ - [x] Created `src/device-types.ts` as single source of truth
55
+ - [x] Updated `src/homebridge-ui/public/js/constants.ts` to import from shared source
56
+ - [x] Added `DEVICE_TYPE_NORMALIZATION_MAP` for plugin type lookups
57
+ - [x] Updated `src/deviceFactory.ts` to use normalized type mappings
58
+ - [x] Created `scripts/sync-device-types.mjs` to auto-sync config.schema.json
59
+ - [x] Integrated sync into build process (runs before tsc)
60
+
61
+ **Status:** Device types now single-sourced with auto-sync. Config schema, UI dropdown, and plugin type handling all stay aligned automatically.
62
+
63
+ ##### Extract CSS styles ✅ COMPLETED
64
+
65
+ ![Modal Theme Mockup](mockups/modal-switchbot-theme.svg)
66
+
67
+ - [x] Created `src/homebridge-ui/public/css/styles.css`
68
+ - [x] Moved all inline styles from `src/homebridge-ui/public/index.html` (2.3kb)
69
+ - [x] Updated HTML to `<link rel="stylesheet" href="css/styles.css">`
70
+ - [x] Verified build copies CSS to dist/
71
+ - [x] Tested in browser to confirm styles still work
72
+ - [x] Added SwitchBot red color variables and theme
73
+ - [x] Enhanced modal styling with red accent borders
74
+ - [x] Improved button styling with hover animations
75
+
76
+ **Status:** CSS now externalized and properly linked. Build copies files correctly to dist/. Modal uses SwitchBot red theme with Homebridge-like appearance.
77
+
78
+ #### Phase 2: JavaScript Modularization ✅ COMPLETED
79
+
80
+ - [x] Created `src/homebridge-ui/public/js/api.ts` - API client functions
81
+ - [x] Created `src/homebridge-ui/public/js/discovery.ts` - Discovery UI rendering
82
+ - [x] Created `src/homebridge-ui/public/js/modals.ts` - Modal management
83
+ - [x] Created `src/homebridge-ui/public/js/credentials.ts` - Credentials UI
84
+ - [x] Created `src/homebridge-ui/public/js/toast.ts` & `modal.ts` - UI helpers
85
+ - [x] Created `src/homebridge-ui/public/js/app.ts` - Main app init
86
+ - [x] Updated `src/homebridge-ui/public/index.html` to use bundled app.js
87
+
88
+ **Status:** UI is modularized in TypeScript. Build bundles into app.js (47.0kb). Direct TypeScript imports provide type safety.
89
+
90
+ ---
91
+
92
+ ## Discovery System Enhancements
93
+
94
+ ### Signal Strength Visualization ✅ COMPLETED
95
+
96
+ ![Signal Strength Mockup](mockups/signal-strength-visualization.svg)
97
+
98
+ - [x] Implement RSSI color-coding system:
99
+ - [x] Green: > -60 dBm (excellent)
100
+ - [x] Yellow: -60 to -75 dBm (good)
101
+ - [x] Orange: -75 to -85 dBm (fair)
102
+ - [x] Red: < -85 dBm (poor/unreliable)
103
+ - [x] Add signal strength bars visual indicator (4-bar system)
104
+ - [x] Add tooltip explaining signal quality
105
+
106
+ **Implementation:**
107
+ - Added `getRssiSignalQuality()` — Determines RSSI level, color, description, and bar count
108
+ - Added `renderSignalBars()` — Visual 4-bar indicator (filled based on signal strength)
109
+ - Added `renderSignalQualityBadge()` — Color-coded badge showing quality level (Excellent/Good/Fair/Poor)
110
+ - Updated `renderDiscoveredDevices()` — Displays bars and badges next to device names for BLE/wireless devices
111
+ - Tooltips show detailed signal info on hover
112
+
113
+ **Status:** Signal visualization now displays for all discovered devices with RSSI data. Color-coded bars and badges provide instant visual feedback about connection quality.
114
+
115
+ ### Filtering & Sorting ✅ COMPLETED
116
+
117
+ ![Filtering & Sorting Mockup](mockups/filtering-sorting.svg)
118
+
119
+ - [x] Add filter buttons: "All | BLE Only | API Only | Both | IR Devices"
120
+ - [x] Add sort dropdown: "Signal Strength | Name | Type | Connection"
121
+ - [x] Add search box to filter by name/ID/type (real-time filtering)
122
+ - [x] Persist filter/sort preferences in localStorage
123
+
124
+ **Implementation:**
125
+ - Added `filterDevices()` — Filters by connection type (BLE/API/Both/IR) and search query (matches name/id/type/model)
126
+ - Added `sortDevices()` — Sorts by name (alphabetical), signal strength (RSSI descending), device type, or connection type
127
+ - Added `getDiscoveryPreferences()` & `setDiscoveryPreferences()` — Persist user preferences in localStorage
128
+ - Updated `discovery.ts` — Creates filter buttons, sort dropdown, and search input dynamically
129
+ - All filtering/sorting is client-side (instant, no API calls)
130
+ - Search is debounced (300ms) for smooth typing
131
+ - Filter buttons highlight active selection
132
+ - Status shows "Showing X of Y device(s)" when filtered
133
+
134
+ **Status:** Full filtering and sorting implemented with localStorage persistence. Discovery page now shows:
135
+ - Filter bar with 5 buttons (All/BLE/API/Both/IR)
136
+ - Sort dropdown with 4 options (Name/Signal Strength/Type/Connection)
137
+ - Real-time search box
138
+ - All preferences saved and restored on next discovery
139
+
140
+ ---
141
+
142
+ ## Bug Fixes & Technical Debt
143
+
144
+ ### Fix lint & lint:fix scripts ✅ COMPLETED
145
+
146
+ - [x] Update ESLint configuration to include `src/homebridge-ui/**/*.ts` files
147
+ - [x] Add HTML linting for `src/homebridge-ui/**/*.html` files
148
+ - [x] Installed `eslint-plugin-html` for inline JavaScript in HTML
149
+ - [x] Update `npm run lint` script to lint both plugin and UI code
150
+ - [x] Update `npm run lint:fix` script to auto-fix both plugin and UI code
151
+ - [x] Fixed existing ESLint errors (regex patterns, multi-statement lines)
152
+ - [x] Lint now passes successfully
153
+ - [x] Test that `npm run lint` runs successfully without errors
154
+
155
+ **Changes Made:**
156
+ - Installed `eslint-plugin-html` package
157
+ - Updated `eslint.config.js` to import and configure HTML plugin
158
+ - Added `html: true` to formatters in ESLint config
159
+ - Updated package.json scripts: `lint` and `lint:fix` now include `src/homebridge-ui/**/*.html`
160
+ - Moved regex patterns to module scope in `server.ts` and `genericDevice.ts`
161
+ - Split multi-statement lines to comply with `style/max-statements-per-line` rule
162
+ - All lint errors fixed - `npm run lint` passes with 0 errors
163
+
164
+ ### Fix TypeScript compilation errors in discovery endpoint ✅ COMPLETED
165
+
166
+ - [x] Fixed: Changed `discover({ duration: 5000 })` to `discover({ timeout: 5000 })`
167
+ - [x] Fixed: Changed `switchbot.getDevices()` to use `switchbot.getAPIClient()?.getDevices()`
168
+ - [x] Reviewed node-switchbot v4.0.0-beta.3 API documentation and type definitions
169
+ - [x] Updated discovery implementation to use correct API types (APIDevice, APIInfraredRemote)
170
+ - [x] Fixed property names: `deviceId`, `deviceName`, `deviceType`, `remoteType`
171
+ - [x] Removed references to non-existent properties (`id`, `name`, `type`, `model`, `deviceModel`)
172
+
173
+ **Changes Made:**
174
+ - Updated BLE discovery to use `timeout` parameter instead of `duration`
175
+ - Changed OpenAPI access to use `switchbot.getAPIClient()?.getDevices()`
176
+ - Simplified response parsing: `apiData.deviceList` and `apiData.infraredRemoteList` (no `body` wrapper)
177
+ - Fixed all property accesses to match APIDevice and APIInfraredRemote interfaces
178
+ - Build now succeeds with 0 TypeScript errors
179
+ - All 39 tests still pass
180
+
181
+ ---
182
+
183
+ ## Notes
184
+
185
+ - All completed features have been tested and verified working
186
+ - Bundle size increased from 35.8kb → 47.0kb with new features
187
+ - Zero TypeScript compilation errors
188
+ - All lint checks passing
189
+ - UI mockups available in `todo/mockups/` directory
package/todo/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # TODO Documentation
2
+
3
+ This directory contains all task tracking and planning documentation for the SwitchBot Homebridge Plugin.
4
+
5
+ ## Structure
6
+
7
+ ```
8
+ todo/
9
+ ├── README.md # This file
10
+ ├── TODO.md # Active tasks and upcoming features
11
+ ├── COMPLETED.md # Completed features and improvements
12
+ └── mockups/ # UI design mockups
13
+ ├── signal-strength-visualization.svg
14
+ ├── filtering-sorting.svg
15
+ └── modal-switchbot-theme.svg
16
+ ```
17
+
18
+ ## Files
19
+
20
+ ### [TODO.md](TODO.md)
21
+ Active tasks and features planned for future releases. Organized by priority:
22
+ - **Must Do (Next Release)** - Critical features blocking next release
23
+ - **Should Do (Soon)** - Important features for near-term releases
24
+ - **Nice to Have (Future)** - Enhancement ideas for future consideration
25
+
26
+ ### [COMPLETED.md](COMPLETED.md)
27
+ Archive of completed features and bug fixes. Each completed item includes:
28
+ - Implementation details
29
+ - Date completed
30
+ - Links to related code/files
31
+ - UI mockups (if applicable)
32
+
33
+ ### [mockups/](mockups/)
34
+ SVG mockups showing UI designs for completed and planned features:
35
+ - **signal-strength-visualization.svg** - RSSI bars and quality badges for BLE devices
36
+ - **filtering-sorting.svg** - Discovery page filters, sort options, and search
37
+ - **modal-switchbot-theme.svg** - Edit device modal with SwitchBot red theme
38
+
39
+ ## Workflow
40
+
41
+ 1. **Planning** - New features start as unchecked items in TODO.md
42
+ 2. **Development** - Mark items as in-progress while working
43
+ 3. **Completion** - When complete, move entire section to COMPLETED.md with implementation details
44
+ 4. **UI Features** - Create SVG mockup before or after implementation for documentation
45
+
46
+ ## Priority Levels
47
+
48
+ - **Priority: Critical** - Bugs affecting functionality or compatibility
49
+ - **Priority: High** - Features needed for next release
50
+ - **Priority: Medium** - Quality of life improvements
51
+ - **Priority: Low** - Nice-to-have enhancements
52
+
53
+ ## Notes
54
+
55
+ - Always update COMPLETED.md when marking features as done
56
+ - Include implementation details and learnings
57
+ - Create mockups for all UI features
58
+ - Keep TODO.md focused on active/upcoming work
59
+ - Archive helps track project progress over time
package/todo/TODO.md ADDED
@@ -0,0 +1,205 @@
1
+ # SwitchBot Plugin TODO List
2
+
3
+ ## Active Tasks
4
+
5
+ ### Bug Fixes (Priority: Critical)
6
+
7
+ #### Matter Window Covering Conformance Issue
8
+
9
+ - [ ] **Fix Matter window covering Drapery enum validation error**
10
+ - [ ] **Issue:** Matter accessory registration fails for Curtain devices
11
+ - [ ] **Error:** `Conformance "LF & !TL": Matter does not allow enum value Drapery (ID 4) here`
12
+ - [ ] **Root Cause:** windowCovering.state.type is set to "Drapery" but Matter spec requires "LF & !TL" conformance (Lift Fail without Tilt)
13
+ - [ ] **Solution:** Need to validate/correct window covering type mappings for Matter compatibility
14
+ - [ ] **Affected Devices:** Curtain-type devices (e.g., "Master Bathroom Left Curtain")
15
+ - [ ] **Steps to Fix:**
16
+ - [ ] Check Matter window covering specification for valid type combinations
17
+ - [ ] Update device type mapping to use compliant enum values
18
+ - [ ] Validate conformance rules for Lift/Tilt combinations
19
+ - [ ] Test with Curtain, Curtain3, and Roller Shade devices
20
+
21
+ ---
22
+
23
+ ## Discovery System Enhancements
24
+
25
+ ### Quick Wins (Priority: High)
26
+
27
+ #### 1. One-Click Device Import
28
+
29
+ - [ ] Add "Add to Config" button next to each discovered device
30
+ - [ ] Implement auto-populate device configuration modal with discovered values
31
+ - [ ] Pre-fill MAC address for BLE devices to enable direct connection
32
+ - [ ] Add confirmation toast message on successful import
33
+
34
+ #### 2. Duplicate Detection
35
+
36
+ - [ ] Check if discovered device ID already exists in config
37
+ - [ ] Show badge: "✓ Already Added" (green) or "➕ New Device" (blue)
38
+ - [ ] Disable/hide "Add" button for already-added devices
39
+ - [ ] Add "View in Config" link for existing devices
40
+
41
+ #### 3. Better Loading States
42
+
43
+ - [ ] Show progress indicator: "Scanning BLE... (5s)" → "Fetching OpenAPI..." → "Complete"
44
+ - [ ] Add progress bar or spinner for each discovery phase
45
+ - [ ] Display partial results as they arrive (streaming)
46
+ - [ ] Show elapsed time for each phase
47
+ - [ ] Add "Cancel" button to abort long scans
48
+
49
+ ### Medium Effort (Priority: Medium)
50
+
51
+ #### 4. Device Grouping
52
+
53
+ - [ ] Implement grouping by Hub (show which devices are on which hub)
54
+ - [ ] Implement grouping by Connection Type
55
+ - [ ] Add expandable/collapsible group headers
56
+ - [ ] Show device count per group
57
+ - [ ] Remember expanded/collapsed state
58
+
59
+ #### 5. Connection Recommendations
60
+
61
+ - [ ] Add badge: "⚡ Recommended: BLE" for devices with strong signal (> -70 dBm)
62
+ - [ ] Add badge: "☁️ Recommended: API" for hub-dependent devices
63
+ - [ ] Show tooltip explaining why recommendation is made
64
+ - [ ] Consider device type (some work better with BLE vs API)
65
+
66
+ #### 6. Configurable BLE Scan
67
+
68
+ - [ ] Add settings panel with scan duration options (3s/5s/10s/15s)
69
+ - [ ] Add option to disable BLE scanning if no Bluetooth adapter
70
+ - [ ] Add option to adjust BLE timeout
71
+ - [ ] Remember user preferences in localStorage
72
+ - [ ] Show system Bluetooth availability status
73
+
74
+ #### 7. Discovery History/Cache
75
+
76
+ - [ ] Cache last discovery results for 5 minutes
77
+ - [ ] Show "Last scanned: X minutes ago" with timestamp
78
+ - [ ] Add "Refresh" button to re-scan
79
+ - [ ] Show cached results immediately on page load
80
+ - [ ] Auto-refresh option with configurable interval
81
+
82
+ #### 8. Detailed Device Info Panel
83
+
84
+ - [ ] Add click-to-expand device details panel
85
+ - [ ] Show extended information:
86
+ - [ ] Battery level (if available)
87
+ - [ ] Firmware version
88
+ - [ ] Cloud service enabled/disabled status
89
+ - [ ] Last seen timestamp
90
+ - [ ] Full MAC address
91
+ - [ ] Device capabilities/features
92
+ - [ ] Add "Copy ID" and "Copy MAC" buttons
93
+
94
+ ### Advanced Features (Priority: Low)
95
+
96
+ #### 9. Real-Time BLE Scanning
97
+
98
+ - [ ] Show devices as they're discovered (streaming results)
99
+ - [ ] Add animated "pulsing" indicator for active BLE scan
100
+ - [ ] Update RSSI values in real-time during scan
101
+ - [ ] Show "X devices found..." counter during scan
102
+
103
+ #### 10. Connection Testing
104
+
105
+ - [ ] Add "Test Connection" button per device
106
+ - [ ] Attempt to connect and read basic device status
107
+ - [ ] Show success/failure indicator with details
108
+ - [ ] Display connection latency
109
+ - [ ] Show which connection method succeeded (BLE/API)
110
+
111
+ #### 11. Batch Import
112
+
113
+ - [ ] Add checkboxes to select multiple devices
114
+ - [ ] Add "Add Selected to Config" button
115
+ - [ ] Implement bulk configuration with smart defaults
116
+ - [ ] Show progress for batch operations
117
+ - [ ] Allow batch enable/disable of devices
118
+
119
+ #### 12. Device Health Dashboard
120
+
121
+ - [ ] Show battery warnings (< 20%) with yellow/red indicators
122
+ - [ ] Show firmware update available indicators
123
+ - [ ] Show offline/unreachable warnings
124
+ - [ ] Add "Needs Attention" section at top
125
+ - [ ] Implement battery level trending (if historical data available)
126
+
127
+ #### 13. Export/Import Discovery
128
+
129
+ - [ ] Add "Export Results" button (JSON format)
130
+ - [ ] Add "Import Results" for comparison or troubleshooting
131
+ - [ ] Share with support for debugging
132
+ - [ ] Compare current vs previous discovery (show differences)
133
+ - [ ] Generate discovery report (formatted summary)
134
+
135
+ ---
136
+
137
+ ## Bug Fixes & Technical Debt
138
+
139
+ ### Testing & Quality Assurance
140
+
141
+ - [ ] **Test discovery with real hardware**
142
+ - [ ] Test BLE discovery with nearby devices
143
+ - [ ] Test OpenAPI discovery with cloud-registered devices
144
+ - [ ] Test with mixed BLE+API devices
145
+ - [ ] Test connection type badge display
146
+ - [ ] Verify deduplication works correctly
147
+
148
+ - [ ] **Add error handling improvements**
149
+ - [ ] Better error messages for users
150
+ - [ ] Retry logic with exponential backoff
151
+ - [ ] Graceful degradation when BLE unavailable
152
+ - [ ] Network timeout handling
153
+
154
+ ---
155
+
156
+ ## Documentation
157
+
158
+ - [ ] **Update README with discovery features**
159
+ - [ ] Document BLE vs OpenAPI discovery
160
+ - [ ] Add screenshots of new UI features
161
+ - [ ] Explain connection type badges
162
+ - [ ] Add troubleshooting guide for discovery issues
163
+
164
+ - [ ] **Create developer documentation**
165
+ - [ ] Document new modular structure
166
+ - [ ] API documentation for endpoints
167
+ - [ ] Contributing guidelines for UI changes
168
+
169
+ ---
170
+
171
+ ## Priority Summary
172
+
173
+ ### Must Do (Next Release)
174
+
175
+ 1. Fix Matter window covering conformance issue (CRITICAL)
176
+ 2. One-Click Device Import
177
+ 3. Duplicate Detection
178
+ 4. Better Loading States
179
+
180
+ ### Should Do (Soon)
181
+
182
+ 1. Connection Recommendations
183
+ 2. Device Grouping
184
+ 3. Test discovery with real hardware
185
+ 4. Update README with new features
186
+
187
+ ### Nice to Have (Future)
188
+
189
+ 1. Configurable BLE Scan
190
+ 2. Discovery History/Cache
191
+ 3. Connection Testing
192
+ 4. Batch Import
193
+ 5. Device Health Dashboard
194
+
195
+ ---
196
+
197
+ ## Notes
198
+
199
+ - See [COMPLETED.md](COMPLETED.md) for all completed features
200
+ - UI mockups available in [mockups/](mockups/) directory
201
+ - Consider user feedback on most-wanted features
202
+ - Test all changes with real SwitchBot devices
203
+ - Maintain backwards compatibility with existing configs
204
+ - Keep UI responsive and fast (< 500ms interactions)
205
+ - Follow Homebridge UI/UX conventions
@@ -0,0 +1,112 @@
1
+ <svg width="700" height="500" xmlns="http://www.w3.org/2000/svg">
2
+ <!-- Background -->
3
+ <rect width="700" height="500" fill="#f5f5f5"/>
4
+
5
+ <!-- Title -->
6
+ <text x="20" y="30" font-family="system-ui, -apple-system, Arial" font-size="18" font-weight="600" fill="#1a1a1a">
7
+ Discovery Results - Filtering &amp; Sorting
8
+ </text>
9
+
10
+ <!-- Main Container -->
11
+ <rect x="20" y="50" width="660" height="430" rx="8" fill="#fff" stroke="#ddd" stroke-width="1"/>
12
+
13
+ <!-- Filter Buttons -->
14
+ <g transform="translate(40, 75)">
15
+ <text x="0" y="0" font-family="system-ui" font-size="12" font-weight="600" fill="#666">Filter by Connection:</text>
16
+
17
+ <!-- All Button (Active) -->
18
+ <rect x="0" y="10" width="60" height="32" rx="6" fill="#ef4444"/>
19
+ <text x="30" y="31" font-family="system-ui" font-size="13" font-weight="500" fill="#fff" text-anchor="middle">All</text>
20
+
21
+ <!-- BLE Button -->
22
+ <rect x="70" y="10" width="80" height="32" rx="6" fill="#e5e7eb" stroke="#ddd" stroke-width="1"/>
23
+ <text x="110" y="31" font-family="system-ui" font-size="13" font-weight="500" fill="#4b5563" text-anchor="middle">BLE Only</text>
24
+
25
+ <!-- API Button -->
26
+ <rect x="160" y="10" width="80" height="32" rx="6" fill="#e5e7eb" stroke="#ddd" stroke-width="1"/>
27
+ <text x="200" y="31" font-family="system-ui" font-size="13" font-weight="500" fill="#4b5563" text-anchor="middle">API Only</text>
28
+
29
+ <!-- Both Button -->
30
+ <rect x="250" y="10" width="60" height="32" rx="6" fill="#e5e7eb" stroke="#ddd" stroke-width="1"/>
31
+ <text x="280" y="31" font-family="system-ui" font-size="13" font-weight="500" fill="#4b5563" text-anchor="middle">Both</text>
32
+
33
+ <!-- IR Button -->
34
+ <rect x="320" y="10" width="100" height="32" rx="6" fill="#e5e7eb" stroke="#ddd" stroke-width="1"/>
35
+ <text x="370" y="31" font-family="system-ui" font-size="13" font-weight="500" fill="#4b5563" text-anchor="middle">IR Devices</text>
36
+ </g>
37
+
38
+ <!-- Sort Dropdown and Search -->
39
+ <g transform="translate(40, 145)">
40
+ <text x="0" y="0" font-family="system-ui" font-size="12" font-weight="600" fill="#666">Sort by:</text>
41
+
42
+ <!-- Sort Dropdown -->
43
+ <rect x="0" y="10" width="180" height="32" rx="6" fill="#fff" stroke="#d1d5db" stroke-width="1"/>
44
+ <text x="10" y="31" font-family="system-ui" font-size="13" fill="#1a1a1a">Signal Strength ▼</text>
45
+
46
+ <!-- Search Box -->
47
+ <text x="210" y="0" font-family="system-ui" font-size="12" font-weight="600" fill="#666">Search:</text>
48
+ <rect x="210" y="10" width="410" height="32" rx="6" fill="#fff" stroke="#d1d5db" stroke-width="1"/>
49
+ <text x="220" y="31" font-family="system-ui" font-size="13" fill="#9ca3af">🔍 Search by name, ID, or type...</text>
50
+ </g>
51
+
52
+ <!-- Status Line -->
53
+ <text x="40" y="210" font-family="system-ui" font-size="12" fill="#666">
54
+ Showing 12 of 12 device(s)
55
+ </text>
56
+
57
+ <!-- Device List -->
58
+ <g transform="translate(40, 230)">
59
+ <!-- Device 1 -->
60
+ <rect x="0" y="0" width="620" height="50" rx="4" fill="#f9f9f9" stroke="#e0e0e0" stroke-width="1"/>
61
+ <text x="15" y="22" font-family="system-ui" font-size="14" font-weight="500" fill="#1a1a1a">Kitchen Hub</text>
62
+ <text x="15" y="38" font-family="monospace" font-size="11" fill="#666">B0E9FEC3F112 | Hub 2</text>
63
+
64
+ <!-- Signal bars - 4 bars -->
65
+ <g transform="translate(500, 12)">
66
+ <rect x="0" y="12" width="6" height="3" rx="1" fill="#10b981"/>
67
+ <rect x="9" y="8" width="6" height="7" rx="1" fill="#10b981"/>
68
+ <rect x="18" y="4" width="6" height="11" rx="1" fill="#10b981"/>
69
+ <rect x="27" y="0" width="6" height="15" rx="1" fill="#10b981"/>
70
+ </g>
71
+
72
+ <!-- Connection badge -->
73
+ <rect x="550" y="13" width="50" height="18" rx="4" fill="#fef3c7"/>
74
+ <text x="575" y="26" font-family="system-ui" font-size="10" font-weight="500" fill="#d97706" text-anchor="middle">Both</text>
75
+
76
+ <!-- Device 2 -->
77
+ <rect x="0" y="60" width="620" height="50" rx="4" fill="#f9f9f9" stroke="#e0e0e0" stroke-width="1"/>
78
+ <text x="15" y="82" font-family="system-ui" font-size="14" font-weight="500" fill="#1a1a1a">Front Door Bot</text>
79
+ <text x="15" y="98" font-family="monospace" font-size="11" fill="#666">84F703B32E12 | Bot</text>
80
+
81
+ <!-- Signal bars - 3 bars -->
82
+ <g transform="translate(500, 72)">
83
+ <rect x="0" y="12" width="6" height="3" rx="1" fill="#eab308"/>
84
+ <rect x="9" y="8" width="6" height="7" rx="1" fill="#eab308"/>
85
+ <rect x="18" y="4" width="6" height="11" rx="1" fill="#eab308"/>
86
+ <rect x="27" y="0" width="6" height="15" rx="1" fill="#e5e7eb"/>
87
+ </g>
88
+
89
+ <!-- Connection badge -->
90
+ <rect x="550" y="73" width="50" height="18" rx="4" fill="#dbeafe"/>
91
+ <text x="575" y="86" font-family="system-ui" font-size="10" font-weight="500" fill="#3b82f6" text-anchor="middle">BLE</text>
92
+
93
+ <!-- Device 3 -->
94
+ <rect x="0" y="120" width="620" height="50" rx="4" fill="#f9f9f9" stroke="#e0e0e0" stroke-width="1"/>
95
+ <text x="15" y="142" font-family="system-ui" font-size="14" font-weight="500" fill="#1a1a1a">Living Room TV</text>
96
+ <text x="15" y="158" font-family="monospace" font-size="11" fill="#666">IR-A1B2C3D4 | TV (IR)</text>
97
+
98
+ <!-- No signal bars for IR -->
99
+
100
+ <!-- Connection badge -->
101
+ <rect x="550" y="133" width="50" height="18" rx="4" fill="#fce7f3"/>
102
+ <text x="575" y="146" font-family="system-ui" font-size="10" font-weight="500" fill="#ec4899" text-anchor="middle">IR</text>
103
+ </g>
104
+
105
+ <!-- Feature Labels -->
106
+ <g transform="translate(40, 450)">
107
+ <text x="0" y="0" font-family="system-ui" font-size="10" font-weight="600" fill="#9ca3af">Features:</text>
108
+ <text x="0" y="15" font-family="system-ui" font-size="9" fill="#9ca3af">✓ Real-time search with 300ms debounce</text>
109
+ <text x="200" y="15" font-family="system-ui" font-size="9" fill="#9ca3af">✓ Client-side filtering (instant)</text>
110
+ <text x="400" y="15" font-family="system-ui" font-size="9" fill="#9ca3af">✓ localStorage persistence</text>
111
+ </g>
112
+ </svg>
@@ -0,0 +1,66 @@
1
+ <svg width="600" height="500" xmlns="http://www.w3.org/2000/svg">
2
+ <!-- Backdrop Overlay -->
3
+ <rect width="600" height="500" fill="rgba(0,0,0,0.7)"/>
4
+
5
+ <!-- Modal Container -->
6
+ <g transform="translate(60, 80)">
7
+ <!-- Modal Background with Red Top Border -->
8
+ <rect x="0" y="4" width="480" height="370" rx="12" fill="#fff"/>
9
+ <rect x="0" y="0" width="480" height="4" rx="2" fill="#ef4444"/>
10
+
11
+ <!-- Box Shadow Effect -->
12
+ <rect x="2" y="6" width="476" height="368" rx="12" fill="none" stroke="rgba(0,0,0,0.1)" stroke-width="2"/>
13
+
14
+ <!-- Modal Header -->
15
+ <text x="24" y="50" font-family="system-ui, -apple-system, Arial" font-size="20" font-weight="600" fill="#ef4444">
16
+ Edit Device
17
+ </text>
18
+
19
+ <!-- Content Area -->
20
+ <g transform="translate(24, 80)">
21
+ <!-- Device Name Field -->
22
+ <text x="0" y="0" font-family="system-ui" font-size="13" font-weight="500" fill="#374151">Device Name</text>
23
+ <rect x="0" y="8" width="432" height="40" rx="6" fill="#fff" stroke="#d1d5db" stroke-width="1"/>
24
+ <text x="10" y="33" font-family="system-ui" font-size="14" fill="#1a1a1a">Girl's Bedroom Hub</text>
25
+
26
+ <!-- API Device Type Field (Read-only) -->
27
+ <text x="0" y="70" font-family="system-ui" font-size="13" font-weight="500" fill="#374151">Device Type (API - Read Only)</text>
28
+ <rect x="0" y="78" width="432" height="40" rx="6" fill="#f9fafb" stroke="#d1d5db" stroke-width="1"/>
29
+ <text x="10" y="103" font-family="system-ui" font-size="14" fill="#6b7280">Hub 2</text>
30
+
31
+ <!-- Config Device Type Dropdown -->
32
+ <text x="0" y="140" font-family="system-ui" font-size="13" font-weight="500" fill="#374151">Config Device Type (Override)</text>
33
+ <rect x="0" y="148" width="432" height="40" rx="6" fill="#fff" stroke="#d1d5db" stroke-width="1"/>
34
+ <text x="10" y="173" font-family="system-ui" font-size="14" fill="#1a1a1a">Hub 2 ▼</text>
35
+
36
+ <!-- Divider Line -->
37
+ <line x1="0" y1="220" x2="432" y2="220" stroke="rgba(0,0,0,0.1)" stroke-width="1"/>
38
+
39
+ <!-- Button Group -->
40
+ <g transform="translate(0, 240)">
41
+ <!-- Cancel Button -->
42
+ <rect x="0" y="0" width="100" height="40" rx="6" fill="#6b7280"/>
43
+ <text x="50" y="25" font-family="system-ui" font-size="14" font-weight="500" fill="#fff" text-anchor="middle">Cancel</text>
44
+
45
+ <!-- Save Button with Hover Effect -->
46
+ <g transform="translate(332, 0)">
47
+ <!-- Button Shadow -->
48
+ <rect x="0" y="2" width="100" height="40" rx="6" fill="rgba(239,68,68,0.2)"/>
49
+ <!-- Button -->
50
+ <rect x="0" y="0" width="100" height="40" rx="6" fill="#ef4444"/>
51
+ <text x="50" y="25" font-family="system-ui" font-size="14" font-weight="500" fill="#fff" text-anchor="middle">Save</text>
52
+ </g>
53
+ </g>
54
+ </g>
55
+ </g>
56
+
57
+ <!-- Design Notes -->
58
+ <g transform="translate(20, 470)">
59
+ <text x="0" y="0" font-family="system-ui" font-size="10" font-weight="600" fill="#9ca3af">Design Elements:</text>
60
+ <text x="100" y="0" font-family="system-ui" font-size="9" fill="#9ca3af">● 4px SwitchBot Red top accent</text>
61
+ <text x="270" y="0" font-family="system-ui" font-size="9" fill="#9ca3af">● 12px border-radius</text>
62
+ <text x="380" y="0" font-family="system-ui" font-size="9" fill="#9ca3af">● Smooth shadows</text>
63
+ <text x="100" y="15" font-family="system-ui" font-size="9" fill="#9ca3af">● Red title and primary button</text>
64
+ <text x="270" y="15" font-family="system-ui" font-size="9" fill="#9ca3af">● Gray secondary button</text>
65
+ </g>
66
+ </svg>