@switchbot/homebridge-switchbot 2.6.0 → 2.6.2-beta.0
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/npm-version-script.js +81 -0
- package/CHANGELOG.md +9 -1
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +7 -6
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +4 -3
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +13 -9
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +12 -8
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +4 -3
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +9 -6
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +9 -6
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +3 -2
- package/dist/device/lock.js.map +1 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +3 -2
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +3 -2
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +1 -1
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +9 -8
- 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 +9 -8
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +1 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +7 -6
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +1 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +13 -12
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts +1 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +11 -10
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +1 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +7 -6
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +1 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +25 -24
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +7 -6
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +1 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +7 -6
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +1 -0
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +0 -8
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +1 -9
- package/dist/settings.js.map +1 -1
- package/nodemon.json +1 -1
- package/package.json +1 -1
- package/src/device/blindtilt.ts +7 -6
- package/src/device/bot.ts +4 -3
- package/src/device/ceilinglight.ts +13 -9
- package/src/device/colorbulb.ts +12 -8
- package/src/device/curtain.ts +4 -3
- package/src/device/humidifier.ts +9 -6
- package/src/device/lightstrip.ts +9 -6
- package/src/device/lock.ts +3 -2
- package/src/device/plug.ts +3 -2
- package/src/device/robotvacuumcleaner.ts +3 -2
- package/src/irdevice/airconditioner.ts +9 -8
- package/src/irdevice/airpurifier.ts +9 -8
- package/src/irdevice/camera.ts +7 -6
- package/src/irdevice/fan.ts +13 -12
- package/src/irdevice/light.ts +11 -10
- package/src/irdevice/other.ts +7 -6
- package/src/irdevice/tv.ts +25 -24
- package/src/irdevice/vacuumcleaner.ts +7 -6
- package/src/irdevice/waterheater.ts +7 -6
- package/src/platform.ts +1 -0
- package/src/settings.ts +0 -10
package/nodemon.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "Homebridge SwitchBot",
|
|
3
3
|
"name": "@switchbot/homebridge-switchbot",
|
|
4
|
-
"version": "2.6.0",
|
|
4
|
+
"version": "2.6.2-beta.0",
|
|
5
5
|
"description": "The [Homebridge](https://homebridge.io) SwitchBot plugin allows you to access your [SwitchBot](https://www.switch-bot.com) device(s) from HomeKit.",
|
|
6
6
|
"author": "SwitchBot <support@wondertechlabs.com> (https://github.com/SwitchBot)",
|
|
7
7
|
"license": "ISC",
|
package/src/device/blindtilt.ts
CHANGED
|
@@ -629,7 +629,7 @@ export class BlindTilt {
|
|
|
629
629
|
}
|
|
630
630
|
|
|
631
631
|
async openAPIpushChanges(): Promise<void> {
|
|
632
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName}
|
|
632
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIpushChanges`);
|
|
633
633
|
const hasDifferentAndRelevantHorizontalTiltAngle = (
|
|
634
634
|
this.mappingMode === BlindTiltMappingMode.UseTiltForDirection
|
|
635
635
|
&& this.TargetHorizontalTiltAngle !== this.CurrentHorizontalTiltAngle);
|
|
@@ -637,27 +637,28 @@ export class BlindTilt {
|
|
|
637
637
|
const [direction, position] = this.mapHomekitValuesToDeviceValues(Number(this.TargetPosition), Number(this.TargetHorizontalTiltAngle));
|
|
638
638
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Pushing ${this.TargetPosition} (device = ${direction};${position})`);
|
|
639
639
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Mode: ${this.Mode}`);
|
|
640
|
-
let
|
|
640
|
+
let bodyChange = '';
|
|
641
641
|
if (position === 100) {
|
|
642
|
-
|
|
642
|
+
bodyChange = JSON.stringify({
|
|
643
643
|
'command': 'fullyOpen',
|
|
644
644
|
'commandType': 'command',
|
|
645
645
|
});
|
|
646
646
|
} else if (position === 0) {
|
|
647
|
-
|
|
647
|
+
bodyChange = JSON.stringify({
|
|
648
648
|
'command': direction === 'up' ? 'closeUp' : 'closeDown',
|
|
649
649
|
'commandType': 'command',
|
|
650
650
|
});
|
|
651
651
|
} else {
|
|
652
|
-
|
|
652
|
+
bodyChange = JSON.stringify({
|
|
653
653
|
'command': 'setPosition',
|
|
654
654
|
'parameter': `${direction};${position}`,
|
|
655
655
|
'commandType': 'command',
|
|
656
656
|
});
|
|
657
657
|
}
|
|
658
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${
|
|
658
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
659
659
|
try {
|
|
660
660
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
661
|
+
body: bodyChange,
|
|
661
662
|
method: 'POST',
|
|
662
663
|
headers: this.platform.generateHeaders(),
|
|
663
664
|
});
|
package/src/device/bot.ts
CHANGED
|
@@ -659,7 +659,7 @@ export class Bot {
|
|
|
659
659
|
}
|
|
660
660
|
|
|
661
661
|
async openAPIpushChanges(): Promise<void> {
|
|
662
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName}
|
|
662
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIpushChanges`);
|
|
663
663
|
if (this.multiPressCount > 0) {
|
|
664
664
|
this.debugLog(`${this.device.deviceType}: ${this.multiPressCount} request(s) queued.`);
|
|
665
665
|
this.On = true;
|
|
@@ -681,14 +681,15 @@ export class Bot {
|
|
|
681
681
|
} else {
|
|
682
682
|
throw new Error(`${this.device.deviceType}: ${this.accessory.displayName} Device Paramters not set for this Bot.`);
|
|
683
683
|
}
|
|
684
|
-
const
|
|
684
|
+
const bodyChange = JSON.stringify({
|
|
685
685
|
'command': `${command}`,
|
|
686
686
|
'parameter': 'default',
|
|
687
687
|
'commandType': 'command',
|
|
688
688
|
});
|
|
689
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${
|
|
689
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
690
690
|
try {
|
|
691
691
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
692
|
+
body: bodyChange,
|
|
692
693
|
method: 'POST',
|
|
693
694
|
headers: this.platform.generateHeaders(),
|
|
694
695
|
});
|
|
@@ -489,7 +489,7 @@ export class CeilingLight {
|
|
|
489
489
|
}
|
|
490
490
|
|
|
491
491
|
async openAPIpushChanges(): Promise<void> {
|
|
492
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName}
|
|
492
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIpushChanges`);
|
|
493
493
|
if (this.On !== this.accessory.context.On) {
|
|
494
494
|
let command = '';
|
|
495
495
|
if (this.On) {
|
|
@@ -497,14 +497,15 @@ export class CeilingLight {
|
|
|
497
497
|
} else {
|
|
498
498
|
command = 'turnOff';
|
|
499
499
|
}
|
|
500
|
-
const
|
|
500
|
+
const bodyChange = JSON.stringify({
|
|
501
501
|
'command': `${command}`,
|
|
502
502
|
'parameter': 'default',
|
|
503
503
|
'commandType': 'command',
|
|
504
504
|
});
|
|
505
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${
|
|
505
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
506
506
|
try {
|
|
507
507
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
508
|
+
body: bodyChange,
|
|
508
509
|
method: 'POST',
|
|
509
510
|
headers: this.platform.generateHeaders(),
|
|
510
511
|
});
|
|
@@ -543,14 +544,15 @@ export class CeilingLight {
|
|
|
543
544
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Saturation: ${JSON.stringify(this.Saturation)}`);
|
|
544
545
|
const [red, green, blue] = hs2rgb(Number(this.Hue), Number(this.Saturation));
|
|
545
546
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} rgb: ${JSON.stringify([red, green, blue])}`);
|
|
546
|
-
const
|
|
547
|
+
const bodyChange = JSON.stringify({
|
|
547
548
|
'command': 'setColor',
|
|
548
549
|
'parameter': `${red}:${green}:${blue}`,
|
|
549
550
|
'commandType': 'command',
|
|
550
551
|
});
|
|
551
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${
|
|
552
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
552
553
|
try {
|
|
553
554
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
555
|
+
body: bodyChange,
|
|
554
556
|
method: 'POST',
|
|
555
557
|
headers: this.platform.generateHeaders(),
|
|
556
558
|
});
|
|
@@ -575,14 +577,15 @@ export class CeilingLight {
|
|
|
575
577
|
if (this.ColorTemperature !== this.accessory.context.ColorTemperature) {
|
|
576
578
|
const kelvin = Math.round(1000000 / Number(this.ColorTemperature));
|
|
577
579
|
this.cacheKelvin = kelvin;
|
|
578
|
-
const
|
|
580
|
+
const bodyChange = JSON.stringify({
|
|
579
581
|
'command': 'setColorTemperature',
|
|
580
582
|
'parameter': `${kelvin}`,
|
|
581
583
|
'commandType': 'command',
|
|
582
584
|
});
|
|
583
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${
|
|
585
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
584
586
|
try {
|
|
585
587
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
588
|
+
body: bodyChange,
|
|
586
589
|
method: 'POST',
|
|
587
590
|
headers: this.platform.generateHeaders(),
|
|
588
591
|
});
|
|
@@ -605,14 +608,15 @@ export class CeilingLight {
|
|
|
605
608
|
async pushBrightnessChanges(): Promise<void> {
|
|
606
609
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} pushBrightnessChanges`);
|
|
607
610
|
if (this.Brightness !== this.accessory.context.Brightness) {
|
|
608
|
-
const
|
|
611
|
+
const bodyChange = JSON.stringify({
|
|
609
612
|
'command': 'setBrightness',
|
|
610
613
|
'parameter': `${this.Brightness}`,
|
|
611
614
|
'commandType': 'command',
|
|
612
615
|
});
|
|
613
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${
|
|
616
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
614
617
|
try {
|
|
615
618
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
619
|
+
body: bodyChange,
|
|
616
620
|
method: 'POST',
|
|
617
621
|
headers: this.platform.generateHeaders(),
|
|
618
622
|
});
|
package/src/device/colorbulb.ts
CHANGED
|
@@ -651,14 +651,15 @@ export class ColorBulb {
|
|
|
651
651
|
} else {
|
|
652
652
|
command = 'turnOff';
|
|
653
653
|
}
|
|
654
|
-
const
|
|
654
|
+
const bodyChange = JSON.stringify({
|
|
655
655
|
'command': `${command}`,
|
|
656
656
|
'parameter': 'default',
|
|
657
657
|
'commandType': 'command',
|
|
658
658
|
});
|
|
659
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${
|
|
659
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
660
660
|
try {
|
|
661
661
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
662
|
+
body: bodyChange,
|
|
662
663
|
method: 'POST',
|
|
663
664
|
headers: this.platform.generateHeaders(),
|
|
664
665
|
});
|
|
@@ -697,14 +698,15 @@ export class ColorBulb {
|
|
|
697
698
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Saturation: ${JSON.stringify(this.Saturation)}`);
|
|
698
699
|
const [red, green, blue] = hs2rgb(Number(this.Hue), Number(this.Saturation));
|
|
699
700
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} rgb: ${JSON.stringify([red, green, blue])}`);
|
|
700
|
-
const
|
|
701
|
+
const bodyChange = JSON.stringify({
|
|
701
702
|
'command': 'setColor',
|
|
702
703
|
'parameter': `${red}:${green}:${blue}`,
|
|
703
704
|
'commandType': 'command',
|
|
704
705
|
});
|
|
705
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${
|
|
706
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
706
707
|
try {
|
|
707
708
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
709
|
+
body: bodyChange,
|
|
708
710
|
method: 'POST',
|
|
709
711
|
headers: this.platform.generateHeaders(),
|
|
710
712
|
});
|
|
@@ -729,14 +731,15 @@ export class ColorBulb {
|
|
|
729
731
|
if (this.ColorTemperature !== this.accessory.context.ColorTemperature) {
|
|
730
732
|
const kelvin = Math.round(1000000 / Number(this.ColorTemperature));
|
|
731
733
|
this.cacheKelvin = kelvin;
|
|
732
|
-
const
|
|
734
|
+
const bodyChange = JSON.stringify({
|
|
733
735
|
'command': 'setColorTemperature',
|
|
734
736
|
'parameter': `${kelvin}`,
|
|
735
737
|
'commandType': 'command',
|
|
736
738
|
});
|
|
737
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${
|
|
739
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
738
740
|
try {
|
|
739
741
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
742
|
+
body: bodyChange,
|
|
740
743
|
method: 'POST',
|
|
741
744
|
headers: this.platform.generateHeaders(),
|
|
742
745
|
});
|
|
@@ -759,14 +762,15 @@ export class ColorBulb {
|
|
|
759
762
|
async pushBrightnessChanges(): Promise<void> {
|
|
760
763
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} pushBrightnessChanges`);
|
|
761
764
|
if (this.Brightness !== this.accessory.context.Brightness) {
|
|
762
|
-
const
|
|
765
|
+
const bodyChange = JSON.stringify({
|
|
763
766
|
'command': 'setBrightness',
|
|
764
767
|
'parameter': `${this.Brightness}`,
|
|
765
768
|
'commandType': 'command',
|
|
766
769
|
});
|
|
767
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${
|
|
770
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
768
771
|
try {
|
|
769
772
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
773
|
+
body: bodyChange,
|
|
770
774
|
method: 'POST',
|
|
771
775
|
headers: this.platform.generateHeaders(),
|
|
772
776
|
});
|
package/src/device/curtain.ts
CHANGED
|
@@ -588,7 +588,7 @@ export class Curtain {
|
|
|
588
588
|
}
|
|
589
589
|
|
|
590
590
|
async openAPIpushChanges(): Promise<void> {
|
|
591
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName}
|
|
591
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIpushChanges`);
|
|
592
592
|
if ((this.TargetPosition !== this.CurrentPosition) || this.device.disableCaching) {
|
|
593
593
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Pushing ${this.TargetPosition}`);
|
|
594
594
|
const adjustedTargetPosition = 100 - Number(this.TargetPosition);
|
|
@@ -606,14 +606,15 @@ export class Curtain {
|
|
|
606
606
|
}
|
|
607
607
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Mode: ${this.Mode}`);
|
|
608
608
|
const adjustedMode = this.setPositionMode || 'ff';
|
|
609
|
-
const
|
|
609
|
+
const bodyChange = JSON.stringify({
|
|
610
610
|
'command': 'setPosition',
|
|
611
611
|
'parameter': `0,${adjustedMode},${adjustedTargetPosition}`,
|
|
612
612
|
'commandType': 'command',
|
|
613
613
|
});
|
|
614
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${
|
|
614
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
615
615
|
try {
|
|
616
616
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
617
|
+
body: bodyChange,
|
|
617
618
|
method: 'POST',
|
|
618
619
|
headers: this.platform.generateHeaders(),
|
|
619
620
|
});
|
package/src/device/humidifier.ts
CHANGED
|
@@ -444,14 +444,15 @@ export class Humidifier {
|
|
|
444
444
|
if (this.TargetHumidifierDehumidifierState === this.platform.Characteristic.TargetHumidifierDehumidifierState.HUMIDIFIER &&
|
|
445
445
|
this.Active === this.platform.Characteristic.Active.ACTIVE) {
|
|
446
446
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Pushing Manual: ${this.RelativeHumidityHumidifierThreshold}!`);
|
|
447
|
-
const
|
|
447
|
+
const bodyChange = JSON.stringify({
|
|
448
448
|
'command': 'setMode',
|
|
449
449
|
'parameter': `${this.RelativeHumidityHumidifierThreshold}`,
|
|
450
450
|
'commandType': 'command',
|
|
451
451
|
});
|
|
452
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${
|
|
452
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
453
453
|
try {
|
|
454
454
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
455
|
+
body: bodyChange,
|
|
455
456
|
method: 'POST',
|
|
456
457
|
headers: this.platform.generateHeaders(),
|
|
457
458
|
});
|
|
@@ -483,14 +484,15 @@ export class Humidifier {
|
|
|
483
484
|
if (this.TargetHumidifierDehumidifierState === this.platform.Characteristic.TargetHumidifierDehumidifierState.HUMIDIFIER_OR_DEHUMIDIFIER &&
|
|
484
485
|
this.Active === this.platform.Characteristic.Active.ACTIVE) {
|
|
485
486
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Pushing Auto`);
|
|
486
|
-
const
|
|
487
|
+
const bodyChange = JSON.stringify({
|
|
487
488
|
'command': 'setMode',
|
|
488
489
|
'parameter': 'auto',
|
|
489
490
|
'commandType': 'command',
|
|
490
491
|
});
|
|
491
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${
|
|
492
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
492
493
|
try {
|
|
493
494
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
495
|
+
body: bodyChange,
|
|
494
496
|
method: 'POST',
|
|
495
497
|
headers: this.platform.generateHeaders(),
|
|
496
498
|
});
|
|
@@ -517,14 +519,15 @@ export class Humidifier {
|
|
|
517
519
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} pushActiveChanges`);
|
|
518
520
|
if (this.Active === this.platform.Characteristic.Active.INACTIVE) {
|
|
519
521
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Pushing Off`);
|
|
520
|
-
const
|
|
522
|
+
const bodyChange = JSON.stringify({
|
|
521
523
|
'command': 'turnOff',
|
|
522
524
|
'parameter': 'default',
|
|
523
525
|
'commandType': 'command',
|
|
524
526
|
});
|
|
525
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${
|
|
527
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
526
528
|
try {
|
|
527
529
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
530
|
+
body: bodyChange,
|
|
528
531
|
method: 'POST',
|
|
529
532
|
headers: this.platform.generateHeaders(),
|
|
530
533
|
});
|
package/src/device/lightstrip.ts
CHANGED
|
@@ -554,14 +554,15 @@ export class StripLight {
|
|
|
554
554
|
} else {
|
|
555
555
|
command = 'turnOff';
|
|
556
556
|
}*/
|
|
557
|
-
const
|
|
557
|
+
const bodyChange = JSON.stringify({
|
|
558
558
|
'command': `${command}`,
|
|
559
559
|
'parameter': 'default',
|
|
560
560
|
'commandType': 'command',
|
|
561
561
|
});
|
|
562
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${
|
|
562
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
563
563
|
try {
|
|
564
564
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
565
|
+
body: bodyChange,
|
|
565
566
|
method: 'POST',
|
|
566
567
|
headers: this.platform.generateHeaders(),
|
|
567
568
|
});
|
|
@@ -597,14 +598,15 @@ export class StripLight {
|
|
|
597
598
|
const [red, green, blue] = hs2rgb(Number(this.Hue), Number(this.Saturation));
|
|
598
599
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} rgb: ${JSON.stringify([red, green, blue])}`);
|
|
599
600
|
// Make Push On request to the API
|
|
600
|
-
const
|
|
601
|
+
const bodyChange = JSON.stringify({
|
|
601
602
|
'command': 'setColor',
|
|
602
603
|
'parameter': `${red}:${green}:${blue}`,
|
|
603
604
|
'commandType': 'command',
|
|
604
605
|
});
|
|
605
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${
|
|
606
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
606
607
|
try {
|
|
607
608
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
609
|
+
body: bodyChange,
|
|
608
610
|
method: 'POST',
|
|
609
611
|
headers: this.platform.generateHeaders(),
|
|
610
612
|
});
|
|
@@ -627,14 +629,15 @@ export class StripLight {
|
|
|
627
629
|
async pushBrightnessChanges(): Promise<void> {
|
|
628
630
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} pushBrightnessChanges`);
|
|
629
631
|
if (this.Brightness !== this.accessory.context.Brightness) {
|
|
630
|
-
const
|
|
632
|
+
const bodyChange = JSON.stringify({
|
|
631
633
|
'command': 'setBrightness',
|
|
632
634
|
'parameter': `${this.Brightness}`,
|
|
633
635
|
'commandType': 'command',
|
|
634
636
|
});
|
|
635
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${
|
|
637
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
636
638
|
try {
|
|
637
639
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
640
|
+
body: bodyChange,
|
|
638
641
|
method: 'POST',
|
|
639
642
|
headers: this.platform.generateHeaders(),
|
|
640
643
|
});
|
package/src/device/lock.ts
CHANGED
|
@@ -385,14 +385,15 @@ export class Lock {
|
|
|
385
385
|
} else {
|
|
386
386
|
command = 'unlock';
|
|
387
387
|
}
|
|
388
|
-
const
|
|
388
|
+
const bodyChange = JSON.stringify({
|
|
389
389
|
'command': `${command}`,
|
|
390
390
|
'parameter': 'default',
|
|
391
391
|
'commandType': 'command',
|
|
392
392
|
});
|
|
393
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${
|
|
393
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
394
394
|
try {
|
|
395
395
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
396
|
+
body: bodyChange,
|
|
396
397
|
method: 'POST',
|
|
397
398
|
headers: this.platform.generateHeaders(),
|
|
398
399
|
});
|
package/src/device/plug.ts
CHANGED
|
@@ -356,14 +356,15 @@ export class Plug {
|
|
|
356
356
|
} else {
|
|
357
357
|
command = 'turnOff';
|
|
358
358
|
}
|
|
359
|
-
const
|
|
359
|
+
const bodyChange = JSON.stringify({
|
|
360
360
|
'command': `${command}`,
|
|
361
361
|
'parameter': 'default',
|
|
362
362
|
'commandType': 'command',
|
|
363
363
|
});
|
|
364
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${
|
|
364
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
365
365
|
try {
|
|
366
366
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
367
|
+
body: bodyChange,
|
|
367
368
|
method: 'POST',
|
|
368
369
|
headers: this.platform.generateHeaders(),
|
|
369
370
|
});
|
|
@@ -367,14 +367,15 @@ export class RobotVacuumCleaner {
|
|
|
367
367
|
} else {
|
|
368
368
|
command = 'turnOff';
|
|
369
369
|
}
|
|
370
|
-
const
|
|
370
|
+
const bodyChange = JSON.stringify({
|
|
371
371
|
'command': `${command}`,
|
|
372
372
|
'parameter': 'default',
|
|
373
373
|
'commandType': 'command',
|
|
374
374
|
});
|
|
375
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${
|
|
375
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
376
376
|
try {
|
|
377
377
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
378
|
+
body: bodyChange,
|
|
378
379
|
method: 'POST',
|
|
379
380
|
headers: this.platform.generateHeaders(),
|
|
380
381
|
});
|
|
@@ -172,12 +172,12 @@ export class AirConditioner {
|
|
|
172
172
|
if (this.Active === this.platform.Characteristic.Active.ACTIVE && !this.disablePushOn) {
|
|
173
173
|
const commandType: string = await this.commandType();
|
|
174
174
|
const command: string = await this.commandOn();
|
|
175
|
-
const
|
|
175
|
+
const bodyChange = JSON.stringify({
|
|
176
176
|
'command': command,
|
|
177
177
|
'parameter': 'default',
|
|
178
178
|
'commandType': commandType,
|
|
179
179
|
});
|
|
180
|
-
await this.pushChanges(
|
|
180
|
+
await this.pushChanges(bodyChange);
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
|
|
@@ -187,12 +187,12 @@ export class AirConditioner {
|
|
|
187
187
|
if (this.Active === this.platform.Characteristic.Active.INACTIVE && !this.disablePushOff) {
|
|
188
188
|
const commandType: string = await this.commandType();
|
|
189
189
|
const command: string = await this.commandOff();
|
|
190
|
-
const
|
|
190
|
+
const bodyChange = JSON.stringify({
|
|
191
191
|
'command': command,
|
|
192
192
|
'parameter': 'default',
|
|
193
193
|
'commandType': commandType,
|
|
194
194
|
});
|
|
195
|
-
await this.pushChanges(
|
|
195
|
+
await this.pushChanges(bodyChange);
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
|
|
@@ -243,21 +243,22 @@ export class AirConditioner {
|
|
|
243
243
|
} else {
|
|
244
244
|
this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.INACTIVE;
|
|
245
245
|
}
|
|
246
|
-
const
|
|
246
|
+
const bodyChange = JSON.stringify({
|
|
247
247
|
'command': 'setAll',
|
|
248
248
|
'parameter': `${parameter}`,
|
|
249
249
|
'commandType': 'command',
|
|
250
250
|
});
|
|
251
251
|
|
|
252
|
-
await this.pushChanges(
|
|
252
|
+
await this.pushChanges(bodyChange);
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
-
async pushChanges(
|
|
255
|
+
async pushChanges(bodyChange: any): Promise<void> {
|
|
256
256
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushChanges`);
|
|
257
257
|
if (this.device.connectionType === 'OpenAPI' && !this.disablePushDetail) {
|
|
258
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${
|
|
258
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
259
259
|
try {
|
|
260
260
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
261
|
+
body: bodyChange,
|
|
261
262
|
method: 'POST',
|
|
262
263
|
headers: this.platform.generateHeaders(),
|
|
263
264
|
});
|
|
@@ -134,12 +134,12 @@ export class AirPurifier {
|
|
|
134
134
|
if (this.Active === this.platform.Characteristic.Active.ACTIVE && !this.disablePushOn) {
|
|
135
135
|
const commandType: string = await this.commandType();
|
|
136
136
|
const command: string = await this.commandOn();
|
|
137
|
-
const
|
|
137
|
+
const bodyChange = JSON.stringify({
|
|
138
138
|
'command': command,
|
|
139
139
|
'parameter': 'default',
|
|
140
140
|
'commandType': commandType,
|
|
141
141
|
});
|
|
142
|
-
await this.pushChanges(
|
|
142
|
+
await this.pushChanges(bodyChange);
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
|
|
@@ -149,12 +149,12 @@ export class AirPurifier {
|
|
|
149
149
|
if (this.Active === this.platform.Characteristic.Active.INACTIVE && !this.disablePushOn) {
|
|
150
150
|
const commandType: string = await this.commandType();
|
|
151
151
|
const command: string = await this.commandOff();
|
|
152
|
-
const
|
|
152
|
+
const bodyChange = JSON.stringify({
|
|
153
153
|
'command': command,
|
|
154
154
|
'parameter': 'default',
|
|
155
155
|
'commandType': commandType,
|
|
156
156
|
});
|
|
157
|
-
await this.pushChanges(
|
|
157
|
+
await this.pushChanges(bodyChange);
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
|
|
@@ -179,7 +179,7 @@ export class AirPurifier {
|
|
|
179
179
|
this.CurrentAPFanSpeed = this.CurrentFanSpeed || 1;
|
|
180
180
|
this.APActive = this.Active === 1 ? 'on' : 'off';
|
|
181
181
|
const parameter = `${this.CurrentAPTemp},${this.CurrentAPMode},${this.CurrentAPFanSpeed},${this.APActive}`;
|
|
182
|
-
const
|
|
182
|
+
const bodyChange = JSON.stringify({
|
|
183
183
|
'command': 'setAll',
|
|
184
184
|
'parameter': `${parameter}`,
|
|
185
185
|
'commandType': 'command',
|
|
@@ -193,15 +193,16 @@ export class AirPurifier {
|
|
|
193
193
|
} else {
|
|
194
194
|
this.CurrentHeaterCoolerState = this.platform.Characteristic.CurrentHeaterCoolerState.INACTIVE;
|
|
195
195
|
}
|
|
196
|
-
await this.pushChanges(
|
|
196
|
+
await this.pushChanges(bodyChange);
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
async pushChanges(
|
|
199
|
+
async pushChanges(bodyChange: any): Promise<void> {
|
|
200
200
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushChanges`);
|
|
201
201
|
if (this.device.connectionType === 'OpenAPI') {
|
|
202
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${
|
|
202
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
203
203
|
try {
|
|
204
204
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
205
|
+
body: bodyChange,
|
|
205
206
|
method: 'POST',
|
|
206
207
|
headers: this.platform.generateHeaders(),
|
|
207
208
|
});
|
package/src/irdevice/camera.ts
CHANGED
|
@@ -85,12 +85,12 @@ export class Camera {
|
|
|
85
85
|
if (this.On && !this.disablePushOn) {
|
|
86
86
|
const commandType: string = await this.commandType();
|
|
87
87
|
const command: string = await this.commandOn();
|
|
88
|
-
const
|
|
88
|
+
const bodyChange = JSON.stringify({
|
|
89
89
|
'command': command,
|
|
90
90
|
'parameter': 'default',
|
|
91
91
|
'commandType': commandType,
|
|
92
92
|
});
|
|
93
|
-
await this.pushChanges(
|
|
93
|
+
await this.pushChanges(bodyChange);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -100,21 +100,22 @@ export class Camera {
|
|
|
100
100
|
if (!this.On && !this.disablePushOff) {
|
|
101
101
|
const commandType: string = await this.commandType();
|
|
102
102
|
const command: string = await this.commandOff();
|
|
103
|
-
const
|
|
103
|
+
const bodyChange = JSON.stringify({
|
|
104
104
|
'command': command,
|
|
105
105
|
'parameter': 'default',
|
|
106
106
|
'commandType': commandType,
|
|
107
107
|
});
|
|
108
|
-
await this.pushChanges(
|
|
108
|
+
await this.pushChanges(bodyChange);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
async pushChanges(
|
|
112
|
+
async pushChanges(bodyChange: any): Promise<void> {
|
|
113
113
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} pushChanges`);
|
|
114
114
|
if (this.device.connectionType === 'OpenAPI') {
|
|
115
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${
|
|
115
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
116
116
|
try {
|
|
117
117
|
const { body, statusCode, headers } = await request(`${Devices}/${this.device.deviceId}/commands`, {
|
|
118
|
+
body: bodyChange,
|
|
118
119
|
method: 'POST',
|
|
119
120
|
headers: this.platform.generateHeaders(),
|
|
120
121
|
});
|