@switchbot/homebridge-switchbot 3.1.1-beta.2 → 3.1.1-beta.4

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 (106) hide show
  1. package/dist/device/blindtilt.d.ts.map +1 -1
  2. package/dist/device/blindtilt.js +5 -5
  3. package/dist/device/blindtilt.js.map +1 -1
  4. package/dist/device/bot.d.ts.map +1 -1
  5. package/dist/device/bot.js +5 -5
  6. package/dist/device/bot.js.map +1 -1
  7. package/dist/device/ceilinglight.d.ts.map +1 -1
  8. package/dist/device/ceilinglight.js +8 -11
  9. package/dist/device/ceilinglight.js.map +1 -1
  10. package/dist/device/colorbulb.d.ts.map +1 -1
  11. package/dist/device/colorbulb.js +8 -11
  12. package/dist/device/colorbulb.js.map +1 -1
  13. package/dist/device/contact.d.ts +2 -2
  14. package/dist/device/contact.d.ts.map +1 -1
  15. package/dist/device/contact.js +8 -7
  16. package/dist/device/contact.js.map +1 -1
  17. package/dist/device/curtain.d.ts.map +1 -1
  18. package/dist/device/curtain.js +5 -5
  19. package/dist/device/curtain.js.map +1 -1
  20. package/dist/device/hub.d.ts.map +1 -1
  21. package/dist/device/hub.js +4 -3
  22. package/dist/device/hub.js.map +1 -1
  23. package/dist/device/humidifier.d.ts.map +1 -1
  24. package/dist/device/humidifier.js +7 -9
  25. package/dist/device/humidifier.js.map +1 -1
  26. package/dist/device/iosensor.d.ts.map +1 -1
  27. package/dist/device/iosensor.js +4 -3
  28. package/dist/device/iosensor.js.map +1 -1
  29. package/dist/device/lightstrip.d.ts.map +1 -1
  30. package/dist/device/lightstrip.js +7 -9
  31. package/dist/device/lightstrip.js.map +1 -1
  32. package/dist/device/lock.d.ts.map +1 -1
  33. package/dist/device/lock.js +5 -5
  34. package/dist/device/lock.js.map +1 -1
  35. package/dist/device/meter.d.ts.map +1 -1
  36. package/dist/device/meter.js +4 -3
  37. package/dist/device/meter.js.map +1 -1
  38. package/dist/device/meterplus.d.ts.map +1 -1
  39. package/dist/device/meterplus.js +4 -3
  40. package/dist/device/meterplus.js.map +1 -1
  41. package/dist/device/motion.d.ts.map +1 -1
  42. package/dist/device/motion.js +4 -3
  43. package/dist/device/motion.js.map +1 -1
  44. package/dist/device/plug.d.ts.map +1 -1
  45. package/dist/device/plug.js +5 -5
  46. package/dist/device/plug.js.map +1 -1
  47. package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
  48. package/dist/device/robotvacuumcleaner.js +6 -8
  49. package/dist/device/robotvacuumcleaner.js.map +1 -1
  50. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  51. package/dist/irdevice/airconditioner.js +1 -3
  52. package/dist/irdevice/airconditioner.js.map +1 -1
  53. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  54. package/dist/irdevice/airpurifier.js +1 -3
  55. package/dist/irdevice/airpurifier.js.map +1 -1
  56. package/dist/irdevice/camera.d.ts.map +1 -1
  57. package/dist/irdevice/camera.js +1 -3
  58. package/dist/irdevice/camera.js.map +1 -1
  59. package/dist/irdevice/fan.d.ts.map +1 -1
  60. package/dist/irdevice/fan.js +1 -3
  61. package/dist/irdevice/fan.js.map +1 -1
  62. package/dist/irdevice/light.d.ts.map +1 -1
  63. package/dist/irdevice/light.js +1 -3
  64. package/dist/irdevice/light.js.map +1 -1
  65. package/dist/irdevice/other.d.ts.map +1 -1
  66. package/dist/irdevice/other.js +1 -3
  67. package/dist/irdevice/other.js.map +1 -1
  68. package/dist/irdevice/tv.d.ts.map +1 -1
  69. package/dist/irdevice/tv.js +1 -3
  70. package/dist/irdevice/tv.js.map +1 -1
  71. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  72. package/dist/irdevice/vacuumcleaner.js +1 -3
  73. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  74. package/dist/irdevice/waterheater.d.ts.map +1 -1
  75. package/dist/irdevice/waterheater.js +1 -3
  76. package/dist/irdevice/waterheater.js.map +1 -1
  77. package/dist/platform.d.ts.map +1 -1
  78. package/dist/platform.js +5 -10
  79. package/dist/platform.js.map +1 -1
  80. package/package.json +10 -3
  81. package/src/device/blindtilt.ts +5 -6
  82. package/src/device/bot.ts +5 -5
  83. package/src/device/ceilinglight.ts +8 -11
  84. package/src/device/colorbulb.ts +8 -11
  85. package/src/device/contact.ts +8 -7
  86. package/src/device/curtain.ts +5 -5
  87. package/src/device/hub.ts +4 -3
  88. package/src/device/humidifier.ts +7 -9
  89. package/src/device/iosensor.ts +4 -3
  90. package/src/device/lightstrip.ts +7 -9
  91. package/src/device/lock.ts +5 -5
  92. package/src/device/meter.ts +4 -3
  93. package/src/device/meterplus.ts +4 -3
  94. package/src/device/motion.ts +4 -3
  95. package/src/device/plug.ts +5 -5
  96. package/src/device/robotvacuumcleaner.ts +6 -8
  97. package/src/irdevice/airconditioner.ts +1 -3
  98. package/src/irdevice/airpurifier.ts +1 -3
  99. package/src/irdevice/camera.ts +1 -3
  100. package/src/irdevice/fan.ts +1 -3
  101. package/src/irdevice/light.ts +1 -3
  102. package/src/irdevice/other.ts +1 -3
  103. package/src/irdevice/tv.ts +1 -3
  104. package/src/irdevice/vacuumcleaner.ts +1 -3
  105. package/src/irdevice/waterheater.ts +1 -3
  106. package/src/platform.ts +5 -10
