@switchbot/homebridge-switchbot 5.0.0-beta.111 → 5.0.0-beta.113

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 (85) hide show
  1. package/MIGRATION.md +10 -0
  2. package/README.md +43 -0
  3. package/TODO.md +263 -0
  4. package/config.schema.json +27 -10
  5. package/dist/device-types.d.ts.map +1 -1
  6. package/dist/device-types.js +93 -63
  7. package/dist/device-types.js.map +1 -1
  8. package/dist/deviceFactory.d.ts.map +1 -1
  9. package/dist/deviceFactory.js +55 -33
  10. package/dist/deviceFactory.js.map +1 -1
  11. package/dist/devices/genericDevice.d.ts +12 -1
  12. package/dist/devices/genericDevice.d.ts.map +1 -1
  13. package/dist/devices/genericDevice.js +121 -1
  14. package/dist/devices/genericDevice.js.map +1 -1
  15. package/dist/errors.d.ts +5 -0
  16. package/dist/errors.d.ts.map +1 -0
  17. package/dist/errors.js +51 -0
  18. package/dist/errors.js.map +1 -0
  19. package/dist/homebridge-ui/endpoints/devices.d.ts.map +1 -1
  20. package/dist/homebridge-ui/endpoints/devices.js +80 -1
  21. package/dist/homebridge-ui/endpoints/devices.js.map +1 -1
  22. package/dist/homebridge-ui/endpoints/discovery.d.ts.map +1 -1
  23. package/dist/homebridge-ui/endpoints/discovery.js +73 -41
  24. package/dist/homebridge-ui/endpoints/discovery.js.map +1 -1
  25. package/dist/homebridge-ui/public/css/styles.css +209 -16
  26. package/dist/homebridge-ui/public/index.html +87 -56
  27. package/dist/homebridge-ui/public/js/api.d.ts +24 -1
  28. package/dist/homebridge-ui/public/js/api.d.ts.map +1 -1
  29. package/dist/homebridge-ui/public/js/api.js +33 -2
  30. package/dist/homebridge-ui/public/js/api.js.map +1 -1
  31. package/dist/homebridge-ui/public/js/api.ts +52 -3
  32. package/dist/homebridge-ui/public/js/app.js +1604 -143
  33. package/dist/homebridge-ui/public/js/app.js.map +3 -3
  34. package/dist/homebridge-ui/public/js/app.ts +2 -1
  35. package/dist/homebridge-ui/public/js/devices.d.ts.map +1 -1
  36. package/dist/homebridge-ui/public/js/devices.js +2 -0
  37. package/dist/homebridge-ui/public/js/devices.js.map +1 -1
  38. package/dist/homebridge-ui/public/js/devices.ts +13 -1
  39. package/dist/homebridge-ui/public/js/discovery.d.ts +1 -0
  40. package/dist/homebridge-ui/public/js/discovery.d.ts.map +1 -1
  41. package/dist/homebridge-ui/public/js/discovery.js +1244 -124
  42. package/dist/homebridge-ui/public/js/discovery.js.map +1 -1
  43. package/dist/homebridge-ui/public/js/discovery.ts +1344 -142
  44. package/dist/homebridge-ui/public/js/modals.d.ts.map +1 -1
  45. package/dist/homebridge-ui/public/js/modals.js +42 -0
  46. package/dist/homebridge-ui/public/js/modals.js.map +1 -1
  47. package/dist/homebridge-ui/public/js/modals.ts +50 -1
  48. package/dist/homebridge-ui/public/js/render.d.ts +3 -0
  49. package/dist/homebridge-ui/public/js/render.d.ts.map +1 -1
  50. package/dist/homebridge-ui/public/js/render.js +389 -36
  51. package/dist/homebridge-ui/public/js/render.js.map +1 -1
  52. package/dist/homebridge-ui/public/js/render.ts +421 -38
  53. package/dist/platform.d.ts +1 -0
  54. package/dist/platform.d.ts.map +1 -1
  55. package/dist/platform.js +3 -4
  56. package/dist/platform.js.map +1 -1
  57. package/dist/switchbotClient.d.ts.map +1 -1
  58. package/dist/switchbotClient.js +51 -5
  59. package/dist/switchbotClient.js.map +1 -1
  60. package/docs/assets/highlight.css +9 -2
  61. package/docs/index.html +28 -2
  62. package/docs/variables/default.html +1 -1
  63. package/package.json +9 -8
  64. package/src/device-types.ts +95 -64
  65. package/src/deviceFactory.ts +55 -33
  66. package/src/devices/genericDevice.ts +113 -1
  67. package/src/errors.ts +43 -0
  68. package/src/homebridge-ui/endpoints/devices.ts +82 -1
  69. package/src/homebridge-ui/endpoints/discovery.ts +78 -44
  70. package/src/homebridge-ui/public/css/styles.css +209 -16
  71. package/src/homebridge-ui/public/index.html +87 -56
  72. package/src/homebridge-ui/public/js/api.ts +52 -3
  73. package/src/homebridge-ui/public/js/app.ts +2 -1
  74. package/src/homebridge-ui/public/js/devices.ts +13 -1
  75. package/src/homebridge-ui/public/js/discovery.ts +1344 -142
  76. package/src/homebridge-ui/public/js/modals.ts +50 -1
  77. package/src/homebridge-ui/public/js/render.ts +421 -38
  78. package/src/platform.ts +3 -4
  79. package/src/switchbotClient.ts +44 -9
  80. package/test/e2e/run-e2e.spec.ts +12 -10
  81. package/test/helpers/matter-harness.ts +2 -2
  82. package/test/matter-integration.spec.ts +21 -0
  83. package/todo/COMPLETED.md +313 -0
  84. package/todo/TODO.md +80 -66
  85. package/switchbot-homebridge-switchbot-5.0.0.tgz +0 -0
