@switchbot/homebridge-switchbot 2.8.0-beta.0 → 2.8.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc +1 -1
- package/.vscode/settings.json +1 -1
- package/CHANGELOG.md +10 -0
- package/config.schema.json +8 -0
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +49 -59
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +44 -50
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +60 -63
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +68 -70
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +22 -25
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +50 -58
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/hub.d.ts +6 -0
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +168 -26
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +49 -56
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +18 -20
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +59 -61
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +40 -41
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +3 -3
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +65 -68
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +18 -20
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +20 -23
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +30 -33
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +48 -51
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +58 -62
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +29 -31
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +17 -20
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +27 -29
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +23 -26
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +19 -20
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +44 -47
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +17 -20
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +19 -20
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +44 -43
- package/dist/platform.js.map +1 -1
- package/dist/settings.d.ts +1 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/device/blindtilt.ts +106 -72
- package/src/device/bot.ts +94 -58
- package/src/device/ceilinglight.ts +102 -68
- package/src/device/colorbulb.ts +134 -82
- package/src/device/contact.ts +54 -33
- package/src/device/curtain.ts +130 -101
- package/src/device/hub.ts +198 -35
- package/src/device/humidifier.ts +128 -80
- package/src/device/iosensor.ts +43 -27
- package/src/device/lightstrip.ts +108 -67
- package/src/device/lock.ts +73 -45
- package/src/device/meter.ts +94 -75
- package/src/device/meterplus.ts +43 -27
- package/src/device/motion.ts +50 -32
- package/src/device/plug.ts +62 -39
- package/src/device/robotvacuumcleaner.ts +78 -54
- package/src/irdevice/airconditioner.ts +112 -84
- package/src/irdevice/airpurifier.ts +55 -34
- package/src/irdevice/camera.ts +35 -23
- package/src/irdevice/fan.ts +47 -33
- package/src/irdevice/light.ts +43 -29
- package/src/irdevice/other.ts +39 -23
- package/src/irdevice/tv.ts +65 -51
- package/src/irdevice/vacuumcleaner.ts +35 -23
- package/src/irdevice/waterheater.ts +43 -27
- package/src/platform.ts +85 -55
- package/src/settings.ts +41 -40
- package/src/utils.ts +1 -1
package/src/device/bot.ts
CHANGED
|
@@ -60,10 +60,14 @@ export class Bot {
|
|
|
60
60
|
doBotUpdate!: Subject<void>;
|
|
61
61
|
|
|
62
62
|
// Connection
|
|
63
|
-
private readonly BLE =
|
|
64
|
-
private readonly OpenAPI =
|
|
65
|
-
|
|
66
|
-
constructor(
|
|
63
|
+
private readonly BLE = this.device.connectionType === 'BLE' || this.device.connectionType === 'BLE/OpenAPI';
|
|
64
|
+
private readonly OpenAPI = this.device.connectionType === 'OpenAPI' || this.device.connectionType === 'BLE/OpenAPI';
|
|
65
|
+
|
|
66
|
+
constructor(
|
|
67
|
+
private readonly platform: SwitchBotPlatform,
|
|
68
|
+
private accessory: PlatformAccessory,
|
|
69
|
+
public device: device & devicesConfig,
|
|
70
|
+
) {
|
|
67
71
|
// default placeholders
|
|
68
72
|
this.logs(device);
|
|
69
73
|
this.scan(device);
|
|
@@ -111,7 +115,6 @@ export class Bot {
|
|
|
111
115
|
`${accessory.displayName} Switch`;
|
|
112
116
|
this.infoLog(`${this.device.deviceType}: ${accessory.displayName} Displaying as Switch`);
|
|
113
117
|
|
|
114
|
-
|
|
115
118
|
this.switchService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
|
|
116
119
|
if (!this.switchService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
117
120
|
this.switchService.addCharacteristic(this.platform.Characteristic.ConfiguredName, accessory.displayName);
|
|
@@ -392,8 +395,10 @@ export class Bot {
|
|
|
392
395
|
}
|
|
393
396
|
} catch (e: any) {
|
|
394
397
|
this.apiError(e);
|
|
395
|
-
this.errorLog(
|
|
396
|
-
|
|
398
|
+
this.errorLog(
|
|
399
|
+
`${this.device.deviceType}: ${this.accessory.displayName} failed pushChanges with ${this.device.connectionType} Connection,` +
|
|
400
|
+
` Error Message: ${JSON.stringify(e.message)}`,
|
|
401
|
+
);
|
|
397
402
|
}
|
|
398
403
|
this.botUpdateInProgress = false;
|
|
399
404
|
});
|
|
@@ -411,8 +416,9 @@ export class Bot {
|
|
|
411
416
|
await this.openAPIparseStatus();
|
|
412
417
|
} else {
|
|
413
418
|
await this.offlineOff();
|
|
414
|
-
this.debugWarnLog(
|
|
415
|
-
+ ` ${this.device.connectionType}, parseStatus will not happen
|
|
419
|
+
this.debugWarnLog(
|
|
420
|
+
`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:` + ` ${this.device.connectionType}, parseStatus will not happen.`,
|
|
421
|
+
);
|
|
416
422
|
}
|
|
417
423
|
}
|
|
418
424
|
|
|
@@ -469,8 +475,10 @@ export class Bot {
|
|
|
469
475
|
await this.openAPIRefreshStatus();
|
|
470
476
|
} else {
|
|
471
477
|
await this.offlineOff();
|
|
472
|
-
this.debugWarnLog(
|
|
473
|
-
|
|
478
|
+
this.debugWarnLog(
|
|
479
|
+
`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:` +
|
|
480
|
+
` ${this.device.connectionType}, refreshStatus will not happen.`,
|
|
481
|
+
);
|
|
474
482
|
}
|
|
475
483
|
}
|
|
476
484
|
|
|
@@ -495,15 +503,19 @@ export class Bot {
|
|
|
495
503
|
// Set an event hander
|
|
496
504
|
switchbot.onadvertisement = async (ad: ad) => {
|
|
497
505
|
this.address = ad.address;
|
|
498
|
-
this.debugLog(
|
|
499
|
-
|
|
506
|
+
this.debugLog(
|
|
507
|
+
`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac},` +
|
|
508
|
+
` BLE Address Found: ${this.address}`,
|
|
509
|
+
);
|
|
500
510
|
this.serviceData = ad.serviceData;
|
|
501
511
|
this.mode = ad.serviceData.mode;
|
|
502
512
|
this.state = ad.serviceData.state;
|
|
503
513
|
this.battery = ad.serviceData.battery;
|
|
504
514
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} serviceData: ${JSON.stringify(ad.serviceData)}`);
|
|
505
|
-
this.debugLog(
|
|
506
|
-
|
|
515
|
+
this.debugLog(
|
|
516
|
+
`${this.device.deviceType}: ${this.accessory.displayName}, model: ${ad.serviceData.model}, modelName: ` +
|
|
517
|
+
`${ad.serviceData.modelName}, mode: ${ad.serviceData.mode}, state: ${ad.serviceData.state}, battery: ${ad.serviceData.battery}`,
|
|
518
|
+
);
|
|
507
519
|
|
|
508
520
|
if (this.serviceData) {
|
|
509
521
|
this.connected = true;
|
|
@@ -523,8 +535,10 @@ export class Bot {
|
|
|
523
535
|
})
|
|
524
536
|
.catch(async (e: any) => {
|
|
525
537
|
this.apiError(e);
|
|
526
|
-
this.errorLog(
|
|
527
|
-
|
|
538
|
+
this.errorLog(
|
|
539
|
+
`${this.device.deviceType}: ${this.accessory.displayName} failed BLERefreshStatus with ${this.device.connectionType}` +
|
|
540
|
+
` Connection, Error Message: ${JSON.stringify(e.message)}`,
|
|
541
|
+
);
|
|
528
542
|
await this.BLERefreshConnection(switchbot);
|
|
529
543
|
});
|
|
530
544
|
} else {
|
|
@@ -542,17 +556,16 @@ export class Bot {
|
|
|
542
556
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Devices: ${JSON.stringify(deviceStatus.body)}`);
|
|
543
557
|
this.statusCode(statusCode);
|
|
544
558
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
|
|
545
|
-
this.debugLog(
|
|
546
|
-
`${this.device.deviceType}: ${this.accessory.displayName
|
|
547
|
-
} refreshStatus: ${JSON.stringify(deviceStatus)}`,
|
|
548
|
-
);
|
|
559
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} refreshStatus: ${JSON.stringify(deviceStatus)}`);
|
|
549
560
|
this.power = deviceStatus.body.power;
|
|
550
561
|
this.openAPIparseStatus();
|
|
551
562
|
this.updateHomeKitCharacteristics();
|
|
552
563
|
} catch (e: any) {
|
|
553
564
|
this.apiError(e);
|
|
554
|
-
this.errorLog(
|
|
555
|
-
|
|
565
|
+
this.errorLog(
|
|
566
|
+
`${this.device.deviceType}: ${this.accessory.displayName} failed openAPIRefreshStatus with ${this.device.connectionType}` +
|
|
567
|
+
` Connection, Error Message: ${JSON.stringify(e.message)}`,
|
|
568
|
+
);
|
|
556
569
|
}
|
|
557
570
|
}
|
|
558
571
|
|
|
@@ -572,8 +585,9 @@ export class Bot {
|
|
|
572
585
|
await this.openAPIpushChanges();
|
|
573
586
|
} else {
|
|
574
587
|
await this.offlineOff();
|
|
575
|
-
this.debugWarnLog(
|
|
576
|
-
+ ` ${this.device.connectionType}, pushChanges will not happen
|
|
588
|
+
this.debugWarnLog(
|
|
589
|
+
`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:` + ` ${this.device.connectionType}, pushChanges will not happen.`,
|
|
590
|
+
);
|
|
577
591
|
}
|
|
578
592
|
// Refresh the status from the API
|
|
579
593
|
interval(15000)
|
|
@@ -618,8 +632,10 @@ export class Bot {
|
|
|
618
632
|
})
|
|
619
633
|
.catch(async (e: any) => {
|
|
620
634
|
this.apiError(e);
|
|
621
|
-
this.errorLog(
|
|
622
|
-
|
|
635
|
+
this.errorLog(
|
|
636
|
+
`${this.device.deviceType}: ${this.accessory.displayName} failed BLEpushChanges with ${this.device.connectionType}` +
|
|
637
|
+
` Connection & botMode: ${this.botMode}, Error Message: ${JSON.stringify(e.message)}`,
|
|
638
|
+
);
|
|
623
639
|
await this.BLEPushConnection();
|
|
624
640
|
});
|
|
625
641
|
} else if (this.botMode === 'switch') {
|
|
@@ -645,16 +661,19 @@ export class Bot {
|
|
|
645
661
|
})
|
|
646
662
|
.catch(async (e: any) => {
|
|
647
663
|
this.apiError(e);
|
|
648
|
-
this.errorLog(
|
|
649
|
-
|
|
664
|
+
this.errorLog(
|
|
665
|
+
`${this.device.deviceType}: ${this.accessory.displayName} failed BLEpushChanges with ${this.device.connectionType}` +
|
|
666
|
+
` Connection & botMode: ${this.botMode}, Error Message: ${JSON.stringify(e.message)}`,
|
|
667
|
+
);
|
|
650
668
|
await this.BLEPushConnection();
|
|
651
669
|
});
|
|
652
670
|
} else {
|
|
653
671
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} Bot Mode: ${this.botMode}`);
|
|
654
672
|
}
|
|
655
673
|
} else {
|
|
656
|
-
this.debugLog(
|
|
657
|
-
+ `OnCached: ${this.accessory.context.On}
|
|
674
|
+
this.debugLog(
|
|
675
|
+
`${this.device.deviceType}: ${this.accessory.displayName} No BLEpushChanges.` + `On: ${this.On}, ` + `OnCached: ${this.accessory.context.On}`,
|
|
676
|
+
);
|
|
658
677
|
}
|
|
659
678
|
}
|
|
660
679
|
|
|
@@ -664,7 +683,7 @@ export class Bot {
|
|
|
664
683
|
this.debugLog(`${this.device.deviceType}: ${this.multiPressCount} request(s) queued.`);
|
|
665
684
|
this.On = true;
|
|
666
685
|
}
|
|
667
|
-
if (
|
|
686
|
+
if (this.On !== this.accessory.context.On || this.allowPush || this.multiPressCount > 0) {
|
|
668
687
|
let command = '';
|
|
669
688
|
if (this.botMode === 'switch' && this.On) {
|
|
670
689
|
command = 'turnOn';
|
|
@@ -682,9 +701,9 @@ export class Bot {
|
|
|
682
701
|
throw new Error(`${this.device.deviceType}: ${this.accessory.displayName} Device Paramters not set for this Bot.`);
|
|
683
702
|
}
|
|
684
703
|
const bodyChange = JSON.stringify({
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
704
|
+
command: `${command}`,
|
|
705
|
+
parameter: 'default',
|
|
706
|
+
commandType: 'command',
|
|
688
707
|
});
|
|
689
708
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
690
709
|
try {
|
|
@@ -707,13 +726,17 @@ export class Bot {
|
|
|
707
726
|
}
|
|
708
727
|
} catch (e: any) {
|
|
709
728
|
this.apiError(e);
|
|
710
|
-
this.errorLog(
|
|
711
|
-
|
|
729
|
+
this.errorLog(
|
|
730
|
+
`${this.device.deviceType}: ${this.accessory.displayName} failed openAPIpushChanges with ${this.device.connectionType}` +
|
|
731
|
+
` Connection, Error Message: ${JSON.stringify(e.message)}`,
|
|
712
732
|
);
|
|
713
733
|
}
|
|
714
734
|
} else {
|
|
715
|
-
this.debugLog(
|
|
716
|
-
|
|
735
|
+
this.debugLog(
|
|
736
|
+
`${this.device.deviceType}: ${this.accessory.displayName} No openAPIpushChanges.` +
|
|
737
|
+
`On: ${this.On}, ` +
|
|
738
|
+
`OnCached: ${this.accessory.context.On}`,
|
|
739
|
+
);
|
|
717
740
|
}
|
|
718
741
|
}
|
|
719
742
|
|
|
@@ -767,7 +790,6 @@ export class Bot {
|
|
|
767
790
|
this.multiPressCount++;
|
|
768
791
|
this.debugLog(`${this.device.deviceType} set to Multi-Press. Multi-Press count: ${this.multiPressCount}`);
|
|
769
792
|
}
|
|
770
|
-
|
|
771
793
|
}
|
|
772
794
|
this.On = value;
|
|
773
795
|
}
|
|
@@ -791,8 +813,9 @@ export class Bot {
|
|
|
791
813
|
this.platform.Characteristic.CurrentDoorState,
|
|
792
814
|
this.platform.Characteristic.CurrentDoorState.OPEN,
|
|
793
815
|
);
|
|
794
|
-
this.debugLog(
|
|
795
|
-
+ `${this.accessory.displayName} updateCharacteristic TargetDoorState: Open, CurrentDoorState: Open
|
|
816
|
+
this.debugLog(
|
|
817
|
+
`${this.device.deviceType}: ` + `${this.accessory.displayName} updateCharacteristic TargetDoorState: Open, CurrentDoorState: Open`,
|
|
818
|
+
);
|
|
796
819
|
} else {
|
|
797
820
|
this.garageDoorService?.updateCharacteristic(
|
|
798
821
|
this.platform.Characteristic.TargetDoorState,
|
|
@@ -802,8 +825,9 @@ export class Bot {
|
|
|
802
825
|
this.platform.Characteristic.CurrentDoorState,
|
|
803
826
|
this.platform.Characteristic.CurrentDoorState.CLOSED,
|
|
804
827
|
);
|
|
805
|
-
this.debugLog(
|
|
806
|
-
+ `${this.accessory.displayName} updateCharacteristic TargetDoorState: Open, CurrentDoorState: Open
|
|
828
|
+
this.debugLog(
|
|
829
|
+
`${this.device.deviceType}: ` + `${this.accessory.displayName} updateCharacteristic TargetDoorState: Open, CurrentDoorState: Open`,
|
|
830
|
+
);
|
|
807
831
|
}
|
|
808
832
|
}
|
|
809
833
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Garage Door On: ${this.On}`);
|
|
@@ -877,16 +901,19 @@ export class Bot {
|
|
|
877
901
|
this.platform.Characteristic.LockCurrentState,
|
|
878
902
|
this.platform.Characteristic.LockCurrentState.UNSECURED,
|
|
879
903
|
);
|
|
880
|
-
this.debugLog(
|
|
881
|
-
|
|
904
|
+
this.debugLog(
|
|
905
|
+
`${this.device.deviceType}: ` +
|
|
906
|
+
`${this.accessory.displayName} updateCharacteristic LockTargetState: UNSECURED, LockCurrentState: UNSECURED`,
|
|
907
|
+
);
|
|
882
908
|
} else {
|
|
883
909
|
this.lockService?.updateCharacteristic(this.platform.Characteristic.LockTargetState, this.platform.Characteristic.LockTargetState.SECURED);
|
|
884
910
|
this.lockService?.updateCharacteristic(
|
|
885
911
|
this.platform.Characteristic.LockCurrentState,
|
|
886
912
|
this.platform.Characteristic.LockCurrentState.SECURED,
|
|
887
913
|
);
|
|
888
|
-
this.debugLog(
|
|
889
|
-
+ `${this.accessory.displayName} updateCharacteristic LockTargetState: SECURED, LockCurrentState: SECURED
|
|
914
|
+
this.debugLog(
|
|
915
|
+
`${this.device.deviceType}: ` + `${this.accessory.displayName} updateCharacteristic LockTargetState: SECURED, LockCurrentState: SECURED`,
|
|
916
|
+
);
|
|
890
917
|
}
|
|
891
918
|
}
|
|
892
919
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Lock On: ${this.On}`);
|
|
@@ -926,16 +953,20 @@ export class Bot {
|
|
|
926
953
|
this.platform.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS,
|
|
927
954
|
);
|
|
928
955
|
this.statefulProgrammableSwitchService?.updateCharacteristic(this.platform.Characteristic.ProgrammableSwitchOutputState, 1);
|
|
929
|
-
this.debugLog(
|
|
930
|
-
|
|
956
|
+
this.debugLog(
|
|
957
|
+
`${this.device.deviceType}: ` +
|
|
958
|
+
`${this.accessory.displayName} updateCharacteristic ProgrammableSwitchEvent: SINGLE, ProgrammableSwitchOutputState: 1`,
|
|
959
|
+
);
|
|
931
960
|
} else {
|
|
932
961
|
this.statefulProgrammableSwitchService?.updateCharacteristic(
|
|
933
962
|
this.platform.Characteristic.ProgrammableSwitchEvent,
|
|
934
963
|
this.platform.Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS,
|
|
935
964
|
);
|
|
936
965
|
this.statefulProgrammableSwitchService?.updateCharacteristic(this.platform.Characteristic.ProgrammableSwitchOutputState, 0);
|
|
937
|
-
this.debugLog(
|
|
938
|
-
|
|
966
|
+
this.debugLog(
|
|
967
|
+
`${this.device.deviceType}: ` +
|
|
968
|
+
`${this.accessory.displayName} updateCharacteristic ProgrammableSwitchEvent: SINGLE, ProgrammableSwitchOutputState: 0`,
|
|
969
|
+
);
|
|
939
970
|
}
|
|
940
971
|
}
|
|
941
972
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} StatefulProgrammableSwitch On: ${this.On}`);
|
|
@@ -1193,8 +1224,10 @@ export class Bot {
|
|
|
1193
1224
|
this.offlineOff();
|
|
1194
1225
|
break;
|
|
1195
1226
|
case 171:
|
|
1196
|
-
this.errorLog(
|
|
1197
|
-
|
|
1227
|
+
this.errorLog(
|
|
1228
|
+
`${this.device.deviceType}: ${this.accessory.displayName} Hub Device is offline, statusCode: ${statusCode}. ` +
|
|
1229
|
+
`Hub: ${this.device.hubDeviceId}`,
|
|
1230
|
+
);
|
|
1198
1231
|
this.offlineOff();
|
|
1199
1232
|
break;
|
|
1200
1233
|
case 190:
|
|
@@ -1210,8 +1243,10 @@ export class Bot {
|
|
|
1210
1243
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Request successful, statusCode: ${statusCode}`);
|
|
1211
1244
|
break;
|
|
1212
1245
|
default:
|
|
1213
|
-
this.infoLog(
|
|
1214
|
-
|
|
1246
|
+
this.infoLog(
|
|
1247
|
+
`${this.device.deviceType}: ${this.accessory.displayName} Unknown statusCode: ` +
|
|
1248
|
+
`${statusCode}, Submit Bugs Here: ' + 'https://tinyurl.com/SwitchBotBug`,
|
|
1249
|
+
);
|
|
1215
1250
|
}
|
|
1216
1251
|
}
|
|
1217
1252
|
|
|
@@ -1262,8 +1297,9 @@ export class Bot {
|
|
|
1262
1297
|
|
|
1263
1298
|
FirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
|
|
1264
1299
|
let FirmwareRevision: string;
|
|
1265
|
-
this.debugLog(
|
|
1266
|
-
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}
|
|
1300
|
+
this.debugLog(
|
|
1301
|
+
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
1302
|
+
);
|
|
1267
1303
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
1268
1304
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
1269
1305
|
if (accessory.context.FirmwareRevision) {
|