@switchbot/homebridge-switchbot 2.8.1-beta.2 → 2.8.1-beta.21

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 (109) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/config.schema.json +3 -3
  3. package/dist/device/blindtilt.d.ts.map +1 -1
  4. package/dist/device/blindtilt.js +37 -23
  5. package/dist/device/blindtilt.js.map +1 -1
  6. package/dist/device/bot.d.ts.map +1 -1
  7. package/dist/device/bot.js +26 -10
  8. package/dist/device/bot.js.map +1 -1
  9. package/dist/device/ceilinglight.d.ts.map +1 -1
  10. package/dist/device/ceilinglight.js +78 -29
  11. package/dist/device/ceilinglight.js.map +1 -1
  12. package/dist/device/colorbulb.d.ts.map +1 -1
  13. package/dist/device/colorbulb.js +78 -29
  14. package/dist/device/colorbulb.js.map +1 -1
  15. package/dist/device/contact.d.ts.map +1 -1
  16. package/dist/device/contact.js +22 -19
  17. package/dist/device/contact.js.map +1 -1
  18. package/dist/device/curtain.d.ts.map +1 -1
  19. package/dist/device/curtain.js +36 -20
  20. package/dist/device/curtain.js.map +1 -1
  21. package/dist/device/hub.d.ts +3 -3
  22. package/dist/device/hub.d.ts.map +1 -1
  23. package/dist/device/hub.js +205 -172
  24. package/dist/device/hub.js.map +1 -1
  25. package/dist/device/humidifier.d.ts.map +1 -1
  26. package/dist/device/humidifier.js +66 -28
  27. package/dist/device/humidifier.js.map +1 -1
  28. package/dist/device/iosensor.d.ts.map +1 -1
  29. package/dist/device/iosensor.js +21 -11
  30. package/dist/device/iosensor.js.map +1 -1
  31. package/dist/device/lightstrip.d.ts.map +1 -1
  32. package/dist/device/lightstrip.js +63 -25
  33. package/dist/device/lightstrip.js.map +1 -1
  34. package/dist/device/lock.d.ts.map +1 -1
  35. package/dist/device/lock.js +35 -19
  36. package/dist/device/lock.js.map +1 -1
  37. package/dist/device/meter.d.ts +2 -2
  38. package/dist/device/meter.d.ts.map +1 -1
  39. package/dist/device/meter.js +41 -31
  40. package/dist/device/meter.js.map +1 -1
  41. package/dist/device/meterplus.d.ts.map +1 -1
  42. package/dist/device/meterplus.js +23 -13
  43. package/dist/device/meterplus.js.map +1 -1
  44. package/dist/device/motion.d.ts.map +1 -1
  45. package/dist/device/motion.js +21 -16
  46. package/dist/device/motion.js.map +1 -1
  47. package/dist/device/plug.d.ts.map +1 -1
  48. package/dist/device/plug.js +32 -16
  49. package/dist/device/plug.js.map +1 -1
  50. package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
  51. package/dist/device/robotvacuumcleaner.js +48 -21
  52. package/dist/device/robotvacuumcleaner.js.map +1 -1
  53. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  54. package/dist/irdevice/airconditioner.js +15 -9
  55. package/dist/irdevice/airconditioner.js.map +1 -1
  56. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  57. package/dist/irdevice/airpurifier.js +15 -9
  58. package/dist/irdevice/airpurifier.js.map +1 -1
  59. package/dist/irdevice/camera.d.ts.map +1 -1
  60. package/dist/irdevice/camera.js +15 -9
  61. package/dist/irdevice/camera.js.map +1 -1
  62. package/dist/irdevice/fan.d.ts.map +1 -1
  63. package/dist/irdevice/fan.js +15 -9
  64. package/dist/irdevice/fan.js.map +1 -1
  65. package/dist/irdevice/light.d.ts.map +1 -1
  66. package/dist/irdevice/light.js +16 -10
  67. package/dist/irdevice/light.js.map +1 -1
  68. package/dist/irdevice/other.d.ts.map +1 -1
  69. package/dist/irdevice/other.js +15 -4
  70. package/dist/irdevice/other.js.map +1 -1
  71. package/dist/irdevice/tv.d.ts.map +1 -1
  72. package/dist/irdevice/tv.js +15 -9
  73. package/dist/irdevice/tv.js.map +1 -1
  74. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  75. package/dist/irdevice/vacuumcleaner.js +15 -9
  76. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  77. package/dist/irdevice/waterheater.d.ts.map +1 -1
  78. package/dist/irdevice/waterheater.js +15 -9
  79. package/dist/irdevice/waterheater.js.map +1 -1
  80. package/dist/platform.d.ts.map +1 -1
  81. package/dist/platform.js +48 -20
  82. package/dist/platform.js.map +1 -1
  83. package/package.json +1 -1
  84. package/src/device/blindtilt.ts +35 -25
  85. package/src/device/bot.ts +25 -10
  86. package/src/device/ceilinglight.ts +73 -30
  87. package/src/device/colorbulb.ts +73 -30
  88. package/src/device/contact.ts +21 -20
  89. package/src/device/curtain.ts +34 -21
  90. package/src/device/hub.ts +211 -188
  91. package/src/device/humidifier.ts +62 -29
  92. package/src/device/iosensor.ts +20 -11
  93. package/src/device/lightstrip.ts +59 -26
  94. package/src/device/lock.ts +33 -20
  95. package/src/device/meter.ts +42 -34
  96. package/src/device/meterplus.ts +22 -13
  97. package/src/device/motion.ts +20 -17
  98. package/src/device/plug.ts +30 -17
  99. package/src/device/robotvacuumcleaner.ts +45 -22
  100. package/src/irdevice/airconditioner.ts +14 -10
  101. package/src/irdevice/airpurifier.ts +14 -10
  102. package/src/irdevice/camera.ts +14 -10
  103. package/src/irdevice/fan.ts +14 -10
  104. package/src/irdevice/light.ts +15 -11
  105. package/src/irdevice/other.ts +14 -4
  106. package/src/irdevice/tv.ts +14 -10
  107. package/src/irdevice/vacuumcleaner.ts +14 -10
  108. package/src/irdevice/waterheater.ts +14 -10
  109. package/src/platform.ts +50 -26