@@ -111,6 +111,47 @@ export async function importDiscoveredDevice(device: any): Promise<{ configDevic
111
111
  macInput.style.fontSize = '14px'
112
112
  macInput.style.boxSizing = 'border-box'
113
113
 
114
+
115
+ // BLE Encryption Key
116
+ const encryptionKeyLabel = document.createElement('label')
117
+ encryptionKeyLabel.textContent = 'BLE Encryption Key (optional)'
118
+ encryptionKeyLabel.style.display = 'block'
119
+ encryptionKeyLabel.style.marginBottom = '6px'
120
+ encryptionKeyLabel.style.fontWeight = '500'
121
+ encryptionKeyLabel.style.fontSize = '12px'
122
+ encryptionKeyLabel.style.color = '#6b7280'
123
+
124
+ const encryptionKeyInput = document.createElement('input')
125
+ encryptionKeyInput.type = 'password'
126
+ encryptionKeyInput.value = device.encryptionKey || ''
127
+ encryptionKeyInput.placeholder = 'Paste device BLE encryption key'
128
+ encryptionKeyInput.style.width = '100%'
129
+ encryptionKeyInput.style.marginBottom = '12px'
130
+ encryptionKeyInput.style.padding = '8px 10px'
131
+ encryptionKeyInput.style.borderRadius = '6px'
132
+ encryptionKeyInput.style.fontSize = '14px'
133
+ encryptionKeyInput.style.boxSizing = 'border-box'
134
+
135
+ // BLE Key ID
136
+ const keyIdLabel = document.createElement('label')
137
+ keyIdLabel.textContent = 'BLE Key ID (optional)'
138
+ keyIdLabel.style.display = 'block'
139
+ keyIdLabel.style.marginBottom = '6px'
140
+ keyIdLabel.style.fontWeight = '500'
141
+ keyIdLabel.style.fontSize = '12px'
142
+ keyIdLabel.style.color = '#6b7280'
143
+
144
+ const keyIdInput = document.createElement('input')
145
+ keyIdInput.type = 'text'
146
+ keyIdInput.value = device.keyId || ''
147
+ keyIdInput.placeholder = 'e.g. ff'
148
+ keyIdInput.style.width = '100%'
149
+ keyIdInput.style.marginBottom = '12px'
150
+ keyIdInput.style.padding = '8px 10px'
151
+ keyIdInput.style.borderRadius = '6px'
152
+ keyIdInput.style.fontSize = '14px'
153
+ keyIdInput.style.boxSizing = 'border-box'
154
+
114
155
  const buttons = document.createElement('div')
115
156
  buttons.style.display = 'flex'
116
157
  buttons.style.gap = '10px'
@@ -132,7 +173,8 @@ export async function importDiscoveredDevice(device: any): Promise<{ configDevic
132
173
  importBtn.style.padding = '8px 20px'
133
174
  importBtn.style.fontSize = '13px'
134
175
 
135
- const cleanup = (result: { configDeviceName: string, configDeviceType: string, address?: string } | null) => {
176
+
177
+ const cleanup = (result: { configDeviceName: string, configDeviceType: string, address?: string, encryptionKey?: string, keyId?: string } | null) => {
136
178
  div.remove()
137
179
  resolve(result)
138
180
  }
@@ -142,6 +184,8 @@ export async function importDiscoveredDevice(device: any): Promise<{ configDevic
142
184
  configDeviceName: nameInput.value || device.name || device.id,
143
185
  configDeviceType: typeSelect.value || device.type,
144
186
  address: macInput.value || undefined,
187
+ encryptionKey: encryptionKeyInput.value || undefined,
188
+ keyId: keyIdInput.value || undefined,
145
189
  })
146
190
 
147
191
  div.addEventListener('click', (event) => {
@@ -150,6 +194,7 @@ export async function importDiscoveredDevice(device: any): Promise<{ configDevic
150
194
  }
151
195
  })
152
196
 
197
+
153
198
  buttons.appendChild(cancelBtn)
154
199
  buttons.appendChild(importBtn)
155
200
  contentDiv.appendChild(nameLabel)
@@ -158,6 +203,10 @@ export async function importDiscoveredDevice(device: any): Promise<{ configDevic
158
203
  contentDiv.appendChild(typeSelect)
159
204
  contentDiv.appendChild(macLabel)
160
205
  contentDiv.appendChild(macInput)
206
+ contentDiv.appendChild(encryptionKeyLabel)
207
+ contentDiv.appendChild(encryptionKeyInput)
208
+ contentDiv.appendChild(keyIdLabel)
209
+ contentDiv.appendChild(keyIdInput)
161
210
  contentDiv.appendChild(buttons)
162
211
 
163
212
  modal.appendChild(title)