@switchbot/homebridge-switchbot 3.5.0-beta.44 → 3.5.0-beta.46
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/colorbulb.js +3 -3
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/curtain.js +1 -1
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.d.ts.map +1 -1
- package/dist/device/device.js +8 -4
- package/dist/device/device.js.map +1 -1
- package/dist/device/fan.js +1 -1
- package/dist/device/fan.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +15 -16
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/lightstrip.js +3 -3
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.js +1 -1
- package/dist/device/lock.js.map +1 -1
- package/dist/device/plug.js +1 -1
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.js +1 -1
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/package.json +1 -1
- package/src/device/colorbulb.ts +3 -3
- package/src/device/curtain.ts +1 -1
- package/src/device/device.ts +8 -4
- package/src/device/fan.ts +1 -1
- package/src/device/humidifier.ts +13 -14
- package/src/device/lightstrip.ts +3 -3
- package/src/device/lock.ts +1 -1
- package/src/device/plug.ts +1 -1
- package/src/device/robotvacuumcleaner.ts +1 -1
package/src/device/colorbulb.ts
CHANGED
|
@@ -755,7 +755,7 @@ export class ColorBulb extends deviceBase {
|
|
|
755
755
|
this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
756
756
|
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
757
757
|
this.successLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
758
|
-
+ `request to SwitchBot API, body: ${deviceStatus} sent successfully`);
|
|
758
|
+
+ `request to SwitchBot API, body: ${JSON.stringify(deviceStatus)} sent successfully`);
|
|
759
759
|
} else {
|
|
760
760
|
this.statusCode(statusCode);
|
|
761
761
|
this.statusCode(deviceStatus.statusCode);
|
|
@@ -801,7 +801,7 @@ export class ColorBulb extends deviceBase {
|
|
|
801
801
|
this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
802
802
|
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
803
803
|
this.successLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
804
|
-
+ `request to SwitchBot API, body: ${deviceStatus} sent successfully`);
|
|
804
|
+
+ `request to SwitchBot API, body: ${JSON.stringify(deviceStatus)} sent successfully`);
|
|
805
805
|
} else {
|
|
806
806
|
this.statusCode(statusCode);
|
|
807
807
|
this.statusCode(deviceStatus.statusCode);
|
|
@@ -841,7 +841,7 @@ export class ColorBulb extends deviceBase {
|
|
|
841
841
|
this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
842
842
|
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
843
843
|
this.successLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
844
|
-
+ `request to SwitchBot API, body: ${deviceStatus} sent successfully`);
|
|
844
|
+
+ `request to SwitchBot API, body: ${JSON.stringify(deviceStatus)} sent successfully`);
|
|
845
845
|
} else {
|
|
846
846
|
this.statusCode(statusCode);
|
|
847
847
|
this.statusCode(deviceStatus.statusCode);
|
package/src/device/curtain.ts
CHANGED
|
@@ -667,7 +667,7 @@ export class Curtain extends deviceBase {
|
|
|
667
667
|
this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
668
668
|
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
669
669
|
this.successLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
670
|
-
+ `request to SwitchBot API, body: ${deviceStatus} sent successfully`);
|
|
670
|
+
+ `request to SwitchBot API, body: ${JSON.stringify(deviceStatus)} sent successfully`);
|
|
671
671
|
} else {
|
|
672
672
|
this.statusCode(statusCode);
|
|
673
673
|
this.statusCode(deviceStatus.statusCode);
|
package/src/device/device.ts
CHANGED
|
@@ -559,10 +559,14 @@ export abstract class deviceBase {
|
|
|
559
559
|
}
|
|
560
560
|
|
|
561
561
|
async statusCode(statusCode: number): Promise<void> {
|
|
562
|
-
switch (
|
|
563
|
-
case
|
|
564
|
-
|
|
565
|
-
|
|
562
|
+
switch (statusCode) {
|
|
563
|
+
case 171:
|
|
564
|
+
switch (this.device.deviceId) {
|
|
565
|
+
case this.device.hubDeviceId:
|
|
566
|
+
case '000000000000':
|
|
567
|
+
statusCode = 161;
|
|
568
|
+
break;
|
|
569
|
+
}
|
|
566
570
|
break;
|
|
567
571
|
}
|
|
568
572
|
switch (statusCode) {
|
package/src/device/fan.ts
CHANGED
|
@@ -412,7 +412,7 @@ export class Fan extends deviceBase {
|
|
|
412
412
|
this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
413
413
|
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
414
414
|
this.successLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
415
|
-
+ `request to SwitchBot API, body: ${deviceStatus} sent successfully`);
|
|
415
|
+
+ `request to SwitchBot API, body: ${JSON.stringify(deviceStatus)} sent successfully`);
|
|
416
416
|
} else {
|
|
417
417
|
this.statusCode(statusCode);
|
|
418
418
|
this.statusCode(deviceStatus.statusCode);
|
package/src/device/humidifier.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { SwitchBotPlatform } from '../platform.js';
|
|
|
5
5
|
import { debounceTime, skipWhile, take, tap } from 'rxjs/operators';
|
|
6
6
|
import { Service, PlatformAccessory, CharacteristicValue } from 'homebridge';
|
|
7
7
|
import { device, devicesConfig, serviceData, deviceStatus, Devices } from '../settings.js';
|
|
8
|
+
import { convertUnits } from '../utils.js';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Platform Accessory
|
|
@@ -148,20 +149,18 @@ export class Humidifier extends deviceBase {
|
|
|
148
149
|
this.platform.webhookEventHandler[this.device.deviceId] = async (context) => {
|
|
149
150
|
try {
|
|
150
151
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} received Webhook: ${JSON.stringify(context)}`);
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} ` +
|
|
152
|
+
const { temperature, humidity } = context;
|
|
153
|
+
const { CurrentRelativeHumidity } = this.HumidifierDehumidifier;
|
|
154
|
+
const { CurrentTemperature } = this.TemperatureSensor || { CurrentTemperature: undefined };
|
|
155
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} ` +
|
|
156
156
|
'(temperature, humidity) = ' +
|
|
157
|
-
`Webhook:(${temperature}, ${humidity}), ` +
|
|
157
|
+
`Webhook:(${convertUnits(temperature, context.scale, device.iosensor?.convertUnitTo)}, ${humidity}), ` +
|
|
158
158
|
`current:(${CurrentTemperature}, ${CurrentRelativeHumidity})`);
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
this.TemperatureSensor!.CurrentTemperature = temperature;
|
|
162
|
-
}
|
|
163
|
-
this.updateHomeKitCharacteristics();
|
|
159
|
+
this.HumidifierDehumidifier.CurrentRelativeHumidity = humidity;
|
|
160
|
+
if (!this.device.humidifier?.hide_temperature) {
|
|
161
|
+
this.TemperatureSensor!.CurrentTemperature = convertUnits(temperature, context.scale, device.iosensor?.convertUnitTo);
|
|
164
162
|
}
|
|
163
|
+
this.updateHomeKitCharacteristics();
|
|
165
164
|
} catch (e: any) {
|
|
166
165
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
167
166
|
+ `failed to handle webhook. Received: ${JSON.stringify(context)} Error: ${e}`);
|
|
@@ -446,7 +445,7 @@ export class Humidifier extends deviceBase {
|
|
|
446
445
|
this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
447
446
|
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
448
447
|
this.successLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
449
|
-
+ `request to SwitchBot API, body: ${deviceStatus} sent successfully`);
|
|
448
|
+
+ `request to SwitchBot API, body: ${JSON.stringify(deviceStatus)} sent successfully`);
|
|
450
449
|
} else {
|
|
451
450
|
this.statusCode(statusCode);
|
|
452
451
|
this.statusCode(deviceStatus.statusCode);
|
|
@@ -501,7 +500,7 @@ export class Humidifier extends deviceBase {
|
|
|
501
500
|
this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
502
501
|
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
503
502
|
this.successLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
504
|
-
+ `request to SwitchBot API, body: ${deviceStatus} sent successfully`);
|
|
503
|
+
+ `request to SwitchBot API, body: ${JSON.stringify(deviceStatus)} sent successfully`);
|
|
505
504
|
} else {
|
|
506
505
|
this.statusCode(statusCode);
|
|
507
506
|
this.statusCode(deviceStatus.statusCode);
|
|
@@ -547,7 +546,7 @@ export class Humidifier extends deviceBase {
|
|
|
547
546
|
this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
548
547
|
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
549
548
|
this.successLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
550
|
-
+ `request to SwitchBot API, body: ${deviceStatus} sent successfully`);
|
|
549
|
+
+ `request to SwitchBot API, body: ${JSON.stringify(deviceStatus)} sent successfully`);
|
|
551
550
|
} else {
|
|
552
551
|
this.statusCode(statusCode);
|
|
553
552
|
this.statusCode(deviceStatus.statusCode);
|
package/src/device/lightstrip.ts
CHANGED
|
@@ -630,7 +630,7 @@ export class StripLight extends deviceBase {
|
|
|
630
630
|
this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
631
631
|
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
632
632
|
this.successLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
633
|
-
+ `request to SwitchBot API, body: ${deviceStatus} sent successfully`);
|
|
633
|
+
+ `request to SwitchBot API, body: ${JSON.stringify(deviceStatus)} sent successfully`);
|
|
634
634
|
} else {
|
|
635
635
|
this.statusCode(statusCode);
|
|
636
636
|
this.statusCode(deviceStatus.statusCode);
|
|
@@ -688,7 +688,7 @@ export class StripLight extends deviceBase {
|
|
|
688
688
|
this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
689
689
|
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
690
690
|
this.successLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
691
|
-
+ `request to SwitchBot API, body: ${deviceStatus} sent successfully`);
|
|
691
|
+
+ `request to SwitchBot API, body: ${JSON.stringify(deviceStatus)} sent successfully`);
|
|
692
692
|
} else {
|
|
693
693
|
this.statusCode(statusCode);
|
|
694
694
|
this.statusCode(deviceStatus.statusCode);
|
|
@@ -732,7 +732,7 @@ export class StripLight extends deviceBase {
|
|
|
732
732
|
this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
733
733
|
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
734
734
|
this.successLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
735
|
-
+ `request to SwitchBot API, body: ${deviceStatus} sent successfully`);
|
|
735
|
+
+ `request to SwitchBot API, body: ${JSON.stringify(deviceStatus)} sent successfully`);
|
|
736
736
|
} else {
|
|
737
737
|
this.statusCode(statusCode);
|
|
738
738
|
this.statusCode(deviceStatus.statusCode);
|
package/src/device/lock.ts
CHANGED
|
@@ -452,7 +452,7 @@ export class Lock extends deviceBase {
|
|
|
452
452
|
this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
453
453
|
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
454
454
|
this.successLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
455
|
-
+ `request to SwitchBot API, body: ${deviceStatus} sent successfully`);
|
|
455
|
+
+ `request to SwitchBot API, body: ${JSON.stringify(deviceStatus)} sent successfully`);
|
|
456
456
|
} else {
|
|
457
457
|
this.statusCode(statusCode);
|
|
458
458
|
this.statusCode(deviceStatus.statusCode);
|
package/src/device/plug.ts
CHANGED
|
@@ -336,7 +336,7 @@ export class Plug extends deviceBase {
|
|
|
336
336
|
this.debugErrorLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
337
337
|
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
338
338
|
this.successLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
339
|
-
+ `request to SwitchBot API, body: ${deviceStatus} sent successfully`);
|
|
339
|
+
+ `request to SwitchBot API, body: ${JSON.stringify(deviceStatus)} sent successfully`);
|
|
340
340
|
} else {
|
|
341
341
|
this.statusCode(statusCode);
|
|
342
342
|
this.statusCode(deviceStatus.statusCode);
|
|
@@ -482,7 +482,7 @@ export class RobotVacuumCleaner extends deviceBase {
|
|
|
482
482
|
this.debugSuccessLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
483
483
|
+ `statusCode: ${statusCode} & deviceStatus StatusCode: ${deviceStatus.statusCode}`);
|
|
484
484
|
this.successLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
485
|
-
+ `request to SwitchBot API, body: ${deviceStatus} sent successfully`);
|
|
485
|
+
+ `request to SwitchBot API, body: ${JSON.stringify(deviceStatus)} sent successfully`);
|
|
486
486
|
} else {
|
|
487
487
|
this.statusCode(statusCode);
|
|
488
488
|
this.statusCode(deviceStatus.statusCode);
|