@switchbot/homebridge-switchbot 2.8.1-beta.17 → 2.8.1-beta.19

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 (104) hide show
  1. package/dist/device/blindtilt.d.ts.map +1 -1
  2. package/dist/device/blindtilt.js +37 -16
  3. package/dist/device/blindtilt.js.map +1 -1
  4. package/dist/device/bot.js +10 -10
  5. package/dist/device/bot.js.map +1 -1
  6. package/dist/device/ceilinglight.d.ts.map +1 -1
  7. package/dist/device/ceilinglight.js +78 -24
  8. package/dist/device/ceilinglight.js.map +1 -1
  9. package/dist/device/colorbulb.d.ts.map +1 -1
  10. package/dist/device/colorbulb.js +36 -5
  11. package/dist/device/colorbulb.js.map +1 -1
  12. package/dist/device/contact.d.ts.map +1 -1
  13. package/dist/device/contact.js +22 -12
  14. package/dist/device/contact.js.map +1 -1
  15. package/dist/device/curtain.d.ts.map +1 -1
  16. package/dist/device/curtain.js +36 -15
  17. package/dist/device/curtain.js.map +1 -1
  18. package/dist/device/hub.d.ts.map +1 -1
  19. package/dist/device/hub.js +21 -11
  20. package/dist/device/hub.js.map +1 -1
  21. package/dist/device/humidifier.d.ts.map +1 -1
  22. package/dist/device/humidifier.js +66 -23
  23. package/dist/device/humidifier.js.map +1 -1
  24. package/dist/device/iosensor.d.ts.map +1 -1
  25. package/dist/device/iosensor.js +21 -11
  26. package/dist/device/iosensor.js.map +1 -1
  27. package/dist/device/lightstrip.d.ts.map +1 -1
  28. package/dist/device/lightstrip.js +63 -20
  29. package/dist/device/lightstrip.js.map +1 -1
  30. package/dist/device/lock.d.ts.map +1 -1
  31. package/dist/device/lock.js +35 -14
  32. package/dist/device/lock.js.map +1 -1
  33. package/dist/device/meter.d.ts.map +1 -1
  34. package/dist/device/meter.js +21 -11
  35. package/dist/device/meter.js.map +1 -1
  36. package/dist/device/meterplus.d.ts.map +1 -1
  37. package/dist/device/meterplus.js +21 -11
  38. package/dist/device/meterplus.js.map +1 -1
  39. package/dist/device/motion.d.ts.map +1 -1
  40. package/dist/device/motion.js +21 -11
  41. package/dist/device/motion.js.map +1 -1
  42. package/dist/device/plug.d.ts.map +1 -1
  43. package/dist/device/plug.js +32 -11
  44. package/dist/device/plug.js.map +1 -1
  45. package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
  46. package/dist/device/robotvacuumcleaner.js +48 -16
  47. package/dist/device/robotvacuumcleaner.js.map +1 -1
  48. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  49. package/dist/irdevice/airconditioner.js +15 -4
  50. package/dist/irdevice/airconditioner.js.map +1 -1
  51. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  52. package/dist/irdevice/airpurifier.js +15 -4
  53. package/dist/irdevice/airpurifier.js.map +1 -1
  54. package/dist/irdevice/camera.d.ts.map +1 -1
  55. package/dist/irdevice/camera.js +15 -4
  56. package/dist/irdevice/camera.js.map +1 -1
  57. package/dist/irdevice/fan.d.ts.map +1 -1
  58. package/dist/irdevice/fan.js +15 -4
  59. package/dist/irdevice/fan.js.map +1 -1
  60. package/dist/irdevice/light.d.ts.map +1 -1
  61. package/dist/irdevice/light.js +16 -5
  62. package/dist/irdevice/light.js.map +1 -1
  63. package/dist/irdevice/other.d.ts.map +1 -1
  64. package/dist/irdevice/other.js +15 -4
  65. package/dist/irdevice/other.js.map +1 -1
  66. package/dist/irdevice/tv.d.ts.map +1 -1
  67. package/dist/irdevice/tv.js +15 -4
  68. package/dist/irdevice/tv.js.map +1 -1
  69. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  70. package/dist/irdevice/vacuumcleaner.js +15 -4
  71. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  72. package/dist/irdevice/waterheater.d.ts.map +1 -1
  73. package/dist/irdevice/waterheater.js +15 -4
  74. package/dist/irdevice/waterheater.js.map +1 -1
  75. package/dist/platform.d.ts.map +1 -1
  76. package/dist/platform.js +18 -3
  77. package/dist/platform.js.map +1 -1
  78. package/package.json +1 -1
  79. package/src/device/blindtilt.ts +35 -16
  80. package/src/device/bot.ts +11 -11
  81. package/src/device/ceilinglight.ts +73 -24
  82. package/src/device/colorbulb.ts +32 -5
  83. package/src/device/contact.ts +21 -12
  84. package/src/device/curtain.ts +34 -15
  85. package/src/device/hub.ts +20 -11
  86. package/src/device/humidifier.ts +62 -23
  87. package/src/device/iosensor.ts +20 -11
  88. package/src/device/lightstrip.ts +59 -20
  89. package/src/device/lock.ts +33 -14
  90. package/src/device/meter.ts +20 -11
  91. package/src/device/meterplus.ts +20 -11
  92. package/src/device/motion.ts +20 -11
  93. package/src/device/plug.ts +30 -11
  94. package/src/device/robotvacuumcleaner.ts +45 -16
  95. package/src/irdevice/airconditioner.ts +14 -4
  96. package/src/irdevice/airpurifier.ts +14 -4
  97. package/src/irdevice/camera.ts +14 -4
  98. package/src/irdevice/fan.ts +14 -4
  99. package/src/irdevice/light.ts +15 -5
  100. package/src/irdevice/other.ts +14 -4
  101. package/src/irdevice/tv.ts +14 -4
  102. package/src/irdevice/vacuumcleaner.ts +14 -4
  103. package/src/irdevice/waterheater.ts +14 -4
  104. package/src/platform.ts +15 -3
