|
84 | 84 | </tr> |
85 | 85 | </tbody> |
86 | 86 | </table> |
| 87 | + <h5 class="mt-4">Cached Accessories</h5> |
| 88 | + <ul id="cachedAccessoriesList"></ul> |
87 | 89 | <p class="text-center">External accessories will not be displayed here.</p> |
88 | 90 | </div> |
89 | 91 | </div> |
@@ -122,7 +124,7 @@ <h5>Features</h5> |
122 | 124 | <h5>Help/About</h5> |
123 | 125 | <ul> |
124 | 126 | <li> |
125 | | - <a href="https:// |
| 127 | + <a href="https://github.com/OpenWonderLabs/homebridge-switchbot/issues/new/choose" target="_blank">Support |
126 | 128 | Request</a> |
127 | 129 | </li> |
128 | 130 | <li> |
@@ -266,7 +268,7 @@ <h2>Dynamic Config</h2> |
266 | 268 | currentConfig[0].options.devices = []; |
267 | 269 | } |
268 | 270 | currentConfig[0].options.devices.push({ |
269 | | - deviceId, |
| 271 | + deviceId: deviceId.replace(/:/g, ''), |
270 | 272 | hide_device: false, |
271 | 273 | disablePlatformBLE: false, |
272 | 274 | allowPush: false, |
@@ -307,19 +309,23 @@ <h2>Dynamic Config</h2> |
307 | 309 |
|
308 | 310 | const updateTableWithDetails = (deviceContext) => { |
309 | 311 | const tableBody = document.querySelector('#deviceTable tbody'); |
310 | | - tableBody.innerHTML = ''; |
311 | 312 |
|
312 | 313 | Object.entries(deviceContext).forEach(([key, value]) => { |
313 | | - if (value !== undefined && value !== null && String(value).trim() !== '') { |
314 | | - const row = document.createElement('tr'); |
315 | | - const keyCell = document.createElement('th'); |
316 | | - keyCell.scope = 'row'; |
317 | | - keyCell.textContent = key; |
318 | | - const valueCell = document.createElement('td'); |
319 | | - valueCell.textContent = value; |
320 | | - row.appendChild(keyCell); |
321 | | - row.appendChild(valueCell); |
322 | | - tableBody.appendChild(row); |
| 314 | + if (/string|number|boolean/.test(typeof value) && (typeof value !== 'string' || value.trim())) { |
| 315 | + let existingCell = document.getElementById(key); |
| 316 | + if (existingCell) { |
| 317 | + existingCell.textContent = value; |
| 318 | + } else { |
| 319 | + const row = document.createElement('tr'); |
| 320 | + const keyCell = document.createElement('th'); |
| 321 | + keyCell.scope = 'row'; |
| 322 | + keyCell.textContent = key; |
| 323 | + const valueCell = document.createElement('td'); |
| 324 | + valueCell.textContent = value; |
| 325 | + row.appendChild(keyCell); |
| 326 | + row.appendChild(valueCell); |
| 327 | + tableBody.appendChild(row); |
| 328 | + } |
323 | 329 | } |
324 | 330 | }); |
325 | 331 | }; |
|
0 commit comments