@@ -320,14 +320,12 @@ export class RobotVacuumCleaner {
320
320
  async openAPIRefreshStatus() {
321
321
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIRefreshStatus`);
322
322
  try {
323
- const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/status`, {
323
+ const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/status`, {
324
324
  headers: this.platform.generateHeaders(),
325
325
  });
326
326
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
327
- this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
328
327
  const deviceStatus: any = await body.json();
329
328
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
330
- this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
331
329
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
332
330
  if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
333
331
  this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
@@ -445,13 +443,12 @@ export class RobotVacuumCleaner {
445
443
  });
446
444
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
447
445
  try {
448
- const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
446
+ const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
449
447
  body: bodyChange,
450
448
  method: 'POST',
451
449
  headers: this.platform.generateHeaders(),
452
450
  });
453
451
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
454
- this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
455
452
  const deviceStatus: any = await body.json();
456
453
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
457
454
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
@@ -484,15 +481,13 @@ export class RobotVacuumCleaner {
484
481
  const body = await this.brightnessCommands();
485
482
  this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${body},`);
486
483
  try {
487
- const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
484
+ const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
488
485
  method: 'POST',
489
486
  headers: this.platform.generateHeaders(),
490
487
  });
491
488
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
492
- this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
493
489
  const deviceStatus: any = await body.json();
494
490
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
495
- this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
496
491
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
497
492
  if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
498
493
  this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
@@ -819,6 +814,9 @@ export class RobotVacuumCleaner {
819
814
  if (device.maxRetry !== undefined) {
820
815
  config['maxRetry'] = device.maxRetry;
821
816
  }
817
+ if (device.webhook !== undefined) {
818
+ config['webhook'] = device.webhook;
819
+ }
822
820
  if (Object.entries(config).length !== 0) {
823
821
  this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} Config: ${JSON.stringify(config)}`);
824
822
  }
@@ -259,16 +259,14 @@ export class AirConditioner {
259
259
  if (this.device.connectionType === 'OpenAPI' && !this.disablePushDetail) {
260
260
  this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
261
261
  try {
262
- const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
262
+ const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
263
263
  body: bodyChange,
264
264
  method: 'POST',
265
265
  headers: this.platform.generateHeaders(),
266
266
  });
267
267
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
268
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
269
268
  const deviceStatus: any = await body.json();
270
269
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
271
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
272
270
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
273
271
  if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
274
272
  this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
@@ -215,16 +215,14 @@ export class AirPurifier {
215
215
  if (this.device.connectionType === 'OpenAPI') {
216
216
  this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
217
217
  try {
218
- const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
218
+ const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
219
219
  body: bodyChange,
220
220
  method: 'POST',
221
221
  headers: this.platform.generateHeaders(),
222
222
  });
223
223
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
224
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
225
224
  const deviceStatus: any = await body.json();
226
225
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
227
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
228
226
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
229
227
  if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
230
228
  this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
@@ -120,16 +120,14 @@ export class Camera {
120
120
  if (this.device.connectionType === 'OpenAPI') {
121
121
  this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
122
122
  try {
123
- const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
123
+ const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
124
124
  body: bodyChange,
125
125
  method: 'POST',
126
126
  headers: this.platform.generateHeaders(),
127
127
  });
128
128
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
129
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
130
129
  const deviceStatus: any = await body.json();
131
130
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
132
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
133
131
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
134
132
  if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
135
133
  this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
@@ -237,16 +237,14 @@ export class Fan {
237
237
  if (this.device.connectionType === 'OpenAPI') {
238
238
  this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
239
239
  try {
240
- const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
240
+ const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
241
241
  body: bodyChange,
242
242
  method: 'POST',
243
243
  headers: this.platform.generateHeaders(),
244
244
  });
245
245
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
246
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
247
246
  const deviceStatus: any = await body.json();
248
247
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
249
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
250
248
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
251
249
  if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
252
250
  this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
@@ -235,16 +235,14 @@ export class Light {
235
235
  if (this.device.connectionType === 'OpenAPI') {
236
236
  this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
237
237
  try {
238
- const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
238
+ const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
239
239
  body: bodyChange,
240
240
  method: 'POST',
241
241
  headers: this.platform.generateHeaders(),
242
242
  });
243
243
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
244
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
245
244
  const deviceStatus: any = await body.json();
246
245
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
247
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
248
246
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
249
247
  if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
250
248
  this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
@@ -427,16 +427,14 @@ export class Others {
427
427
  if (this.device.connectionType === 'OpenAPI') {
428
428
  this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
429
429
  try {
430
- const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
430
+ const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
431
431
  body: bodyChange,
432
432
  method: 'POST',
433
433
  headers: this.platform.generateHeaders(),
434
434
  });
435
435
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
436
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
437
436
  const deviceStatus: any = await body.json();
438
437
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
439
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
440
438
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
441
439
  if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
442
440
  this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
@@ -369,16 +369,14 @@ export class TV {
369
369
  if (this.device.connectionType === 'OpenAPI') {
370
370
  this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
371
371
  try {
372
- const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
372
+ const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
373
373
  body: bodyChange,
374
374
  method: 'POST',
375
375
  headers: this.platform.generateHeaders(),
376
376
  });
377
377
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
378
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
379
378
  const deviceStatus: any = await body.json();
380
379
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
381
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
382
380
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
383
381
  if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
384
382
  this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
@@ -116,16 +116,14 @@ export class VacuumCleaner {
116
116
  if (this.device.connectionType === 'OpenAPI') {
117
117
  this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
118
118
  try {
119
- const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
119
+ const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
120
120
  body: bodyChange,
121
121
  method: 'POST',
122
122
  headers: this.platform.generateHeaders(),
123
123
  });
124
124
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
125
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
126
125
  const deviceStatus: any = await body.json();
127
126
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
128
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
129
127
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
130
128
  if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
131
129
  this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
@@ -125,16 +125,14 @@ export class WaterHeater {
125
125
  if (this.device.connectionType === 'OpenAPI') {
126
126
  this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
127
127
  try {
128
- const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
128
+ const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
129
129
  body: bodyChange,
130
130
  method: 'POST',
131
131
  headers: this.platform.generateHeaders(),
132
132
  });
133
133
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
134
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
135
134
  const deviceStatus: any = await body.json();
136
135
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
137
- this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
138
136
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus statusCode: ${deviceStatus.statusCode}`);
139
137
  if ((statusCode === 200 || statusCode === 100) && (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)) {
140
138
  this.debugErrorLog(`${this.device.remoteType}: ${this.accessory.displayName} `
package/src/platform.ts CHANGED
@@ -203,7 +203,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
203
203
  }
204
204
 
205
205
  try {
206
- const { body, statusCode, headers } = await request(
206
+ const { body, statusCode } = await request(
207
207
  'https://api.switch-bot.com/v1.1/webhook/setupWebhook', {
208
208
  method: 'POST',
209
209
  headers: this.generateHeaders(),
@@ -217,7 +217,6 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
217
217
  this.debugLog(`setupWebhook: url:${url}`);
218
218
  this.debugLog(`setupWebhook: body:${JSON.stringify(response)}`);
219
219
  this.debugLog(`setupWebhook: statusCode:${statusCode}`);
220
- this.debugLog(`setupWebhook: headers:${JSON.stringify(headers)}`);
221
220
  if (statusCode !== 200 || response?.statusCode !== 100) {
222
221
  this.errorLog(`Failed to configure webhook. Existing webhook well be overridden. HTTP:${statusCode} API:${response?.statusCode} `
223
222
  + `message:${response?.message}`);
@@ -227,7 +226,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
227
226
  }
228
227
 
229
228
  try {
230
- const { body, statusCode, headers } = await request(
229
+ const { body, statusCode } = await request(
231
230
  'https://api.switch-bot.com/v1.1/webhook/updateWebhook', {
232
231
  method: 'POST',
233
232
  headers: this.generateHeaders(),
@@ -243,7 +242,6 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
243
242
  this.debugLog(`updateWebhook: url:${url}`);
244
243
  this.debugLog(`updateWebhook: body:${JSON.stringify(response)}`);
245
244
  this.debugLog(`updateWebhook: statusCode:${statusCode}`);
246
- this.debugLog(`updateWebhook: headers:${JSON.stringify(headers)}`);
247
245
  if (statusCode !== 200 || response?.statusCode !== 100) {
248
246
  this.errorLog(`Failed to update webhook. HTTP:${statusCode} API:${response?.statusCode} message:${response?.message}`);
249
247
  }
@@ -252,7 +250,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
252
250
  }
253
251
 
254
252
  try {
255
- const { body, statusCode, headers } = await request(
253
+ const { body, statusCode } = await request(
256
254
  'https://api.switch-bot.com/v1.1/webhook/queryWebhook', {
257
255
  method: 'POST',
258
256
  headers: this.generateHeaders(),
@@ -263,7 +261,6 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
263
261
  const response: any = await body.json();
264
262
  this.debugLog(`queryWebhook: body:${JSON.stringify(response)}`);
265
263
  this.debugLog(`queryWebhook: statusCode:${statusCode}`);
266
- this.debugLog(`queryWebhook: headers:${JSON.stringify(headers)}`);
267
264
  if (statusCode !== 200 || response?.statusCode !== 100) {
268
265
  this.errorLog(`Failed to query webhook. HTTP:${statusCode} API:${response?.statusCode} message:${response?.message}`);
269
266
  } else {
@@ -275,7 +272,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
275
272
 
276
273
  this.api.on('shutdown', async () => {
277
274
  try {
278
- const { body, statusCode, headers } = await request(
275
+ const { body, statusCode } = await request(
279
276
  'https://api.switch-bot.com/v1.1/webhook/deleteWebhook', {
280
277
  method: 'POST',
281
278
  headers: this.generateHeaders(),
@@ -288,7 +285,6 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
288
285
  this.debugLog(`deleteWebhook: url:${url}`);
289
286
  this.debugLog(`deleteWebhook: body:${JSON.stringify(response)}`);
290
287
  this.debugLog(`deleteWebhook: statusCode:${statusCode}`);
291
- this.debugLog(`deleteWebhook: headers:${JSON.stringify(headers)}`);
292
288
  if (statusCode !== 200 || response?.statusCode !== 100) {
293
289
  this.errorLog(`Failed to delete webhook. HTTP:${statusCode} API:${response?.statusCode} message:${response?.message}`);
294
290
  } else {
@@ -490,11 +486,10 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
490
486
  async discoverDevices() {
491
487
  if (this.config.credentials?.token) {
492
488
  try {
493
- const { body, statusCode, headers } = await request(Devices, {
489
+ const { body, statusCode } = await request(Devices, {
494
490
  headers: this.generateHeaders(),
495
491
  });
496
492
  this.debugWarnLog(`statusCode: ${statusCode}`);
497
- this.debugWarnLog(`headers: ${JSON.stringify(headers)}`);
498
493
  const devicesAPI: any = await body.json();
499
494
  this.debugWarnLog(`devicesAPI: ${JSON.stringify(devicesAPI)}`);
500
495
  this.debugWarnLog(`devicesAPI Body: ${JSON.stringify(devicesAPI.body)}`);