@homebridge-plugins/homebridge-ecovacs 7.2.4-beta.0 → 7.2.4-beta.1

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.
@@ -72,6 +72,10 @@
72
72
  </tr>
73
73
  </thead>
74
74
  <tbody>
75
+ <tr>
76
+ <th scope="row">Protocol</th>
77
+ <td id="deviceProtocol"></td>
78
+ </tr>
75
79
  <tr>
76
80
  <th scope="row">Device ID</th>
77
81
  <td id="deviceId"></td>
@@ -231,12 +235,20 @@
231
235
  document.getElementById('menuSettings').classList.add('btn-primary')
232
236
  document.getElementById('pageSupport').style.display = 'none'
233
237
  document.getElementById('pageDevices').style.display = 'block'
234
- const cachedAccessories =
238
+ const [cachedAccessories, cachedMatterAccessories] = await Promise.all([
235
239
  typeof homebridge.getCachedAccessories === 'function'
236
- ? await homebridge.getCachedAccessories()
237
- : await homebridge.request('/getCachedAccessories')
238
- if (cachedAccessories.length > 0) {
239
- cachedAccessories.sort((a, b) => {
240
+ ? homebridge.getCachedAccessories()
241
+ : homebridge.request('/getCachedAccessories'),
242
+ typeof homebridge.getCachedMatterAccessories === 'function'
243
+ ? homebridge.getCachedMatterAccessories()
244
+ : Promise.resolve([])
245
+ ])
246
+ const allAccessories = [
247
+ ...cachedAccessories.map(a => ({ ...a, protocol: 'HAP' })),
248
+ ...cachedMatterAccessories.map(a => ({ ...a, protocol: 'Matter' }))
249
+ ]
250
+ if (allAccessories.length > 0) {
251
+ allAccessories.sort((a, b) => {
240
252
  return a.displayName.toLowerCase() > b.displayName.toLowerCase()
241
253
  ? 1
242
254
  : b.displayName.toLowerCase() > a.displayName.toLowerCase()
@@ -246,17 +258,19 @@
246
258
  }
247
259
  const deviceSelect = document.getElementById('deviceSelect')
248
260
  deviceSelect.innerHTML = ''
249
- cachedAccessories.forEach(a => {
261
+ allAccessories.forEach(a => {
250
262
  const option = document.createElement('option')
251
- option.text = a.displayName
252
- option.value = a.context.ecoDeviceId
263
+ option.text = a.protocol === 'Matter' ? a.displayName + ' (Matter)' : a.displayName
264
+ option.value = a.context.ecoDeviceId + '|' + a.protocol
253
265
  deviceSelect.add(option)
254
266
  })
255
- showDeviceInfo = async deviceId => {
267
+ showDeviceInfo = async deviceValue => {
256
268
  homebridge.showSpinner()
257
- const thisAcc = cachedAccessories.find(x => x.context.ecoDeviceId === deviceId)
269
+ const [deviceId, protocol] = deviceValue.split('|')
270
+ const thisAcc = allAccessories.find(x => x.context.ecoDeviceId === deviceId && x.protocol === protocol)
258
271
  const context = thisAcc.context
259
272
  document.getElementById('displayName').innerHTML = thisAcc.displayName
273
+ document.getElementById('deviceProtocol').innerHTML = thisAcc.protocol
260
274
  document.getElementById('deviceId').innerHTML = context.ecoDeviceId || 'N/A'
261
275
  document.getElementById('deviceOnline').innerHTML = context.isOnline
262
276
  ? '<i class="fas fa-circle mr-1 green-text"></i> Online'
@@ -275,8 +289,8 @@
275
289
  homebridge.hideSpinner()
276
290
  }
277
291
  deviceSelect.addEventListener('change', event => showDeviceInfo(event.target.value))
278
- if (cachedAccessories.length > 0) {
279
- showDeviceInfo(cachedAccessories[0].context.ecoDeviceId)
292
+ if (allAccessories.length > 0) {
293
+ showDeviceInfo(allAccessories[0].context.ecoDeviceId + '|' + allAccessories[0].protocol)
280
294
  } else {
281
295
  const option = document.createElement('option')
282
296
  option.text = 'No Devices'
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "displayName": "Homebridge Ecovacs",
4
4
  "alias": "Deebot",
5
5
  "type": "module",
6
- "version": "7.2.4-beta.0",
6
+ "version": "7.2.4-beta.1",
7
7
  "description": "Homebridge plugin to integrate Ecovacs Deebot devices into HomeKit.",
8
8
  "author": {
9
9
  "name": "bwp91",
@@ -62,7 +62,7 @@
62
62
  "postinstall": "patch-package"
63
63
  },
64
64
  "dependencies": {
65
- "@homebridge/plugin-ui-utils": "^2.1.0",
65
+ "@homebridge/plugin-ui-utils": "^2.1.1-beta.0",
66
66
  "ecovacs-deebot": "^0.9.6-beta.12",
67
67
  "patch-package": "^8.0.1"
68
68
  },