@@ -293,16 +293,25 @@ export class RobotVacuumCleaner {
293
293
  const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/status`, {
294
294
  headers: this.platform.generateHeaders(),
295
295
  });
296
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
297
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
298
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
296
299
  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();
300
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
301
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
302
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
303
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
304
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
305
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
306
+ this.OpenAPI_On = deviceStatus.body.power;
307
+ this.OpenAPI_BatteryLevel = deviceStatus.body.battery;
308
+ this.OpenAPI_FirmwareRevision = deviceStatus.body.version;
309
+ this.openAPIparseStatus();
310
+ this.updateHomeKitCharacteristics();
311
+ } else {
312
+ this.statusCode(statusCode);
313
+ this.statusCode(deviceStatus.statusCode);
314
+ }
306
315
  } catch (e: any) {
307
316
  this.apiError(e);
308
317
  this.errorLog(
@@ -412,10 +421,20 @@ export class RobotVacuumCleaner {
412
421
  method: 'POST',
413
422
  headers: this.platform.generateHeaders(),
414
423
  });
424
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
425
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
426
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
415
427
  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)}`);
428
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
429
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
430
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
431
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
432
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
433
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
434
+ } else {
435
+ this.statusCode(statusCode);
436
+ this.statusCode(deviceStatus.statusCode);
437
+ }
419
438
  } catch (e: any) {
420
439
  this.apiError(e);
421
440
  this.errorLog(
@@ -441,10 +460,20 @@ export class RobotVacuumCleaner {
441
460
  method: 'POST',
442
461
  headers: this.platform.generateHeaders(),
443
462
  });
463
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
464
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
465
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
444
466
  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)}`);
467
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
468
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
469
+ this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
470
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
471
+ this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
472
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
473
+ } else {
474
+ this.statusCode(statusCode);
475
+ this.statusCode(deviceStatus.statusCode);
476
+ }
448
477
  } catch (e: any) {
449
478
  this.apiError(e);
450
479
  this.errorLog(
@@ -566,7 +595,7 @@ export class RobotVacuumCleaner {
566
595
  this.accessory.getService(this.platform.Service.AccessoryInformation)!
567
596
  .updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.OpenAPI_FirmwareRevision);
568
597
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
569
- + `updateCharacteristic CurrentTemperature: ${this.OpenAPI_FirmwareRevision}`);
598
+ + `updateCharacteristic FirmwareRevision: ${this.OpenAPI_FirmwareRevision}`);
570
599
  }
571
600
  }
572
601
 
@@ -262,11 +262,21 @@ export class AirConditioner {
262
262
  method: 'POST',
263
263
  headers: this.platform.generateHeaders(),
264
264
  });
265
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
266
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
267
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
265
268
  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();
269
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
270
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
271
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
272
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
273
+ this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
274
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
275
+ this.updateHomeKitCharacteristics();
276
+ } else {
277
+ this.statusCode(statusCode);
278
+ this.statusCode(deviceStatus.statusCode);
279
+ }
270
280
  } catch (e: any) {
271
281
  this.apiError(e);
272
282
  this.errorLog(
@@ -218,11 +218,21 @@ export class AirPurifier {
218
218
  method: 'POST',
219
219
  headers: this.platform.generateHeaders(),
220
220
  });
221
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
222
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
223
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
221
224
  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();
225
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
226
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
227
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
228
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
229
+ this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
230
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
231
+ this.updateHomeKitCharacteristics();
232
+ } else {
233
+ this.statusCode(statusCode);
234
+ this.statusCode(deviceStatus.statusCode);
235
+ }
226
236
  } catch (e: any) {
227
237
  this.apiError(e);
228
238
  this.errorLog(
@@ -123,11 +123,21 @@ export class Camera {
123
123
  method: 'POST',
124
124
  headers: this.platform.generateHeaders(),
125
125
  });
126
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
127
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
128
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
126
129
  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();
130
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
131
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
132
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
133
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
134
+ this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
135
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
136
+ this.updateHomeKitCharacteristics();
137
+ } else {
138
+ this.statusCode(statusCode);
139
+ this.statusCode(deviceStatus.statusCode);
140
+ }
131
141
  } catch (e: any) {
132
142
  this.apiError(e);
133
143
  this.errorLog(
@@ -240,11 +240,21 @@ export class Fan {
240
240
  method: 'POST',
241
241
  headers: this.platform.generateHeaders(),
242
242
  });
243
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
244
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
245
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
243
246
  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();
247
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
248
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
249
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
250
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
251
+ this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
252
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
253
+ this.updateHomeKitCharacteristics();
254
+ } else {
255
+ this.statusCode(statusCode);
256
+ this.statusCode(deviceStatus.statusCode);
257
+ }
248
258
  } catch (e: any) {
249
259
  this.apiError(e);
250
260
  this.errorLog(
@@ -147,12 +147,22 @@ export class Light {
147
147
  method: 'POST',
148
148
  headers: this.platform.generateHeaders(),
149
149
  });
150
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
151
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
152
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
150
153
  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();
154
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
155
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
156
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
157
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
158
+ this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
159
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
160
+ this.accessory.context.On = this.On;
161
+ this.updateHomeKitCharacteristics();
162
+ } else {
163
+ this.statusCode(statusCode);
164
+ this.statusCode(deviceStatus.statusCode);
165
+ }
156
166
  } catch (e: any) {
157
167
  this.apiError(e);
158
168
  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(
@@ -372,11 +372,21 @@ export class TV {
372
372
  method: 'POST',
373
373
  headers: this.platform.generateHeaders(),
374
374
  });
375
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
376
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
377
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
375
378
  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();
379
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
380
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
381
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
382
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
383
+ this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
384
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
385
+ this.updateHomeKitCharacteristics();
386
+ } else {
387
+ this.statusCode(statusCode);
388
+ this.statusCode(deviceStatus.statusCode);
389
+ }
380
390
  } catch (e: any) {
381
391
  this.apiError(e);
382
392
  this.errorLog(
@@ -119,11 +119,21 @@ export class VacuumCleaner {
119
119
  method: 'POST',
120
120
  headers: this.platform.generateHeaders(),
121
121
  });
122
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
123
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
124
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
122
125
  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();
126
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
127
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
128
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
129
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
130
+ this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
131
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
132
+ this.updateHomeKitCharacteristics();
133
+ } else {
134
+ this.statusCode(statusCode);
135
+ this.statusCode(deviceStatus.statusCode);
136
+ }
127
137
  } catch (e: any) {
128
138
  this.apiError(e);
129
139
  this.errorLog(
@@ -128,11 +128,21 @@ export class WaterHeater {
128
128
  method: 'POST',
129
129
  headers: this.platform.generateHeaders(),
130
130
  });
131
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} body: ${JSON.stringify(body)}`);
132
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
133
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
131
134
  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();
