@switchbot/homebridge-switchbot 4.3.2-beta.8 → 4.3.2
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.
- package/.github/copilot-instructions.md +328 -0
- package/.github/scripts/npm-version-script-esm-auto.js +207 -0
- package/.github/workflows/beta-release.yml +8 -12
- package/.github/workflows/release.yml +54 -22
- package/CHANGELOG.md +1 -1
- package/README.md +13 -10
- package/config.schema.json +2 -2
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/clover.xml +15847 -0
- package/coverage/coverage-final.json +42 -0
- package/coverage/docs/assets/dmt/dmt-component-data.js.html +85 -0
- package/coverage/docs/assets/dmt/dmt-components.js.html +286 -0
- package/coverage/docs/assets/dmt/index.html +131 -0
- package/coverage/docs/assets/hierarchy.js.html +85 -0
- package/coverage/docs/assets/icons.js.html +136 -0
- package/coverage/docs/assets/index.html +146 -0
- package/coverage/docs/assets/main.js.html +265 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +191 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/coverage/src/device/blindtilt.ts.html +3238 -0
- package/coverage/src/device/bot.ts.html +2803 -0
- package/coverage/src/device/ceilinglight.ts.html +2338 -0
- package/coverage/src/device/colorbulb.ts.html +2824 -0
- package/coverage/src/device/contact.ts.html +1465 -0
- package/coverage/src/device/curtain.ts.html +2869 -0
- package/coverage/src/device/device.ts.html +2500 -0
- package/coverage/src/device/fan.ts.html +2242 -0
- package/coverage/src/device/hub.ts.html +1408 -0
- package/coverage/src/device/humidifier.ts.html +2116 -0
- package/coverage/src/device/index.html +416 -0
- package/coverage/src/device/iosensor.ts.html +1375 -0
- package/coverage/src/device/lightstrip.ts.html +2617 -0
- package/coverage/src/device/lock.ts.html +1963 -0
- package/coverage/src/device/meter.ts.html +1372 -0
- package/coverage/src/device/meterplus.ts.html +1384 -0
- package/coverage/src/device/meterpro.ts.html +1618 -0
- package/coverage/src/device/motion.ts.html +1264 -0
- package/coverage/src/device/plug.ts.html +1372 -0
- package/coverage/src/device/relayswitch.ts.html +2284 -0
- package/coverage/src/device/robotvacuumcleaner.ts.html +1810 -0
- package/coverage/src/device/waterdetector.ts.html +1294 -0
- package/coverage/src/homebridge-ui/index.html +116 -0
- package/coverage/src/homebridge-ui/server.ts.html +229 -0
- package/coverage/src/index.html +161 -0
- package/coverage/src/index.ts.html +124 -0
- package/coverage/src/irdevice/airconditioner.ts.html +1687 -0
- package/coverage/src/irdevice/airpurifier.ts.html +844 -0
- package/coverage/src/irdevice/camera.ts.html +475 -0
- package/coverage/src/irdevice/fan.ts.html +766 -0
- package/coverage/src/irdevice/index.html +251 -0
- package/coverage/src/irdevice/irdevice.ts.html +1117 -0
- package/coverage/src/irdevice/light.ts.html +826 -0
- package/coverage/src/irdevice/other.ts.html +2458 -0
- package/coverage/src/irdevice/tv.ts.html +1222 -0
- package/coverage/src/irdevice/vacuumcleaner.ts.html +466 -0
- package/coverage/src/irdevice/waterheater.ts.html +469 -0
- package/coverage/src/platform.ts.html +8776 -0
- package/coverage/src/settings.ts.html +934 -0
- package/coverage/src/utils.ts.html +2092 -0
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +12 -4
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +12 -4
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +18 -7
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +18 -7
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +6 -2
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +12 -4
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.d.ts +5 -7
- package/dist/device/device.d.ts.map +1 -1
- package/dist/device/device.js +11 -5
- package/dist/device/device.js.map +1 -1
- package/dist/device/fan.d.ts.map +1 -1
- package/dist/device/fan.js +16 -6
- package/dist/device/fan.js.map +1 -1
- package/dist/device/hub.d.ts +2 -2
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +8 -3
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +16 -6
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +6 -2
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +16 -6
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +12 -4
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +6 -2
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +6 -2
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/meterpro.d.ts.map +1 -1
- package/dist/device/meterpro.js +7 -4
- package/dist/device/meterpro.js.map +1 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +6 -2
- package/dist/device/motion.js.map +1 -1
- package/dist/device/occupancy.d.ts +42 -0
- package/dist/device/occupancy.d.ts.map +1 -0
- package/dist/device/occupancy.js +349 -0
- package/dist/device/occupancy.js.map +1 -0
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +12 -4
- package/dist/device/plug.js.map +1 -1
- package/dist/device/relayswitch.d.ts.map +1 -1
- package/dist/device/relayswitch.js +12 -4
- package/dist/device/relayswitch.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +14 -5
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.d.ts.map +1 -1
- package/dist/device/waterdetector.js +6 -2
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/homebridge-ui/public/index.html +1 -1
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +2 -1
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +1 -1
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +6 -5
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +2 -1
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +2 -1
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/irdevice.d.ts +2 -6
- package/dist/irdevice/irdevice.d.ts.map +1 -1
- package/dist/irdevice/irdevice.js.map +1 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +2 -1
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +2 -1
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +2 -1
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +2 -1
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +2 -1
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts +2 -2
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +77 -78
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +6 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +1 -0
- package/dist/settings.js.map +1 -1
- package/docs/index.html +20 -11
- package/docs/variables/default.html +1 -1
- package/eslint.config.js +0 -1
- package/package.json +7 -8
- package/src/device/blindtilt.ts +10 -4
- package/src/device/bot.ts +10 -4
- package/src/device/ceilinglight.ts +16 -7
- package/src/device/colorbulb.ts +16 -7
- package/src/device/contact.ts +5 -2
- package/src/device/curtain.ts +12 -6
- package/src/device/device.ts +14 -8
- package/src/device/fan.ts +14 -6
- package/src/device/hub.ts +10 -6
- package/src/device/humidifier.ts +14 -6
- package/src/device/iosensor.ts +5 -2
- package/src/device/lightstrip.ts +14 -6
- package/src/device/lock.ts +10 -4
- package/src/device/meter.ts +6 -3
- package/src/device/meterplus.ts +5 -2
- package/src/device/meterpro.ts +7 -5
- package/src/device/motion.ts +5 -2
- package/src/device/occupancy.ts +393 -0
- package/src/device/plug.ts +10 -4
- package/src/device/relayswitch.ts +10 -4
- package/src/device/robotvacuumcleaner.ts +12 -5
- package/src/device/waterdetector.ts +5 -2
- package/src/homebridge-ui/public/index.html +1 -1
- package/src/irdevice/airconditioner.ts +2 -1
- package/src/irdevice/airpurifier.ts +6 -5
- package/src/irdevice/camera.ts +2 -1
- package/src/irdevice/fan.ts +2 -1
- package/src/irdevice/irdevice.ts +2 -2
- package/src/irdevice/light.ts +2 -1
- package/src/irdevice/other.ts +2 -1
- package/src/irdevice/tv.ts +2 -1
- package/src/irdevice/vacuumcleaner.ts +2 -1
- package/src/irdevice/waterheater.ts +2 -1
- package/src/platform.ts +80 -88
- package/src/settings.ts +7 -0
- package/.github/npm-version-script-esm.js +0 -97
- package/.github/workflows/build.yml +0 -18
- package/.github/workflows/changerelease.yml +0 -11
- package/.github/workflows/labeler.yml +0 -16
- package/.github/workflows/release-drafter.yml +0 -14
- package/dist/device/airpurifier.d.ts +0 -54
- package/dist/device/airpurifier.d.ts.map +0 -1
- package/dist/device/airpurifier.js +0 -527
- package/dist/device/airpurifier.js.map +0 -1
- package/src/device/airpurifier.ts +0 -563
package/src/device/device.ts
CHANGED
|
@@ -318,7 +318,7 @@ export abstract class deviceBase {
|
|
|
318
318
|
try {
|
|
319
319
|
await switchbot.startScan({ model: this.device.bleModel, id: this.device.bleMac })
|
|
320
320
|
} catch (e: any) {
|
|
321
|
-
this.errorLog(`Failed to start BLE scanning. Error
|
|
321
|
+
this.errorLog(`Failed to start BLE scanning. Error: ${e.message ?? e}`)
|
|
322
322
|
}
|
|
323
323
|
// Set an event handler
|
|
324
324
|
let serviceData = { model: this.device.bleModel, modelName: this.device.bleModelName } as ad['serviceData']
|
|
@@ -337,7 +337,7 @@ export abstract class deviceBase {
|
|
|
337
337
|
try {
|
|
338
338
|
await switchbot.stopScan()
|
|
339
339
|
} catch (e: any) {
|
|
340
|
-
this.errorLog(`Failed to stop BLE scanning. Error
|
|
340
|
+
this.errorLog(`Failed to stop BLE scanning. Error: ${e.message ?? e}`)
|
|
341
341
|
}
|
|
342
342
|
return serviceData
|
|
343
343
|
}
|
|
@@ -350,7 +350,7 @@ export abstract class deviceBase {
|
|
|
350
350
|
try {
|
|
351
351
|
await switchbot.startScan({ model: this.device.bleModel })
|
|
352
352
|
} catch (e: any) {
|
|
353
|
-
this.errorLog(`Failed to start BLE scanning. Error
|
|
353
|
+
this.errorLog(`Failed to start BLE scanning. Error: ${e.message ?? e}`)
|
|
354
354
|
}
|
|
355
355
|
// Set an event handler
|
|
356
356
|
switchbot.onadvertisement = (ad: ad) => {
|
|
@@ -361,23 +361,23 @@ export abstract class deviceBase {
|
|
|
361
361
|
try {
|
|
362
362
|
switchbot.stopScan()
|
|
363
363
|
} catch (e: any) {
|
|
364
|
-
this.errorLog(`Failed to stop BLE scanning. Error
|
|
364
|
+
this.errorLog(`Failed to stop BLE scanning. Error: ${e.message ?? e}`)
|
|
365
365
|
}
|
|
366
366
|
})()
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
|
|
370
|
-
async pushChangeRequest
|
|
370
|
+
async pushChangeRequest(bodyChange: bodyChange): Promise<{ body: pushResponse['body'], statusCode: pushResponse['statusCode'] }> {
|
|
371
371
|
const { response, statusCode } = await this.platform.retryCommand(this.device, bodyChange, this.deviceMaxRetries, this.deviceDelayBetweenRetries)
|
|
372
372
|
return { body: response, statusCode }
|
|
373
373
|
}
|
|
374
374
|
|
|
375
|
-
async deviceRefreshStatus
|
|
375
|
+
async deviceRefreshStatus(): Promise<{ body: deviceStatus, statusCode: deviceStatusRequest['statusCode'] }> {
|
|
376
376
|
const { response, statusCode } = await this.platform.retryRequest(this.device, this.deviceMaxRetries, this.deviceDelayBetweenRetries)
|
|
377
377
|
return { body: response, statusCode }
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
-
async successfulStatusCodes
|
|
380
|
+
async successfulStatusCodes(deviceStatus: deviceStatusRequest) {
|
|
381
381
|
return (deviceStatus.statusCode === 200 || deviceStatus.statusCode === 100)
|
|
382
382
|
}
|
|
383
383
|
|
|
@@ -446,6 +446,12 @@ export abstract class deviceBase {
|
|
|
446
446
|
bleModelName: SwitchBotBLEModelName.Hub2,
|
|
447
447
|
bleModelFriendlyName: SwitchBotBLEModelFriendlyName.Hub2,
|
|
448
448
|
},
|
|
449
|
+
'Hub 3': {
|
|
450
|
+
model: SwitchBotModel.Hub3,
|
|
451
|
+
bleModel: SwitchBotBLEModel.Hub3,
|
|
452
|
+
bleModelName: SwitchBotBLEModelName.Hub3,
|
|
453
|
+
bleModelFriendlyName: SwitchBotBLEModelFriendlyName.Hub3,
|
|
454
|
+
},
|
|
449
455
|
'Bot': {
|
|
450
456
|
model: SwitchBotModel.Bot,
|
|
451
457
|
bleModel: SwitchBotBLEModel.Bot,
|
|
@@ -482,7 +488,7 @@ export abstract class deviceBase {
|
|
|
482
488
|
bleModelName: SwitchBotBLEModelName.MeterPlus,
|
|
483
489
|
bleModelFriendlyName: SwitchBotBLEModelFriendlyName.MeterPlus,
|
|
484
490
|
},
|
|
485
|
-
'
|
|
491
|
+
'Meter Pro': {
|
|
486
492
|
model: SwitchBotModel.MeterPro,
|
|
487
493
|
bleModel: SwitchBotBLEModel.MeterPro,
|
|
488
494
|
bleModelName: SwitchBotBLEModelName.MeterPro,
|
package/src/device/fan.ts
CHANGED
|
@@ -306,7 +306,9 @@ export class Fan extends deviceBase {
|
|
|
306
306
|
* Asks the SwitchBot API for the latest device information
|
|
307
307
|
*/
|
|
308
308
|
async refreshStatus(): Promise<void> {
|
|
309
|
-
if (this.
|
|
309
|
+
if (!this.device.enableCloudService && this.OpenAPI) {
|
|
310
|
+
this.errorLog(`refreshStatus enableCloudService: ${this.device.enableCloudService}`)
|
|
311
|
+
} else if (this.BLE) {
|
|
310
312
|
await this.BLERefreshStatus()
|
|
311
313
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
312
314
|
await this.openAPIRefreshStatus()
|
|
@@ -378,7 +380,8 @@ export class Fan extends deviceBase {
|
|
|
378
380
|
async openAPIRefreshStatus(): Promise<void> {
|
|
379
381
|
this.debugLog('openAPIRefreshStatus')
|
|
380
382
|
try {
|
|
381
|
-
const
|
|
383
|
+
const response = await this.deviceRefreshStatus()
|
|
384
|
+
const deviceStatus: any = response.body
|
|
382
385
|
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
383
386
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
384
387
|
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
@@ -427,7 +430,9 @@ export class Fan extends deviceBase {
|
|
|
427
430
|
*/
|
|
428
431
|
|
|
429
432
|
async pushChanges(): Promise<void> {
|
|
430
|
-
if (this.
|
|
433
|
+
if (!this.device.enableCloudService && this.OpenAPI) {
|
|
434
|
+
this.errorLog(`pushChanges enableCloudService: ${this.device.enableCloudService}`)
|
|
435
|
+
} else if (this.BLE) {
|
|
431
436
|
await this.BLEpushChanges()
|
|
432
437
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
433
438
|
await this.openAPIpushChanges()
|
|
@@ -511,7 +516,8 @@ export class Fan extends deviceBase {
|
|
|
511
516
|
}
|
|
512
517
|
this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`)
|
|
513
518
|
try {
|
|
514
|
-
const
|
|
519
|
+
const response = await this.pushChangeRequest(bodyChange)
|
|
520
|
+
const deviceStatus: any = response.body
|
|
515
521
|
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
516
522
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
517
523
|
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
@@ -538,7 +544,8 @@ export class Fan extends deviceBase {
|
|
|
538
544
|
}
|
|
539
545
|
this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`)
|
|
540
546
|
try {
|
|
541
|
-
const
|
|
547
|
+
const response = await this.pushChangeRequest(bodyChange)
|
|
548
|
+
const deviceStatus: any = response.body
|
|
542
549
|
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
543
550
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
544
551
|
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
@@ -566,7 +573,8 @@ export class Fan extends deviceBase {
|
|
|
566
573
|
}
|
|
567
574
|
this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`)
|
|
568
575
|
try {
|
|
569
|
-
const
|
|
576
|
+
const response = await this.pushChangeRequest(bodyChange)
|
|
577
|
+
const deviceStatus: any = response.body
|
|
570
578
|
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
571
579
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
572
580
|
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
package/src/device/hub.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* hub.ts: @switchbot/homebridge-switchbot.
|
|
4
4
|
*/
|
|
5
5
|
import type { CharacteristicValue, PlatformAccessory, Service } from 'homebridge'
|
|
6
|
-
import type { device, hub2ServiceData, hub2Status, hub2WebhookContext, SwitchBotBLE } from 'node-switchbot'
|
|
6
|
+
import type { device, hub2ServiceData, hub2Status, hub2WebhookContext, hub3ServiceData, SwitchBotBLE } from 'node-switchbot'
|
|
7
7
|
|
|
8
8
|
import type { SwitchBotPlatform } from '../platform.js'
|
|
9
9
|
import type { devicesConfig, hubConfig } from '../settings.js'
|
|
@@ -46,7 +46,7 @@ export class Hub extends deviceBase {
|
|
|
46
46
|
webhookContext!: hub2WebhookContext
|
|
47
47
|
|
|
48
48
|
// BLE
|
|
49
|
-
serviceData!: hub2ServiceData
|
|
49
|
+
serviceData!: hub2ServiceData | hub3ServiceData
|
|
50
50
|
|
|
51
51
|
// Updates
|
|
52
52
|
hubUpdateInProgress!: boolean
|
|
@@ -273,7 +273,9 @@ export class Hub extends deviceBase {
|
|
|
273
273
|
* Asks the SwitchBot API for the latest device information
|
|
274
274
|
*/
|
|
275
275
|
async refreshStatus(): Promise<void> {
|
|
276
|
-
if (this.
|
|
276
|
+
if (!this.device.enableCloudService && this.OpenAPI) {
|
|
277
|
+
this.errorLog(`refreshStatus enableCloudService: ${this.device.enableCloudService}`)
|
|
278
|
+
} else if (this.BLE) {
|
|
277
279
|
await this.BLERefreshStatus()
|
|
278
280
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
279
281
|
await this.openAPIRefreshStatus()
|
|
@@ -292,9 +294,10 @@ export class Hub extends deviceBase {
|
|
|
292
294
|
// Start to monitor advertisement packets
|
|
293
295
|
(async () => {
|
|
294
296
|
// Start to monitor advertisement packets
|
|
295
|
-
const serviceData = await this.monitorAdvertisementPackets(switchBotBLE) as hub2ServiceData
|
|
297
|
+
const serviceData = await this.monitorAdvertisementPackets(switchBotBLE) as hub2ServiceData | hub3ServiceData
|
|
296
298
|
// Update HomeKit
|
|
297
|
-
if (serviceData.model === SwitchBotBLEModel.Hub2 && serviceData.modelName === SwitchBotBLEModelName.Hub2)
|
|
299
|
+
if ((serviceData.model === SwitchBotBLEModel.Hub2 && serviceData.modelName === SwitchBotBLEModelName.Hub2)
|
|
300
|
+
|| (serviceData.model === SwitchBotBLEModel.Hub3 && serviceData.modelName === SwitchBotBLEModelName.Hub3)) {
|
|
298
301
|
this.serviceData = serviceData
|
|
299
302
|
if (serviceData !== undefined || serviceData !== null) {
|
|
300
303
|
await this.BLEparseStatus()
|
|
@@ -345,7 +348,8 @@ export class Hub extends deviceBase {
|
|
|
345
348
|
async openAPIRefreshStatus(): Promise<void> {
|
|
346
349
|
this.debugLog('openAPIRefreshStatus')
|
|
347
350
|
try {
|
|
348
|
-
const
|
|
351
|
+
const response = await this.deviceRefreshStatus()
|
|
352
|
+
const deviceStatus: any = response.body
|
|
349
353
|
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
350
354
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
351
355
|
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
package/src/device/humidifier.ts
CHANGED
|
@@ -303,7 +303,9 @@ export class Humidifier extends deviceBase {
|
|
|
303
303
|
* Asks the SwitchBot API for the latest device information
|
|
304
304
|
*/
|
|
305
305
|
async refreshStatus(): Promise<void> {
|
|
306
|
-
if (this.
|
|
306
|
+
if (!this.device.enableCloudService && this.OpenAPI) {
|
|
307
|
+
this.errorLog(`refreshStatus enableCloudService: ${this.device.enableCloudService}`)
|
|
308
|
+
} else if (this.BLE) {
|
|
307
309
|
await this.BLERefreshStatus()
|
|
308
310
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
309
311
|
await this.openAPIRefreshStatus()
|
|
@@ -375,7 +377,8 @@ export class Humidifier extends deviceBase {
|
|
|
375
377
|
async openAPIRefreshStatus(): Promise<void> {
|
|
376
378
|
this.debugLog('openAPIRefreshStatus')
|
|
377
379
|
try {
|
|
378
|
-
const
|
|
380
|
+
const response = await this.deviceRefreshStatus()
|
|
381
|
+
const deviceStatus: any = response.body
|
|
379
382
|
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
380
383
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
381
384
|
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
@@ -415,7 +418,9 @@ export class Humidifier extends deviceBase {
|
|
|
415
418
|
* Pushes the requested changes to the SwitchBot API
|
|
416
419
|
*/
|
|
417
420
|
async pushChanges(): Promise<void> {
|
|
418
|
-
if (this.
|
|
421
|
+
if (!this.device.enableCloudService && this.OpenAPI) {
|
|
422
|
+
this.errorLog(`pushChanges enableCloudService: ${this.device.enableCloudService}`)
|
|
423
|
+
} else if (this.BLE) {
|
|
419
424
|
await this.BLEpushChanges()
|
|
420
425
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
421
426
|
await this.openAPIpushChanges()
|
|
@@ -482,7 +487,8 @@ export class Humidifier extends deviceBase {
|
|
|
482
487
|
}
|
|
483
488
|
this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`)
|
|
484
489
|
try {
|
|
485
|
-
const
|
|
490
|
+
const response = await this.pushChangeRequest(bodyChange)
|
|
491
|
+
const deviceStatus: any = response.body
|
|
486
492
|
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
487
493
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
488
494
|
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
@@ -515,7 +521,8 @@ export class Humidifier extends deviceBase {
|
|
|
515
521
|
}
|
|
516
522
|
this.debugLog(`pushAutoChanges, SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`)
|
|
517
523
|
try {
|
|
518
|
-
const
|
|
524
|
+
const response = await this.pushChangeRequest(bodyChange)
|
|
525
|
+
const deviceStatus: any = response.body
|
|
519
526
|
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
520
527
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
521
528
|
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
@@ -546,7 +553,8 @@ export class Humidifier extends deviceBase {
|
|
|
546
553
|
}
|
|
547
554
|
this.debugLog(`pushActiveChanges, SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`)
|
|
548
555
|
try {
|
|
549
|
-
const
|
|
556
|
+
const response = await this.pushChangeRequest(bodyChange)
|
|
557
|
+
const deviceStatus: any = response.body
|
|
550
558
|
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
551
559
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
552
560
|
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
package/src/device/iosensor.ts
CHANGED
|
@@ -267,7 +267,9 @@ export class IOSensor extends deviceBase {
|
|
|
267
267
|
* Asks the SwitchBot API for the latest device information
|
|
268
268
|
*/
|
|
269
269
|
async refreshStatus(): Promise<void> {
|
|
270
|
-
if (this.
|
|
270
|
+
if (!this.device.enableCloudService && this.OpenAPI) {
|
|
271
|
+
this.errorLog(`refreshStatus enableCloudService: ${this.device.enableCloudService}`)
|
|
272
|
+
} else if (this.BLE) {
|
|
271
273
|
await this.BLERefreshStatus()
|
|
272
274
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
273
275
|
await this.openAPIRefreshStatus()
|
|
@@ -339,7 +341,8 @@ export class IOSensor extends deviceBase {
|
|
|
339
341
|
async openAPIRefreshStatus(): Promise<void> {
|
|
340
342
|
this.debugLog('openAPIRefreshStatus')
|
|
341
343
|
try {
|
|
342
|
-
const
|
|
344
|
+
const response = await this.deviceRefreshStatus()
|
|
345
|
+
const deviceStatus: any = response.body
|
|
343
346
|
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
344
347
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
345
348
|
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
package/src/device/lightstrip.ts
CHANGED
|
@@ -305,7 +305,9 @@ export class StripLight extends deviceBase {
|
|
|
305
305
|
* Asks the SwitchBot API for the latest device information
|
|
306
306
|
*/
|
|
307
307
|
async refreshStatus(): Promise<void> {
|
|
308
|
-
if (this.
|
|
308
|
+
if (!this.device.enableCloudService && this.OpenAPI) {
|
|
309
|
+
this.errorLog(`refreshStatus enableCloudService: ${this.device.enableCloudService}`)
|
|
310
|
+
} else if (this.BLE) {
|
|
309
311
|
await this.BLERefreshStatus()
|
|
310
312
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
311
313
|
await this.openAPIRefreshStatus()
|
|
@@ -377,7 +379,8 @@ export class StripLight extends deviceBase {
|
|
|
377
379
|
async openAPIRefreshStatus(): Promise<void> {
|
|
378
380
|
this.debugLog('openAPIRefreshStatus')
|
|
379
381
|
try {
|
|
380
|
-
const
|
|
382
|
+
const response = await this.deviceRefreshStatus()
|
|
383
|
+
const deviceStatus: any = response.body
|
|
381
384
|
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
382
385
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
383
386
|
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
@@ -426,7 +429,9 @@ export class StripLight extends deviceBase {
|
|
|
426
429
|
*
|
|
427
430
|
*/
|
|
428
431
|
async pushChanges(): Promise<void> {
|
|
429
|
-
if (this.
|
|
432
|
+
if (!this.device.enableCloudService && this.OpenAPI) {
|
|
433
|
+
this.errorLog(`pushChanges enableCloudService: ${this.device.enableCloudService}`)
|
|
434
|
+
} else if (this.BLE) {
|
|
430
435
|
await this.BLEpushChanges()
|
|
431
436
|
if (this.LightBulb.On) {
|
|
432
437
|
// Push Brightness Update
|
|
@@ -603,7 +608,8 @@ export class StripLight extends deviceBase {
|
|
|
603
608
|
}
|
|
604
609
|
this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`)
|
|
605
610
|
try {
|
|
606
|
-
const
|
|
611
|
+
const response = await this.pushChangeRequest(bodyChange)
|
|
612
|
+
const deviceStatus: any = response.body
|
|
607
613
|
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
608
614
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
609
615
|
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
@@ -633,7 +639,8 @@ export class StripLight extends deviceBase {
|
|
|
633
639
|
}
|
|
634
640
|
this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`)
|
|
635
641
|
try {
|
|
636
|
-
const
|
|
642
|
+
const response = await this.pushChangeRequest(bodyChange)
|
|
643
|
+
const deviceStatus: any = response.body
|
|
637
644
|
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
638
645
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
639
646
|
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
@@ -660,7 +667,8 @@ export class StripLight extends deviceBase {
|
|
|
660
667
|
}
|
|
661
668
|
this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`)
|
|
662
669
|
try {
|
|
663
|
-
const
|
|
670
|
+
const response = await this.pushChangeRequest(bodyChange)
|
|
671
|
+
const deviceStatus: any = response.body
|
|
664
672
|
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
665
673
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
666
674
|
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
package/src/device/lock.ts
CHANGED
|
@@ -308,7 +308,9 @@ export class Lock extends deviceBase {
|
|
|
308
308
|
* Asks the SwitchBot API for the latest device information
|
|
309
309
|
*/
|
|
310
310
|
async refreshStatus(): Promise<void> {
|
|
311
|
-
if (this.
|
|
311
|
+
if (!this.device.enableCloudService && this.OpenAPI) {
|
|
312
|
+
this.errorLog(`refreshStatus enableCloudService: ${this.device.enableCloudService}`)
|
|
313
|
+
} else if (this.BLE) {
|
|
312
314
|
await this.BLERefreshStatus()
|
|
313
315
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
314
316
|
await this.openAPIRefreshStatus()
|
|
@@ -381,7 +383,8 @@ export class Lock extends deviceBase {
|
|
|
381
383
|
async openAPIRefreshStatus(): Promise<void> {
|
|
382
384
|
this.debugLog('openAPIRefreshStatus')
|
|
383
385
|
try {
|
|
384
|
-
const
|
|
386
|
+
const response = await this.deviceRefreshStatus()
|
|
387
|
+
const deviceStatus: any = response.body
|
|
385
388
|
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
386
389
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
387
390
|
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
@@ -426,7 +429,9 @@ export class Lock extends deviceBase {
|
|
|
426
429
|
* Lock - "command" "unlock" "default" = set to ???? state - LockCurrentState
|
|
427
430
|
*/
|
|
428
431
|
async pushChanges(): Promise<void> {
|
|
429
|
-
if (this.
|
|
432
|
+
if (!this.device.enableCloudService && this.OpenAPI) {
|
|
433
|
+
this.errorLog(`pushChanges enableCloudService: ${this.device.enableCloudService}`)
|
|
434
|
+
} else if (this.BLE) {
|
|
430
435
|
await this.BLEpushChanges()
|
|
431
436
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
432
437
|
await this.openAPIpushChanges()
|
|
@@ -499,7 +504,8 @@ export class Lock extends deviceBase {
|
|
|
499
504
|
}
|
|
500
505
|
this.debugLog(`SwitchBot OpenAPI bodyChange: ${JSON.stringify(bodyChange)}`)
|
|
501
506
|
try {
|
|
502
|
-
const
|
|
507
|
+
const response = await this.pushChangeRequest(bodyChange)
|
|
508
|
+
const deviceStatus: any = response.body
|
|
503
509
|
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
504
510
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
505
511
|
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
package/src/device/meter.ts
CHANGED
|
@@ -264,7 +264,9 @@ export class Meter extends deviceBase {
|
|
|
264
264
|
* Asks the SwitchBot API for the latest device information
|
|
265
265
|
*/
|
|
266
266
|
async refreshStatus(): Promise<void> {
|
|
267
|
-
if (this.
|
|
267
|
+
if (!this.device.enableCloudService && this.OpenAPI) {
|
|
268
|
+
this.errorLog(`refreshStatus enableCloudService: ${this.device.enableCloudService}`)
|
|
269
|
+
} else if (this.BLE) {
|
|
268
270
|
await this.BLERefreshStatus()
|
|
269
271
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
270
272
|
await this.openAPIRefreshStatus()
|
|
@@ -283,7 +285,7 @@ export class Meter extends deviceBase {
|
|
|
283
285
|
// Start to monitor advertisement packets
|
|
284
286
|
(async () => {
|
|
285
287
|
// Start to monitor advertisement packets
|
|
286
|
-
const serviceData = await this.monitorAdvertisementPackets(switchBotBLE) as
|
|
288
|
+
const serviceData = await this.monitorAdvertisementPackets(switchBotBLE) as meterServiceData
|
|
287
289
|
// Update HomeKit
|
|
288
290
|
if (serviceData.model === SwitchBotBLEModel.Meter && serviceData.modelName === SwitchBotBLEModelName.Meter) {
|
|
289
291
|
this.serviceData = serviceData
|
|
@@ -336,7 +338,8 @@ export class Meter extends deviceBase {
|
|
|
336
338
|
async openAPIRefreshStatus(): Promise<void> {
|
|
337
339
|
this.debugLog('openAPIRefreshStatus')
|
|
338
340
|
try {
|
|
339
|
-
const
|
|
341
|
+
const response = await this.deviceRefreshStatus()
|
|
342
|
+
const deviceStatus: any = response.body
|
|
340
343
|
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
341
344
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
342
345
|
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
package/src/device/meterplus.ts
CHANGED
|
@@ -268,7 +268,9 @@ export class MeterPlus extends deviceBase {
|
|
|
268
268
|
* Asks the SwitchBot API for the latest device information
|
|
269
269
|
*/
|
|
270
270
|
async refreshStatus(): Promise<void> {
|
|
271
|
-
if (this.
|
|
271
|
+
if (!this.device.enableCloudService && this.OpenAPI) {
|
|
272
|
+
this.errorLog(`refreshStatus enableCloudService: ${this.device.enableCloudService}`)
|
|
273
|
+
} else if (this.BLE) {
|
|
272
274
|
await this.BLERefreshStatus()
|
|
273
275
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
274
276
|
await this.openAPIRefreshStatus()
|
|
@@ -340,7 +342,8 @@ export class MeterPlus extends deviceBase {
|
|
|
340
342
|
async openAPIRefreshStatus(): Promise<void> {
|
|
341
343
|
this.debugLog('openAPIRefreshStatus')
|
|
342
344
|
try {
|
|
343
|
-
const
|
|
345
|
+
const response = await this.deviceRefreshStatus()
|
|
346
|
+
const deviceStatus: any = response.body
|
|
344
347
|
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
345
348
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
346
349
|
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
package/src/device/meterpro.ts
CHANGED
|
@@ -282,7 +282,7 @@ export class MeterPro extends deviceBase {
|
|
|
282
282
|
|
|
283
283
|
// Battery Info
|
|
284
284
|
if ('battery' in this.deviceStatus) {
|
|
285
|
-
|
|
285
|
+
// BatteryLevel
|
|
286
286
|
this.Battery.BatteryLevel = this.deviceStatus.battery
|
|
287
287
|
this.debugLog(`BatteryLevel: ${this.Battery.BatteryLevel}`)
|
|
288
288
|
|
|
@@ -346,7 +346,9 @@ export class MeterPro extends deviceBase {
|
|
|
346
346
|
* Asks the SwitchBot API for the latest device information
|
|
347
347
|
*/
|
|
348
348
|
async refreshStatus(): Promise<void> {
|
|
349
|
-
if (this.
|
|
349
|
+
if (!this.device.enableCloudService && this.OpenAPI) {
|
|
350
|
+
this.errorLog(`refreshStatus enableCloudService: ${this.device.enableCloudService}`)
|
|
351
|
+
} else if (this.BLE) {
|
|
350
352
|
await this.BLERefreshStatus()
|
|
351
353
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
352
354
|
await this.openAPIRefreshStatus()
|
|
@@ -367,8 +369,7 @@ export class MeterPro extends deviceBase {
|
|
|
367
369
|
// Start to monitor advertisement packets
|
|
368
370
|
const serviceData = await this.monitorAdvertisementPackets(switchBotBLE) as meterProServiceData | meterProCO2ServiceData
|
|
369
371
|
// Update HomeKit
|
|
370
|
-
if (
|
|
371
|
-
|| (serviceData.model === SwitchBotBLEModel.MeterProCO2 && serviceData.modelName === SwitchBotBLEModelName.MeterProCO2)) {
|
|
372
|
+
if (serviceData.model === SwitchBotBLEModel.MeterPro && serviceData.modelName === SwitchBotBLEModelName.MeterPro) {
|
|
372
373
|
this.serviceData = serviceData
|
|
373
374
|
if (serviceData !== undefined || serviceData !== null) {
|
|
374
375
|
await this.BLEparseStatus()
|
|
@@ -419,7 +420,8 @@ export class MeterPro extends deviceBase {
|
|
|
419
420
|
async openAPIRefreshStatus(): Promise<void> {
|
|
420
421
|
this.debugLog('openAPIRefreshStatus')
|
|
421
422
|
try {
|
|
422
|
-
const
|
|
423
|
+
const response = await this.deviceRefreshStatus()
|
|
424
|
+
const deviceStatus: any = response.body
|
|
423
425
|
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
424
426
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
425
427
|
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
package/src/device/motion.ts
CHANGED
|
@@ -239,7 +239,9 @@ export class Motion extends deviceBase {
|
|
|
239
239
|
* Asks the SwitchBot API for the latest device information
|
|
240
240
|
*/
|
|
241
241
|
async refreshStatus(): Promise<void> {
|
|
242
|
-
if (this.
|
|
242
|
+
if (!this.device.enableCloudService && this.OpenAPI) {
|
|
243
|
+
this.errorLog(`refreshStatus enableCloudService: ${this.device.enableCloudService}`)
|
|
244
|
+
} else if (this.BLE) {
|
|
243
245
|
await this.BLERefreshStatus()
|
|
244
246
|
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
245
247
|
await this.openAPIRefreshStatus()
|
|
@@ -311,7 +313,8 @@ export class Motion extends deviceBase {
|
|
|
311
313
|
async openAPIRefreshStatus(): Promise<void> {
|
|
312
314
|
this.debugLog('openAPIRefreshStatus')
|
|
313
315
|
try {
|
|
314
|
-
const
|
|
316
|
+
const response = await this.deviceRefreshStatus()
|
|
317
|
+
const deviceStatus: any = response.body
|
|
315
318
|
this.debugLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|
|
316
319
|
if (await this.successfulStatusCodes(deviceStatus)) {
|
|
317
320
|
this.debugSuccessLog(`statusCode: ${deviceStatus.statusCode}, deviceStatus: ${JSON.stringify(deviceStatus)}`)
|