@@ -77,12 +77,6 @@ export class RobotVacuumCleaner {
77
77
  (this.robotVacuumCleanerService = accessory.getService(this.platform.Service.Lightbulb) || accessory.addService(this.platform.Service.Lightbulb)),
78
78
  `${device.deviceName} ${device.deviceType}`;
79
79
 
80
- // To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
81
- // when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
82
- // accessory.getService('NAME') ?? accessory.addService(this.platform.Service.Lightbulb, 'NAME', 'USER_DEFINED_SUBTYPE');
83
-
84
- // set the service name, this is what is displayed as the default name on the Home app
85
- // in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
86
80
  this.robotVacuumCleanerService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
87
81
  if (!this.robotVacuumCleanerService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
88
82
  this.robotVacuumCleanerService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
@@ -293,16 +287,25 @@ export class RobotVacuumCleaner {
293
287
  const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/status`, {
294
288
  headers: this.platform.generateHeaders(),
295
289
  });
290
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
291
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
292
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
296
293
  const deviceStatus: any = await body.json();
297
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Devices: ${JSON.stringify(deviceStatus.body)}`);
298
- this.statusCode(statusCode);
299
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
300
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} refreshStatus: ${JSON.stringify(deviceStatus)}`);
301
- this.OpenAPI_On = deviceStatus.body.power;
302
- this.OpenAPI_BatteryLevel = deviceStatus.body.battery;
303
- this.OpenAPI_FirmwareRevision = deviceStatus.body.version;
304
- this.openAPIparseStatus();
305
- this.updateHomeKitCharacteristics();
294
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
295
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
296
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
297
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
298
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
299
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
300
+ this.OpenAPI_On = deviceStatus.body.power;
301
+ this.OpenAPI_BatteryLevel = deviceStatus.body.battery;
302
+ this.OpenAPI_FirmwareRevision = deviceStatus.body.version;
303
+ this.openAPIparseStatus();
304
+ this.updateHomeKitCharacteristics();
305
+ } else {
306
+ this.statusCode(statusCode);
307
+ this.statusCode(deviceStatus.statusCode);
308
+ }
306
309
  } catch (e: any) {
307
310
  this.apiError(e);
308
311
  this.errorLog(
@@ -412,10 +415,20 @@ export class RobotVacuumCleaner {
412
415
  method: 'POST',
413
416
  headers: this.platform.generateHeaders(),
414
417
  });
418
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
419
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
420
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
415
421
  const deviceStatus: any = await body.json();
416
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Devices: ${JSON.stringify(deviceStatus.body)}`);
417
- this.statusCode(statusCode);
418
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
422
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
423
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
424
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
425
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
426
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
427
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
428
+ } else {
429
+ this.statusCode(statusCode);
430
+ this.statusCode(deviceStatus.statusCode);
431
+ }
419
432
  } catch (e: any) {
420
433
  this.apiError(e);
421
434
  this.errorLog(
@@ -441,10 +454,20 @@ export class RobotVacuumCleaner {
441
454
  method: 'POST',
442
455
  headers: this.platform.generateHeaders(),
443
456
  });
457
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
458
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
459
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
444
460
  const deviceStatus: any = await body.json();
445
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Devices: ${JSON.stringify(deviceStatus.body)}`);
446
- this.statusCode(statusCode);
447
- this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
461
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
462
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
463
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
464
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
465
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
466
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
467
+ } else {
468
+ this.statusCode(statusCode);
469
+ this.statusCode(deviceStatus.statusCode);
470
+ }
448
471
  } catch (e: any) {
449
472
  this.apiError(e);
450
473
  this.errorLog(
@@ -566,7 +589,7 @@ export class RobotVacuumCleaner {
566
589
  this.accessory.getService(this.platform.Service.AccessoryInformation)!
567
590
  .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.OpenAPI_FirmwareRevision);
568
591
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
569
- + `updateCharacteristic CurrentTemperature: ${this.OpenAPI_FirmwareRevision}`);
592
+ + `updateCharacteristic FirmwareRevision: ${this.OpenAPI_FirmwareRevision}`);
570
593
  }
571
594
  }
572
595
 
@@ -71,12 +71,6 @@ export class AirConditioner {
71
71
  (this.coolerService = accessory.getService(this.platform.Service.HeaterCooler) || accessory.addService(this.platform.Service.HeaterCooler)),
72
72
  `${accessory.displayName} ${device.remoteType}`;
73
73
 
74
- // To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
75
- // when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
76
- // accessory.getService('NAME') ?? accessory.addService(this.platform.Service.Outlet, 'NAME', 'USER_DEFINED_SUBTYPE');
77
-
78
- // set the service name, this is what is displayed as the default name on the Home app
79
- // in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
80
74
  this.coolerService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
81
75
  if (!this.coolerService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
82
76
  this.coolerService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
@@ -262,11 +256,21 @@ export class AirConditioner {
262
256
  method: 'POST',
263
257
  headers: this.platform.generateHeaders(),
264
258
  });
259
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
260
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
261
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
265
262
  const deviceStatus: any = await body.json();
266
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Devices: ${JSON.stringify(deviceStatus.body)}`);
267
- this.statusCode(statusCode);
268
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
269
- this.updateHomeKitCharacteristics();
263
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
264
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
265
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
266
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
267
+ this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
268
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
269
+ this.updateHomeKitCharacteristics();
270
+ } else {
271
+ this.statusCode(statusCode);
272
+ this.statusCode(deviceStatus.statusCode);
273
+ }
270
274
  } catch (e: any) {
271
275
  this.apiError(e);
272
276
  this.errorLog(
@@ -65,12 +65,6 @@ export class AirPurifier {
65
65
  (this.airPurifierService = accessory.getService(this.platform.Service.AirPurifier) || accessory.addService(this.platform.Service.AirPurifier)),
66
66
  `${accessory.displayName} Air Purifier`;
67
67
 
68
- // To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
69
- // when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
70
- // accessory.getService('NAME') ?? accessory.addService(this.platform.Service.Outlet, 'NAME', 'USER_DEFINED_SUBTYPE');
71
-
72
- // set the service name, this is what is displayed as the default name on the Home app
73
- // in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
74
68
  this.airPurifierService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
75
69
  if (!this.airPurifierService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
76
70
  this.airPurifierService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
@@ -218,11 +212,21 @@ export class AirPurifier {
218
212
  method: 'POST',
219
213
  headers: this.platform.generateHeaders(),
220
214
  });
215
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
216
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
217
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
221
218
  const deviceStatus: any = await body.json();
222
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Devices: ${JSON.stringify(deviceStatus.body)}`);
223
- this.statusCode(statusCode);
224
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
225
- this.updateHomeKitCharacteristics();
219
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
220
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
221
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
222
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
223
+ this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
224
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
225
+ this.updateHomeKitCharacteristics();
226
+ } else {
227
+ this.statusCode(statusCode);
228
+ this.statusCode(deviceStatus.statusCode);
229
+ }
226
230
  } catch (e: any) {
227
231
  this.apiError(e);
228
232
  this.errorLog(
@@ -47,12 +47,6 @@ export class Camera {
47
47
  (this.switchService = accessory.getService(this.platform.Service.Switch) || accessory.addService(this.platform.Service.Switch)),
48
48
  `${accessory.displayName} Camera`;
49
49
 
50
- // To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
51
- // when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
52
- // accessory.getService('NAME') ?? accessory.addService(this.platform.Service.Outlet, 'NAME', 'USER_DEFINED_SUBTYPE');
53
-
54
- // set the service name, this is what is displayed as the default name on the Home app
55
- // in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
56
50
  this.switchService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
57
51
  if (!this.switchService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
58
52
  this.switchService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
@@ -123,11 +117,21 @@ export class Camera {
123
117
  method: 'POST',
124
118
  headers: this.platform.generateHeaders(),
125
119
  });
120
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
121
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
122
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
126
123
  const deviceStatus: any = await body.json();
127
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Devices: ${JSON.stringify(deviceStatus.body)}`);
128
- this.statusCode(statusCode);
129
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
130
- this.updateHomeKitCharacteristics();
124
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
125
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
126
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
127
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
128
+ this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
129
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
130
+ this.updateHomeKitCharacteristics();
131
+ } else {
132
+ this.statusCode(statusCode);
133
+ this.statusCode(deviceStatus.statusCode);
134
+ }
131
135
  } catch (e: any) {
132
136
  this.apiError(e);
133
137
  this.errorLog(
@@ -54,12 +54,6 @@ export class Fan {
54
54
  (this.fanService = accessory.getService(this.platform.Service.Fanv2) || accessory.addService(this.platform.Service.Fanv2)),
55
55
  `${accessory.displayName} Fan`;
56
56
 
57
- // To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
58
- // when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
59
- // accessory.getService('NAME') ?? accessory.addService(this.platform.Service.Outlet, 'NAME', 'USER_DEFINED_SUBTYPE');
60
-
61
- // set the service name, this is what is displayed as the default name on the Home app
62
- // in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
63
57
  this.fanService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
64
58
  if (!this.fanService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
65
59
  this.fanService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
@@ -240,11 +234,21 @@ export class Fan {
240
234
  method: 'POST',
241
235
  headers: this.platform.generateHeaders(),
242
236
  });
237
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
238
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
239
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
243
240
  const deviceStatus: any = await body.json();
244
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Devices: ${JSON.stringify(deviceStatus.body)}`);
245
- this.statusCode(statusCode);
246
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
247
- this.updateHomeKitCharacteristics();
241
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
242
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
243
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
244
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
245
+ this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
246
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
247
+ this.updateHomeKitCharacteristics();
248
+ } else {
249
+ this.statusCode(statusCode);
250
+ this.statusCode(deviceStatus.statusCode);
251
+ }
248
252
  } catch (e: any) {
249
253
  this.apiError(e);
250
254
  this.errorLog(
@@ -47,12 +47,6 @@ export class Light {
47
47
  (this.lightBulbService = accessory.getService(this.platform.Service.Lightbulb) || accessory.addService(this.platform.Service.Lightbulb)),
48
48
  `${accessory.displayName} ${device.remoteType}`;
49
49
 
50
- // To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
51
- // when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
52
- // accessory.getService('NAME') ?? accessory.addService(this.platform.Service.Outlet, 'NAME', 'USER_DEFINED_SUBTYPE');
53
-
54
- // set the service name, this is what is displayed as the default name on the Home app
55
- // in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
56
50
  this.lightBulbService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
57
51
  if (!this.lightBulbService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
58
52
  this.lightBulbService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
@@ -147,12 +141,22 @@ export class Light {
147
141
  method: 'POST',
148
142
  headers: this.platform.generateHeaders(),
149
143
  });
144
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
145
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
146
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
150
147
  const deviceStatus: any = await body.json();
151
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Devices: ${JSON.stringify(deviceStatus.body)}`);
152
- this.statusCode(statusCode);
153
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
154
- this.accessory.context.On = this.On;
155
- this.updateHomeKitCharacteristics();
148
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
149
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
150
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
151
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
152
+ this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
153
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
154
+ this.accessory.context.On = this.On;
155
+ this.updateHomeKitCharacteristics();
156
+ } else {
157
+ this.statusCode(statusCode);
158
+ this.statusCode(deviceStatus.statusCode);
159
+ }
156
160
  } catch (e: any) {
157
161
  this.apiError(e);
158
162
  this.errorLog(
@@ -142,11 +142,21 @@ export class Others {
142
142
  method: 'POST',
143
143
  headers: this.platform.generateHeaders(),
144
144
  });
145
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
146
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
147
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
145
148
  const deviceStatus: any = await body.json();
146
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Devices: ${JSON.stringify(deviceStatus.body)}`);
147
- this.statusCode(statusCode);
148
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
149
- this.updateHomeKitCharacteristics();
149
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
150
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
151
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
152
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
153
+ this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
154
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
155
+ this.updateHomeKitCharacteristics();
156
+ } else {
157
+ this.statusCode(statusCode);
158
+ this.statusCode(deviceStatus.statusCode);
159
+ }
150
160
  } catch (e: any) {
151
161
  this.apiError(e);
152
162
  this.errorLog(
@@ -78,12 +78,6 @@ export class TV {
78
78
  `${accessory.displayName} ${device.remoteType}`;
79
79
  }
80
80
 
81
- // To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
82
- // when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
83
- // accessory.getService('NAME') ?? accessory.addService(this.platform.Service.Outlet, 'NAME', 'USER_DEFINED_SUBTYPE');
84
-
85
- // set the service name, this is what is displayed as the default name on the Home app
86
- // in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
87
81
  this.tvService.getCharacteristic(this.platform.Characteristic.ConfiguredName);
88
82
 
89
83
  // set sleep discovery characteristic
@@ -372,11 +366,21 @@ export class TV {
372
366
  method: 'POST',
373
367
  headers: this.platform.generateHeaders(),
374
368
  });
369
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
370
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
371
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
375
372
  const deviceStatus: any = await body.json();
376
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Devices: ${JSON.stringify(deviceStatus.body)}`);
377
- this.statusCode(statusCode);
378
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
379
- this.updateHomeKitCharacteristics();
373
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
374
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
375
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
376
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
377
+ this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
378
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
379
+ this.updateHomeKitCharacteristics();
380
+ } else {
381
+ this.statusCode(statusCode);
382
+ this.statusCode(deviceStatus.statusCode);
383
+ }
380
384
  } catch (e: any) {
381
385
  this.apiError(e);
382
386
  this.errorLog(
@@ -47,12 +47,6 @@ export class VacuumCleaner {
47
47
  (this.switchService = accessory.getService(this.platform.Service.Switch) || accessory.addService(this.platform.Service.Switch)),
48
48
  `${accessory.displayName} ${device.remoteType}`;
49
49
 
50
- // To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
51
- // when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
52
- // accessory.getService('NAME') ?? accessory.addService(this.platform.Service.Outlet, 'NAME', 'USER_DEFINED_SUBTYPE');
53
-
54
- // set the service name, this is what is displayed as the default name on the Home app
55
- // in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
56
50
  this.switchService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
57
51
  if (!this.switchService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
58
52
  this.switchService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
@@ -119,11 +113,21 @@ export class VacuumCleaner {
119
113
  method: 'POST',
120
114
  headers: this.platform.generateHeaders(),
121
115
  });
116
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
117
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
118
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
122
119
  const deviceStatus: any = await body.json();
123
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Devices: ${JSON.stringify(deviceStatus.body)}`);
124
- this.statusCode(statusCode);
125
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
126
- this.updateHomeKitCharacteristics();
120
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
121
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
122
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
123
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
124
+ this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
125
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
126
+ this.updateHomeKitCharacteristics();
127
+ } else {
128
+ this.statusCode(statusCode);
129
+ this.statusCode(deviceStatus.statusCode);
130
+ }
127
131
  } catch (e: any) {
128
132
  this.apiError(e);
129
133
  this.errorLog(
@@ -47,12 +47,6 @@ export class WaterHeater {
47
47
  (this.valveService = accessory.getService(this.platform.Service.Valve) || accessory.addService(this.platform.Service.Valve)),
48
48
  `${accessory.displayName} ${device.remoteType}`;
49
49
 
50
- // To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error,
51
- // when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id:
52
- // accessory.getService('NAME') ?? accessory.addService(this.platform.Service.Outlet, 'NAME', 'USER_DEFINED_SUBTYPE');
53
-
54
- // set the service name, this is what is displayed as the default name on the Home app
55
- // in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method.
56
50
  this.valveService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
57
51
  if (!this.valveService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
58
52
  this.valveService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
@@ -128,11 +122,21 @@ export class WaterHeater {
128
122
  method: 'POST',
129
123
  headers: this.platform.generateHeaders(),
130
124
  });
125
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
126
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
127
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
131
128
  const deviceStatus: any = await body.json();
132
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Devices: ${JSON.stringify(deviceStatus.body)}`);
133
- this.statusCode(statusCode);
134
- this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
135
- this.updateHomeKitCharacteristics();
129
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
130
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
131
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
132
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
133
+ this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
134
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
135
+ this.updateHomeKitCharacteristics();
136
+ } else {
137
+ this.statusCode(statusCode);
138
+ this.statusCode(deviceStatus.statusCode);
139
+ }
136
140
  } catch (e: any) {
137
141
  this.apiError(e);
138
142
  this.errorLog(
package/src/platform.ts CHANGED
@@ -300,12 +300,19 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
300
300
  const { body, statusCode, headers } = await request(Devices, {
301
301
  headers: this.generateHeaders(),
302
302
  });
303
- if (statusCode === 200) {
304
- const devicesAPI: any = await body.json();
305
- this.debugLog(`Devices: ${JSON.stringify(devicesAPI.body)}`);
306
- this.debugLog(`Headers: ${JSON.stringify(headers)}`);
303
+ this.debugWarnLog(`body: ${JSON.stringify(body)}`);
304
+ this.debugWarnLog(`statusCode: ${statusCode}`);
305
+ this.debugWarnLog(`headers: ${JSON.stringify(headers)}`);
306
+ const devicesAPI: any = await body.json();
307
+ this.debugWarnLog(`devicesAPI: ${JSON.stringify(devicesAPI)}`);
308
+ this.debugWarnLog(`devicesAPI Body: ${JSON.stringify(devicesAPI.body)}`);
309
+ this.debugWarnLog(`devicesAPI StatusCode: ${devicesAPI.statusCode}`);
310
+ if ((statusCode === 200 || statusCode === 100) && (devicesAPI.statusCode === 200 || devicesAPI.statusCode === 100)) {
311
+ this.debugErrorLog(`statusCode: ${statusCode} & devicesAPI StatusCode: ${devicesAPI.statusCode}`);
307
312
  // SwitchBot Devices
308
313
  const deviceLists = devicesAPI.body.deviceList;
314
+ this.debugWarnLog(`DeviceLists: ${JSON.stringify(deviceLists)}`);
315
+ this.debugWarnLog(`DeviceLists Length: ${deviceLists.length}`);
309
316
  if (!this.config.options?.devices) {
310
317
  this.debugLog(`SwitchBot Device Config Not Set: ${JSON.stringify(this.config.options?.devices)}`);
311
318
  if (deviceLists.length === 0) {
@@ -323,25 +330,29 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
323
330
  }
324
331
  } else if (this.config.credentials?.token && this.config.options.devices) {
325
332
  this.debugLog(`SwitchBot Device Config Set: ${JSON.stringify(this.config.options?.devices)}`);
326
- const deviceConfigs = this.config.options?.devices;
327
-
328
- const mergeBydeviceId = (a1: { deviceId: string }[], a2: any[]) =>
329
- a1.map((itm: { deviceId: string }) => ({
330
- ...a2.find(
331
- (item: { deviceId: string }) =>
332
- item.deviceId.toUpperCase().replace(/[^A-Z0-9]+/g, '') === itm.deviceId.toUpperCase().replace(/[^A-Z0-9]+/g, '') && item,
333
- ),
334
- ...itm,
335
- }));
336
-
337
- const devices = mergeBydeviceId(deviceLists, deviceConfigs);
338
- this.debugLog(`SwitchBot Devices: ${JSON.stringify(devices)}`);
339
- for (const device of devices) {
340
- if (device.deviceType) {
341
- if (device.configDeviceName) {
342
- device.deviceName = device.configDeviceName;
333
+ if (deviceLists.length === 0) {
334
+ this.debugLog(`SwitchBot API Currently Doesn't Have Any Devices With Cloud Services Enabled: ${JSON.stringify(devicesAPI.body)}`);
335
+ } else {
336
+ const deviceConfigs = this.config.options?.devices;
337
+
338
+ const mergeBydeviceId = (a1: { deviceId: string }[], a2: any[]) =>
339
+ a1.map((itm: { deviceId: string }) => ({
340
+ ...a2.find(
341
+ (item: { deviceId: string }) =>
342
+ item.deviceId.toUpperCase().replace(/[^A-Z0-9]+/g, '') === itm.deviceId.toUpperCase().replace(/[^A-Z0-9]+/g, '') && item,
343
+ ),
344
+ ...itm,
345
+ }));
346
+
347
+ const devices = mergeBydeviceId(deviceLists, deviceConfigs);
348
+ this.debugLog(`SwitchBot Devices: ${JSON.stringify(devices)}`);
349
+ for (const device of devices) {
350
+ if (device.deviceType) {
351
+ if (device.configDeviceName) {
352
+ device.deviceName = device.configDeviceName;
353
+ }
354
+ this.createDevice(device);
343
355
  }
344
- this.createDevice(device);
345
356
  }
346
357
  }
347
358
  } else {
@@ -389,6 +400,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
389
400
  }
390
401
  } else {
391
402
  this.statusCode(statusCode);
403
+ this.statusCode(devicesAPI.statusCode);
392
404
  }
393
405
  } catch (e: any) {
394
406
  this.debugErrorLog(
@@ -2075,7 +2087,11 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2075
2087
  registerDevice = true;
2076
2088
  this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`);
2077
2089
  }
2078
- this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will display in HomeKit`);
2090
+ if (registerDevice === true) {
2091
+ this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will display in HomeKit`);
2092
+ } else {
2093
+ this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will not display in HomeKit`);
2094
+ }
2079
2095
  } else if (!device.hide_device && device.deviceId && device.configDeviceType && device.configDeviceName && device.connectionType === 'BLE') {
2080
2096
  if (device.deviceType === 'Curtain' || device.deviceType === 'Blind Tilt') {
2081
2097
  registerDevice = await this.registerCurtains(device);
@@ -2084,7 +2100,11 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2084
2100
  registerDevice = true;
2085
2101
  this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`);
2086
2102
  }
2087
- this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will display in HomeKit`);
2103
+ if (registerDevice === true) {
2104
+ this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will display in HomeKit`);
2105
+ } else {
2106
+ this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will not display in HomeKit`);
2107
+ }
2088
2108
  } else if (!device.hide_device && device.connectionType === 'OpenAPI') {
2089
2109
  if (device.deviceType === 'Curtain' || device.deviceType === 'Blind Tilt') {
2090
2110
  registerDevice = await this.registerCurtains(device);
@@ -2093,7 +2113,11 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2093
2113
  registerDevice = true;
2094
2114
  this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`);
2095
2115
  }
2096
- this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will display in HomeKit`);
2116
+ if (registerDevice === true) {
2117
+ this.debugWarnLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will display in HomeKit`);
2118
+ } else {
2119
+ this.debugErrorLog(`Device: ${device.deviceName} connectionType: ${device.connectionType}, will not display in HomeKit`);
2120
+ }
2097
2121
  } else if (!device.hide_device && device.connectionType === 'Disabled') {
2098
2122
  if (device.deviceType === 'Curtain' || device.deviceType === 'Blind Tilt') {
2099
2123
  registerDevice = await this.registerCurtains(device);
@@ -2184,7 +2208,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2184
2208
  this.debugLog(`Request successful, statusCode: ${statusCode}`);
2185
2209
  break;
2186
2210
  default:
2187
- this.infoLog(`Unknown statusCode, statusCode: ${statusCode}, Submit Bugs Here: ' + 'https://tinyurl.com/SwitchBotBug`);
2211
+ this.errorLog(`Unknown statusCode, statusCode: ${statusCode}, Submit Bugs Here: ' + 'https://tinyurl.com/SwitchBotBug`);
2188
2212
  }
2189
2213
  }
2190
2214