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

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 (105) hide show
  1. package/dist/device/blindtilt.d.ts.map +1 -1
  2. package/dist/device/blindtilt.js +2 -4
  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 +2 -4
  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 +5 -10
  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 +5 -10
  12. package/dist/device/colorbulb.js.map +1 -1
  13. package/dist/device/contact.d.ts.map +1 -1
  14. package/dist/device/contact.js +1 -2
  15. package/dist/device/contact.js.map +1 -1
  16. package/dist/device/curtain.d.ts.map +1 -1
  17. package/dist/device/curtain.js +2 -4
  18. package/dist/device/curtain.js.map +1 -1
  19. package/dist/device/hub.d.ts.map +1 -1
  20. package/dist/device/hub.js +1 -2
  21. package/dist/device/hub.js.map +1 -1
  22. package/dist/device/humidifier.d.ts.map +1 -1
  23. package/dist/device/humidifier.js +4 -8
  24. package/dist/device/humidifier.js.map +1 -1
  25. package/dist/device/iosensor.d.ts.map +1 -1
  26. package/dist/device/iosensor.js +1 -2
  27. package/dist/device/iosensor.js.map +1 -1
  28. package/dist/device/lightstrip.d.ts.map +1 -1
  29. package/dist/device/lightstrip.js +4 -8
  30. package/dist/device/lightstrip.js.map +1 -1
  31. package/dist/device/lock.d.ts.map +1 -1
  32. package/dist/device/lock.js +2 -4
  33. package/dist/device/lock.js.map +1 -1
  34. package/dist/device/meter.d.ts.map +1 -1
  35. package/dist/device/meter.js +1 -2
  36. package/dist/device/meter.js.map +1 -1
  37. package/dist/device/meterplus.d.ts.map +1 -1
  38. package/dist/device/meterplus.js +1 -2
  39. package/dist/device/meterplus.js.map +1 -1
  40. package/dist/device/motion.d.ts.map +1 -1
  41. package/dist/device/motion.js +1 -2
  42. package/dist/device/motion.js.map +1 -1
  43. package/dist/device/plug.d.ts.map +1 -1
  44. package/dist/device/plug.js +2 -4
  45. package/dist/device/plug.js.map +1 -1
  46. package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
  47. package/dist/device/robotvacuumcleaner.js +3 -6
  48. package/dist/device/robotvacuumcleaner.js.map +1 -1
  49. package/dist/irdevice/airconditioner.d.ts.map +1 -1
  50. package/dist/irdevice/airconditioner.js +1 -2
  51. package/dist/irdevice/airconditioner.js.map +1 -1
  52. package/dist/irdevice/airpurifier.d.ts.map +1 -1
  53. package/dist/irdevice/airpurifier.js +1 -2
  54. package/dist/irdevice/airpurifier.js.map +1 -1
  55. package/dist/irdevice/camera.d.ts.map +1 -1
  56. package/dist/irdevice/camera.js +1 -2
  57. package/dist/irdevice/camera.js.map +1 -1
  58. package/dist/irdevice/fan.d.ts.map +1 -1
  59. package/dist/irdevice/fan.js +1 -2
  60. package/dist/irdevice/fan.js.map +1 -1
  61. package/dist/irdevice/light.d.ts.map +1 -1
  62. package/dist/irdevice/light.js +1 -2
  63. package/dist/irdevice/light.js.map +1 -1
  64. package/dist/irdevice/other.d.ts.map +1 -1
  65. package/dist/irdevice/other.js +1 -2
  66. package/dist/irdevice/other.js.map +1 -1
  67. package/dist/irdevice/tv.d.ts.map +1 -1
  68. package/dist/irdevice/tv.js +1 -2
  69. package/dist/irdevice/tv.js.map +1 -1
  70. package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
  71. package/dist/irdevice/vacuumcleaner.js +1 -2
  72. package/dist/irdevice/vacuumcleaner.js.map +1 -1
  73. package/dist/irdevice/waterheater.d.ts.map +1 -1
  74. package/dist/irdevice/waterheater.js +1 -2
  75. package/dist/irdevice/waterheater.js.map +1 -1
  76. package/dist/platform.d.ts.map +1 -1
  77. package/dist/platform.js +5 -10
  78. package/dist/platform.js.map +1 -1
  79. package/package.json +1 -1
  80. package/src/device/blindtilt.ts +2 -4
  81. package/src/device/bot.ts +2 -4
  82. package/src/device/ceilinglight.ts +5 -10
  83. package/src/device/colorbulb.ts +5 -10
  84. package/src/device/contact.ts +1 -2
  85. package/src/device/curtain.ts +2 -4
  86. package/src/device/hub.ts +1 -2
  87. package/src/device/humidifier.ts +4 -8
  88. package/src/device/iosensor.ts +1 -2
  89. package/src/device/lightstrip.ts +4 -8
  90. package/src/device/lock.ts +2 -4
  91. package/src/device/meter.ts +1 -2
  92. package/src/device/meterplus.ts +1 -2
  93. package/src/device/motion.ts +1 -2
  94. package/src/device/plug.ts +2 -4
  95. package/src/device/robotvacuumcleaner.ts +3 -6
  96. package/src/irdevice/airconditioner.ts +1 -2
  97. package/src/irdevice/airpurifier.ts +1 -2
  98. package/src/irdevice/camera.ts +1 -2
  99. package/src/irdevice/fan.ts +1 -2
  100. package/src/irdevice/light.ts +1 -2
  101. package/src/irdevice/other.ts +1 -2
  102. package/src/irdevice/tv.ts +1 -2
  103. package/src/irdevice/vacuumcleaner.ts +1 -2
  104. package/src/irdevice/waterheater.ts +1 -2
  105. package/src/platform.ts +5 -10
@@ -369,13 +369,12 @@ 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
380
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
@@ -116,13 +116,12 @@ 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
127
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
@@ -125,13 +125,12 @@ 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
136
  this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
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)}`);