@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.
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +2 -4
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +2 -4
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +5 -10
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +5 -10
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +1 -2
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +2 -4
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +1 -2
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +4 -8
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +1 -2
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +4 -8
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +2 -4
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +1 -2
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +1 -2
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +1 -2
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +2 -4
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +3 -6
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +1 -2
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +1 -2
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +1 -2
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +1 -2
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +1 -2
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +1 -2
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +1 -2
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +1 -2
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +1 -2
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +5 -10
- package/dist/platform.js.map +1 -1
- package/package.json +1 -1
- package/src/device/blindtilt.ts +2 -4
- package/src/device/bot.ts +2 -4
- package/src/device/ceilinglight.ts +5 -10
- package/src/device/colorbulb.ts +5 -10
- package/src/device/contact.ts +1 -2
- package/src/device/curtain.ts +2 -4
- package/src/device/hub.ts +1 -2
- package/src/device/humidifier.ts +4 -8
- package/src/device/iosensor.ts +1 -2
- package/src/device/lightstrip.ts +4 -8
- package/src/device/lock.ts +2 -4
- package/src/device/meter.ts +1 -2
- package/src/device/meterplus.ts +1 -2
- package/src/device/motion.ts +1 -2
- package/src/device/plug.ts +2 -4
- package/src/device/robotvacuumcleaner.ts +3 -6
- package/src/irdevice/airconditioner.ts +1 -2
- package/src/irdevice/airpurifier.ts +1 -2
- package/src/irdevice/camera.ts +1 -2
- package/src/irdevice/fan.ts +1 -2
- package/src/irdevice/light.ts +1 -2
- package/src/irdevice/other.ts +1 -2
- package/src/irdevice/tv.ts +1 -2
- package/src/irdevice/vacuumcleaner.ts +1 -2
- package/src/irdevice/waterheater.ts +1 -2
- package/src/platform.ts +5 -10
package/src/device/bot.ts
CHANGED
|
@@ -596,11 +596,10 @@ export class Bot {
|
|
|
596
596
|
async openAPIRefreshStatus(): Promise<void> {
|
|
597
597
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIRefreshStatus`);
|
|
598
598
|
try {
|
|
599
|
-
const { body, statusCode
|
|
599
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/status`, {
|
|
600
600
|
headers: this.platform.generateHeaders(),
|
|
601
601
|
});
|
|
602
602
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
603
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
604
603
|
const deviceStatus: any = await body.json();
|
|
605
604
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
606
605
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
@@ -764,13 +763,12 @@ export class Bot {
|
|
|
764
763
|
});
|
|
765
764
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
766
765
|
try {
|
|
767
|
-
const { body, statusCode
|
|
766
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
768
767
|
body: bodyChange,
|
|
769
768
|
method: 'POST',
|
|
770
769
|
headers: this.platform.generateHeaders(),
|
|
771
770
|
});
|
|
772
771
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
773
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
774
772
|
const deviceStatus: any = await body.json();
|
|
775
773
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
776
774
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
@@ -431,11 +431,10 @@ export class CeilingLight {
|
|
|
431
431
|
async openAPIRefreshStatus() {
|
|
432
432
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIRefreshStatus`);
|
|
433
433
|
try {
|
|
434
|
-
const { body, statusCode
|
|
434
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/status`, {
|
|
435
435
|
headers: this.platform.generateHeaders(),
|
|
436
436
|
});
|
|
437
437
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
438
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
439
438
|
const deviceStatus: any = await body.json();
|
|
440
439
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
441
440
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
@@ -560,13 +559,12 @@ export class CeilingLight {
|
|
|
560
559
|
});
|
|
561
560
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
562
561
|
try {
|
|
563
|
-
const { body, statusCode
|
|
562
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
564
563
|
body: bodyChange,
|
|
565
564
|
method: 'POST',
|
|
566
565
|
headers: this.platform.generateHeaders(),
|
|
567
566
|
});
|
|
568
567
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
569
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
570
568
|
const deviceStatus: any = await body.json();
|
|
571
569
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
572
570
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
@@ -620,13 +618,12 @@ export class CeilingLight {
|
|
|
620
618
|
});
|
|
621
619
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
622
620
|
try {
|
|
623
|
-
const { body, statusCode
|
|
621
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
624
622
|
body: bodyChange,
|
|
625
623
|
method: 'POST',
|
|
626
624
|
headers: this.platform.generateHeaders(),
|
|
627
625
|
});
|
|
628
626
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
629
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
630
627
|
const deviceStatus: any = await body.json();
|
|
631
628
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
632
629
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
@@ -665,13 +662,12 @@ export class CeilingLight {
|
|
|
665
662
|
});
|
|
666
663
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
667
664
|
try {
|
|
668
|
-
const { body, statusCode
|
|
665
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
669
666
|
body: bodyChange,
|
|
670
667
|
method: 'POST',
|
|
671
668
|
headers: this.platform.generateHeaders(),
|
|
672
669
|
});
|
|
673
670
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
674
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
675
671
|
const deviceStatus: any = await body.json();
|
|
676
672
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
677
673
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
@@ -708,13 +704,12 @@ export class CeilingLight {
|
|
|
708
704
|
});
|
|
709
705
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
710
706
|
try {
|
|
711
|
-
const { body, statusCode
|
|
707
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
712
708
|
body: bodyChange,
|
|
713
709
|
method: 'POST',
|
|
714
710
|
headers: this.platform.generateHeaders(),
|
|
715
711
|
});
|
|
716
712
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
717
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
718
713
|
const deviceStatus: any = await body.json();
|
|
719
714
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
720
715
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
package/src/device/colorbulb.ts
CHANGED
|
@@ -478,11 +478,10 @@ export class ColorBulb {
|
|
|
478
478
|
async openAPIRefreshStatus() {
|
|
479
479
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIRefreshStatus`);
|
|
480
480
|
try {
|
|
481
|
-
const { body, statusCode
|
|
481
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/status`, {
|
|
482
482
|
headers: this.platform.generateHeaders(),
|
|
483
483
|
});
|
|
484
484
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
485
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
486
485
|
const deviceStatus: any = await body.json();
|
|
487
486
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
488
487
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
@@ -743,13 +742,12 @@ export class ColorBulb {
|
|
|
743
742
|
});
|
|
744
743
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
745
744
|
try {
|
|
746
|
-
const { body, statusCode
|
|
745
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
747
746
|
body: bodyChange,
|
|
748
747
|
method: 'POST',
|
|
749
748
|
headers: this.platform.generateHeaders(),
|
|
750
749
|
});
|
|
751
750
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
752
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
753
751
|
const deviceStatus: any = await body.json();
|
|
754
752
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
755
753
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
@@ -803,13 +801,12 @@ export class ColorBulb {
|
|
|
803
801
|
});
|
|
804
802
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
805
803
|
try {
|
|
806
|
-
const { body, statusCode
|
|
804
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
807
805
|
body: bodyChange,
|
|
808
806
|
method: 'POST',
|
|
809
807
|
headers: this.platform.generateHeaders(),
|
|
810
808
|
});
|
|
811
809
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
812
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
813
810
|
const deviceStatus: any = await body.json();
|
|
814
811
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
815
812
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
@@ -848,13 +845,12 @@ export class ColorBulb {
|
|
|
848
845
|
});
|
|
849
846
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
850
847
|
try {
|
|
851
|
-
const { body, statusCode
|
|
848
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
852
849
|
body: bodyChange,
|
|
853
850
|
method: 'POST',
|
|
854
851
|
headers: this.platform.generateHeaders(),
|
|
855
852
|
});
|
|
856
853
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
857
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
858
854
|
const deviceStatus: any = await body.json();
|
|
859
855
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
860
856
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
@@ -891,13 +887,12 @@ export class ColorBulb {
|
|
|
891
887
|
});
|
|
892
888
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
893
889
|
try {
|
|
894
|
-
const { body, statusCode
|
|
890
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
895
891
|
body: bodyChange,
|
|
896
892
|
method: 'POST',
|
|
897
893
|
headers: this.platform.generateHeaders(),
|
|
898
894
|
});
|
|
899
895
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
900
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
901
896
|
const deviceStatus: any = await body.json();
|
|
902
897
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
903
898
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
package/src/device/contact.ts
CHANGED
|
@@ -411,11 +411,10 @@ export class Contact {
|
|
|
411
411
|
async openAPIRefreshStatus(): Promise<void> {
|
|
412
412
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIRefreshStatus`);
|
|
413
413
|
try {
|
|
414
|
-
const { body, statusCode
|
|
414
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/status`, {
|
|
415
415
|
headers: this.platform.generateHeaders(),
|
|
416
416
|
});
|
|
417
417
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
418
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
419
418
|
const deviceStatus: any = await body.json();
|
|
420
419
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
421
420
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
package/src/device/curtain.ts
CHANGED
|
@@ -609,11 +609,10 @@ export class Curtain {
|
|
|
609
609
|
async openAPIRefreshStatus(): Promise<void> {
|
|
610
610
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIRefreshStatus`);
|
|
611
611
|
try {
|
|
612
|
-
const { body, statusCode
|
|
612
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/status`, {
|
|
613
613
|
headers: this.platform.generateHeaders(),
|
|
614
614
|
});
|
|
615
615
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
616
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
617
616
|
const deviceStatus: any = await body.json();
|
|
618
617
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
619
618
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
@@ -773,13 +772,12 @@ export class Curtain {
|
|
|
773
772
|
});
|
|
774
773
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
775
774
|
try {
|
|
776
|
-
const { body, statusCode
|
|
775
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
777
776
|
body: bodyChange,
|
|
778
777
|
method: 'POST',
|
|
779
778
|
headers: this.platform.generateHeaders(),
|
|
780
779
|
});
|
|
781
780
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
782
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
783
781
|
const deviceStatus: any = await body.json();
|
|
784
782
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
785
783
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
package/src/device/hub.ts
CHANGED
|
@@ -428,11 +428,10 @@ export class Hub {
|
|
|
428
428
|
async openAPIRefreshStatus(): Promise<void> {
|
|
429
429
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIRefreshStatus`);
|
|
430
430
|
try {
|
|
431
|
-
const { body, statusCode
|
|
431
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/status`, {
|
|
432
432
|
headers: this.platform.generateHeaders(),
|
|
433
433
|
});
|
|
434
434
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
435
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
436
435
|
const deviceStatus: any = await body.json();
|
|
437
436
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
438
437
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
package/src/device/humidifier.ts
CHANGED
|
@@ -402,11 +402,10 @@ export class Humidifier {
|
|
|
402
402
|
async openAPIRefreshStatus(): Promise<void> {
|
|
403
403
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIRefreshStatus`);
|
|
404
404
|
try {
|
|
405
|
-
const { body, statusCode
|
|
405
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/status`, {
|
|
406
406
|
headers: this.platform.generateHeaders(),
|
|
407
407
|
});
|
|
408
408
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
409
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
410
409
|
const deviceStatus: any = await body.json();
|
|
411
410
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
412
411
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
@@ -505,13 +504,12 @@ export class Humidifier {
|
|
|
505
504
|
});
|
|
506
505
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
507
506
|
try {
|
|
508
|
-
const { body, statusCode
|
|
507
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
509
508
|
body: bodyChange,
|
|
510
509
|
method: 'POST',
|
|
511
510
|
headers: this.platform.generateHeaders(),
|
|
512
511
|
});
|
|
513
512
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
514
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
515
513
|
const deviceStatus: any = await body.json();
|
|
516
514
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
517
515
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
@@ -557,13 +555,12 @@ export class Humidifier {
|
|
|
557
555
|
});
|
|
558
556
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
559
557
|
try {
|
|
560
|
-
const { body, statusCode
|
|
558
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
561
559
|
body: bodyChange,
|
|
562
560
|
method: 'POST',
|
|
563
561
|
headers: this.platform.generateHeaders(),
|
|
564
562
|
});
|
|
565
563
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
566
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
567
564
|
const deviceStatus: any = await body.json();
|
|
568
565
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
569
566
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
@@ -604,13 +601,12 @@ export class Humidifier {
|
|
|
604
601
|
});
|
|
605
602
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
606
603
|
try {
|
|
607
|
-
const { body, statusCode
|
|
604
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
608
605
|
body: bodyChange,
|
|
609
606
|
method: 'POST',
|
|
610
607
|
headers: this.platform.generateHeaders(),
|
|
611
608
|
});
|
|
612
609
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
613
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
614
610
|
const deviceStatus: any = await body.json();
|
|
615
611
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
616
612
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
package/src/device/iosensor.ts
CHANGED
|
@@ -381,11 +381,10 @@ export class IOSensor {
|
|
|
381
381
|
async openAPIRefreshStatus(): Promise<void> {
|
|
382
382
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIRefreshStatus`);
|
|
383
383
|
try {
|
|
384
|
-
const { body, statusCode
|
|
384
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/status`, {
|
|
385
385
|
headers: this.platform.generateHeaders(),
|
|
386
386
|
});
|
|
387
387
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
388
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
389
388
|
const deviceStatus: any = await body.json();
|
|
390
389
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
391
390
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
package/src/device/lightstrip.ts
CHANGED
|
@@ -417,11 +417,10 @@ export class StripLight {
|
|
|
417
417
|
async openAPIRefreshStatus(): Promise<void> {
|
|
418
418
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIRefreshStatus`);
|
|
419
419
|
try {
|
|
420
|
-
const { body, statusCode
|
|
420
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/status`, {
|
|
421
421
|
headers: this.platform.generateHeaders(),
|
|
422
422
|
});
|
|
423
423
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
424
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
425
424
|
const deviceStatus: any = await body.json();
|
|
426
425
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
427
426
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
@@ -637,13 +636,12 @@ export class StripLight {
|
|
|
637
636
|
});
|
|
638
637
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
639
638
|
try {
|
|
640
|
-
const { body, statusCode
|
|
639
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
641
640
|
body: bodyChange,
|
|
642
641
|
method: 'POST',
|
|
643
642
|
headers: this.platform.generateHeaders(),
|
|
644
643
|
});
|
|
645
644
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
646
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
647
645
|
const deviceStatus: any = await body.json();
|
|
648
646
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
649
647
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
@@ -694,13 +692,12 @@ export class StripLight {
|
|
|
694
692
|
});
|
|
695
693
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
696
694
|
try {
|
|
697
|
-
const { body, statusCode
|
|
695
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
698
696
|
body: bodyChange,
|
|
699
697
|
method: 'POST',
|
|
700
698
|
headers: this.platform.generateHeaders(),
|
|
701
699
|
});
|
|
702
700
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
703
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
704
701
|
const deviceStatus: any = await body.json();
|
|
705
702
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
706
703
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
@@ -737,13 +734,12 @@ export class StripLight {
|
|
|
737
734
|
});
|
|
738
735
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
739
736
|
try {
|
|
740
|
-
const { body, statusCode
|
|
737
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
741
738
|
body: bodyChange,
|
|
742
739
|
method: 'POST',
|
|
743
740
|
headers: this.platform.generateHeaders(),
|
|
744
741
|
});
|
|
745
742
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
746
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
747
743
|
const deviceStatus: any = await body.json();
|
|
748
744
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
749
745
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
package/src/device/lock.ts
CHANGED
|
@@ -440,11 +440,10 @@ export class Lock {
|
|
|
440
440
|
async openAPIRefreshStatus(): Promise<void> {
|
|
441
441
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIRefreshStatus`);
|
|
442
442
|
try {
|
|
443
|
-
const { body, statusCode
|
|
443
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/status`, {
|
|
444
444
|
headers: this.platform.generateHeaders(),
|
|
445
445
|
});
|
|
446
446
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
447
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
448
447
|
const deviceStatus: any = await body.json();
|
|
449
448
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
450
449
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
@@ -557,13 +556,12 @@ export class Lock {
|
|
|
557
556
|
});
|
|
558
557
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
559
558
|
try {
|
|
560
|
-
const { body, statusCode
|
|
559
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
561
560
|
body: bodyChange,
|
|
562
561
|
method: 'POST',
|
|
563
562
|
headers: this.platform.generateHeaders(),
|
|
564
563
|
});
|
|
565
564
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
566
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
567
565
|
const deviceStatus: any = await body.json();
|
|
568
566
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
569
567
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
package/src/device/meter.ts
CHANGED
|
@@ -370,11 +370,10 @@ export class Meter {
|
|
|
370
370
|
async openAPIRefreshStatus(): Promise<void> {
|
|
371
371
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIRefreshStatus`);
|
|
372
372
|
try {
|
|
373
|
-
const { body, statusCode
|
|
373
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/status`, {
|
|
374
374
|
headers: this.platform.generateHeaders(),
|
|
375
375
|
});
|
|
376
376
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
377
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
378
377
|
const deviceStatus: any = await body.json();
|
|
379
378
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
380
379
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
package/src/device/meterplus.ts
CHANGED
|
@@ -372,11 +372,10 @@ export class MeterPlus {
|
|
|
372
372
|
async openAPIRefreshStatus(): Promise<void> {
|
|
373
373
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIRefreshStatus`);
|
|
374
374
|
try {
|
|
375
|
-
const { body, statusCode
|
|
375
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/status`, {
|
|
376
376
|
headers: this.platform.generateHeaders(),
|
|
377
377
|
});
|
|
378
378
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
379
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
380
379
|
const deviceStatus: any = await body.json();
|
|
381
380
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
382
381
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
package/src/device/motion.ts
CHANGED
|
@@ -365,11 +365,10 @@ export class Motion {
|
|
|
365
365
|
async openAPIRefreshStatus(): Promise<void> {
|
|
366
366
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIRefreshStatus`);
|
|
367
367
|
try {
|
|
368
|
-
const { body, statusCode
|
|
368
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/status`, {
|
|
369
369
|
headers: this.platform.generateHeaders(),
|
|
370
370
|
});
|
|
371
371
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
372
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
373
372
|
const deviceStatus: any = await body.json();
|
|
374
373
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
375
374
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
package/src/device/plug.ts
CHANGED
|
@@ -273,11 +273,10 @@ export class Plug {
|
|
|
273
273
|
async openAPIRefreshStatus() {
|
|
274
274
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIRefreshStatus`);
|
|
275
275
|
try {
|
|
276
|
-
const { body, statusCode
|
|
276
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/status`, {
|
|
277
277
|
headers: this.platform.generateHeaders(),
|
|
278
278
|
});
|
|
279
279
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
280
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
281
280
|
const deviceStatus: any = await body.json();
|
|
282
281
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
283
282
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
@@ -397,13 +396,12 @@ export class Plug {
|
|
|
397
396
|
});
|
|
398
397
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
399
398
|
try {
|
|
400
|
-
const { body, statusCode
|
|
399
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
401
400
|
body: bodyChange,
|
|
402
401
|
method: 'POST',
|
|
403
402
|
headers: this.platform.generateHeaders(),
|
|
404
403
|
});
|
|
405
404
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
406
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
407
405
|
const deviceStatus: any = await body.json();
|
|
408
406
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
409
407
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
@@ -320,11 +320,10 @@ 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
|
|
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
329
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
@@ -445,13 +444,12 @@ export class RobotVacuumCleaner {
|
|
|
445
444
|
});
|
|
446
445
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
447
446
|
try {
|
|
448
|
-
const { body, statusCode
|
|
447
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
449
448
|
body: bodyChange,
|
|
450
449
|
method: 'POST',
|
|
451
450
|
headers: this.platform.generateHeaders(),
|
|
452
451
|
});
|
|
453
452
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
454
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
455
453
|
const deviceStatus: any = await body.json();
|
|
456
454
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
457
455
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
@@ -484,12 +482,11 @@ export class RobotVacuumCleaner {
|
|
|
484
482
|
const body = await this.brightnessCommands();
|
|
485
483
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${body},`);
|
|
486
484
|
try {
|
|
487
|
-
const { body, statusCode
|
|
485
|
+
const { body, statusCode } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
488
486
|
method: 'POST',
|
|
489
487
|
headers: this.platform.generateHeaders(),
|
|
490
488
|
});
|
|
491
489
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} statusCode: ${statusCode}`);
|
|
492
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} headers: ${JSON.stringify(headers)}`);
|
|
493
490
|
const deviceStatus: any = await body.json();
|
|
494
491
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus: ${JSON.stringify(deviceStatus)}`);
|
|
495
492
|
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
@@ -259,13 +259,12 @@ 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
|
|
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
270
|
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
|
@@ -215,13 +215,12 @@ 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
|
|
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
226
|
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
package/src/irdevice/camera.ts
CHANGED
|
@@ -120,13 +120,12 @@ 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
|
|
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
131
|
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
package/src/irdevice/fan.ts
CHANGED
|
@@ -237,13 +237,12 @@ 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
|
|
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
248
|
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
package/src/irdevice/light.ts
CHANGED
|
@@ -235,13 +235,12 @@ 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
|
|
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
246
|
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|
package/src/irdevice/other.ts
CHANGED
|
@@ -427,13 +427,12 @@ 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
|
|
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
438
|
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} deviceStatus body: ${JSON.stringify(deviceStatus.body)}`);
|