135
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
136
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
137
+ this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
138
+ if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
139
+ this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
140
+ + `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
141
+ this.updateHomeKitCharacteristics();
142
+ } else {
143
+ this.statusCode(statusCode);
144
+ this.statusCode(deviceStatus.statusCode);
145
+ }
136
146
  } catch (e: any) {
137
147
  this.apiError(e);
138
148
  this.errorLog(
package/src/platform.ts CHANGED
@@ -2087,7 +2087,11 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2087
2087
  registerDevice = true;
2088
2088
  this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`);
2089
2089
  }
2090
- 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
+ }
2091
2095
  } else if (!device.hide_device && device.deviceId && device.configDeviceType && device.configDeviceName && device.connectionType === 'BLE') {
2092
2096
  if (device.deviceType === 'Curtain' || device.deviceType === 'Blind Tilt') {
2093
2097
  registerDevice = await this.registerCurtains(device);
@@ -2096,7 +2100,11 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2096
2100
  registerDevice = true;
2097
2101
  this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`);
2098
2102
  }
2099
- 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
+ }
2100
2108
  } else if (!device.hide_device && device.connectionType === 'OpenAPI') {
2101
2109
  if (device.deviceType === 'Curtain' || device.deviceType === 'Blind Tilt') {
2102
2110
  registerDevice = await this.registerCurtains(device);
@@ -2105,7 +2113,11 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
2105
2113
  registerDevice = true;
2106
2114
  this.debugWarnLog(`Device: ${device.deviceName} registerDevice: ${registerDevice}`);
2107
2115
  }
2108
- 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
+ }
2109
2121
  } else if (!device.hide_device && device.connectionType === 'Disabled') {
2110
2122
  if (device.deviceType === 'Curtain' || device.deviceType === 'Blind Tilt') {
2111
2123
  registerDevice = await this.registerCurtains(device);