@switchbot/homebridge-switchbot 2.9.0-beta.8 → 2.9.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/CHANGELOG.md +1 -1
- package/config.schema.json +21 -5
- package/dist/device/blindtilt.d.ts +1 -1
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +38 -17
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +1 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +64 -17
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +1 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +34 -17
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts +1 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +31 -17
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +1 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +41 -17
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +38 -17
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/hub.d.ts +8 -9
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +172 -55
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +37 -17
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts +1 -1
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +41 -18
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts +1 -1
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +34 -17
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts +1 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +38 -17
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +1 -9
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +47 -32
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +4 -7
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +69 -50
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +1 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +38 -17
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +1 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +35 -17
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts +1 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +35 -17
- 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 +28 -14
- 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 +28 -14
- 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 +28 -14
- 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 +28 -14
- 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 +28 -14
- 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 +39 -15
- 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 +28 -14
- 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 +28 -14
- 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 +28 -14
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +4 -0
- 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/package.json +11 -11
- package/src/device/blindtilt.ts +38 -18
- package/src/device/bot.ts +55 -18
- package/src/device/ceilinglight.ts +34 -19
- package/src/device/colorbulb.ts +31 -18
- package/src/device/contact.ts +41 -19
- package/src/device/curtain.ts +38 -18
- package/src/device/hub.ts +188 -65
- package/src/device/humidifier.ts +37 -19
- package/src/device/iosensor.ts +41 -20
- package/src/device/lightstrip.ts +34 -18
- package/src/device/lock.ts +39 -20
- package/src/device/meter.ts +48 -40
- package/src/device/meterplus.ts +74 -60
- package/src/device/motion.ts +38 -20
- package/src/device/plug.ts +35 -19
- package/src/device/robotvacuumcleaner.ts +35 -18
- package/src/irdevice/airconditioner.ts +28 -15
- package/src/irdevice/airpurifier.ts +30 -15
- package/src/irdevice/camera.ts +30 -15
- package/src/irdevice/fan.ts +30 -15
- package/src/irdevice/light.ts +30 -15
- package/src/irdevice/other.ts +40 -16
- package/src/irdevice/tv.ts +30 -15
- package/src/irdevice/vacuumcleaner.ts +30 -15
- package/src/irdevice/waterheater.ts +30 -15
- package/src/platform.ts +4 -0
- package/src/settings.ts +1 -0
- package/.github/npm-version-script.js +0 -81
package/src/device/plug.ts
CHANGED
|
@@ -60,10 +60,20 @@ export class Plug {
|
|
|
60
60
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
61
61
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
62
62
|
.setCharacteristic(this.platform.Characteristic.Model, this.model(device))
|
|
63
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
.
|
|
63
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
64
|
+
|
|
65
|
+
if (accessory.context.FirmwareRevision) {
|
|
66
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
|
|
67
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
68
|
+
accessory
|
|
69
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
70
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
71
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
72
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
73
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
74
|
+
} else {
|
|
75
|
+
this.setFirmwareRevision(accessory, device);
|
|
76
|
+
}
|
|
67
77
|
|
|
68
78
|
// get the Outlet service if it exists, otherwise create a new Outlet service
|
|
69
79
|
// you can create multiple services for each accessory
|
|
@@ -430,8 +440,7 @@ export class Plug {
|
|
|
430
440
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
431
441
|
} else {
|
|
432
442
|
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
433
|
-
this.
|
|
434
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
443
|
+
this.outletService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
435
444
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
436
445
|
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
437
446
|
}
|
|
@@ -512,6 +521,7 @@ export class Plug {
|
|
|
512
521
|
let model: string;
|
|
513
522
|
if (device.deviceType === 'Plug Mini (US)') {
|
|
514
523
|
model = 'W1901400';
|
|
524
|
+
model = 'W1901401';
|
|
515
525
|
} else if (device.deviceType === 'Plug Mini (JP)') {
|
|
516
526
|
model = 'W2001400';
|
|
517
527
|
} else {
|
|
@@ -587,24 +597,30 @@ export class Plug {
|
|
|
587
597
|
this.outletService.updateCharacteristic(this.platform.Characteristic.On, e);
|
|
588
598
|
}
|
|
589
599
|
|
|
590
|
-
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig)
|
|
591
|
-
|
|
592
|
-
this.debugLog(
|
|
593
|
-
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
594
|
-
);
|
|
595
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
596
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
600
|
+
async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
|
|
601
|
+
await this.refreshStatus();
|
|
597
602
|
if (device.firmware) {
|
|
598
|
-
this.
|
|
603
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
604
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
605
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
606
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
599
607
|
} else if (device.version) {
|
|
600
|
-
this.
|
|
601
|
-
|
|
608
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
|
|
609
|
+
accessory.context.FirmwareRevision = device.version;
|
|
602
610
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
611
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
603
612
|
} else {
|
|
604
|
-
this.
|
|
613
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
614
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
615
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
616
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
605
617
|
}
|
|
606
|
-
this.
|
|
607
|
-
|
|
618
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
619
|
+
accessory
|
|
620
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
621
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
622
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
623
|
+
.updateValue(this.FirmwareRevision);
|
|
608
624
|
}
|
|
609
625
|
|
|
610
626
|
async context() {
|
|
@@ -68,10 +68,20 @@ export class RobotVacuumCleaner {
|
|
|
68
68
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
69
69
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
70
70
|
.setCharacteristic(this.platform.Characteristic.Model, this.model(device))
|
|
71
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
.
|
|
71
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
72
|
+
|
|
73
|
+
if (accessory.context.FirmwareRevision) {
|
|
74
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
|
|
75
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
76
|
+
accessory
|
|
77
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
78
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
79
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
80
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
81
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
82
|
+
} else {
|
|
83
|
+
this.setFirmwareRevision(accessory, device);
|
|
84
|
+
}
|
|
75
85
|
|
|
76
86
|
// get the Lightbulb service if it exists, otherwise create a new Lightbulb service
|
|
77
87
|
// you can create multiple services for each accessory
|
|
@@ -594,8 +604,8 @@ export class RobotVacuumCleaner {
|
|
|
594
604
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
595
605
|
} else {
|
|
596
606
|
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
597
|
-
this.
|
|
598
|
-
|
|
607
|
+
this.batteryService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
608
|
+
this.robotVacuumCleanerService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
599
609
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
600
610
|
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
601
611
|
}
|
|
@@ -751,23 +761,30 @@ export class RobotVacuumCleaner {
|
|
|
751
761
|
this.robotVacuumCleanerService.updateCharacteristic(this.platform.Characteristic.On, e);
|
|
752
762
|
}
|
|
753
763
|
|
|
754
|
-
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig)
|
|
755
|
-
this.
|
|
756
|
-
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
757
|
-
);
|
|
758
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
759
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
764
|
+
async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
|
|
765
|
+
await this.refreshStatus();
|
|
760
766
|
if (device.firmware) {
|
|
761
|
-
this.
|
|
767
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
768
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
769
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
770
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
762
771
|
} else if (device.version) {
|
|
763
|
-
this.
|
|
764
|
-
|
|
772
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
|
|
773
|
+
accessory.context.FirmwareRevision = device.version;
|
|
765
774
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
775
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
766
776
|
} else {
|
|
767
|
-
this.
|
|
777
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
778
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
779
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
780
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
768
781
|
}
|
|
769
|
-
this.
|
|
770
|
-
|
|
782
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
783
|
+
accessory
|
|
784
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
785
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
786
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
787
|
+
.updateValue(this.FirmwareRevision);
|
|
771
788
|
}
|
|
772
789
|
|
|
773
790
|
async context() {
|
|
@@ -62,10 +62,20 @@ export class AirConditioner {
|
|
|
62
62
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
63
63
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
64
64
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
65
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
.
|
|
65
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
66
|
+
|
|
67
|
+
if (accessory.context.FirmwareRevision) {
|
|
68
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
69
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
70
|
+
accessory
|
|
71
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
72
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
73
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
74
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
75
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
76
|
+
} else {
|
|
77
|
+
this.setFirmwareRevision(accessory, device);
|
|
78
|
+
}
|
|
69
79
|
|
|
70
80
|
// get the Television service if it exists, otherwise create a new Television service
|
|
71
81
|
// you can create multiple services for each accessory
|
|
@@ -631,21 +641,24 @@ export class AirConditioner {
|
|
|
631
641
|
this.coolerService.updateCharacteristic(this.platform.Characteristic.CoolingThresholdTemperature, e);
|
|
632
642
|
}
|
|
633
643
|
|
|
634
|
-
setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig)
|
|
635
|
-
this.debugLog(
|
|
636
|
-
`${this.device.remoteType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
637
|
-
);
|
|
638
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
639
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
644
|
+
async setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig) {
|
|
640
645
|
if (device.firmware) {
|
|
641
|
-
this.
|
|
642
|
-
|
|
646
|
+
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
647
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
643
648
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
649
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
644
650
|
} else {
|
|
645
|
-
this.
|
|
651
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
652
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
653
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
654
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
646
655
|
}
|
|
647
|
-
this.
|
|
648
|
-
|
|
656
|
+
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
657
|
+
accessory
|
|
658
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
659
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
660
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
661
|
+
.updateValue(this.FirmwareRevision);
|
|
649
662
|
}
|
|
650
663
|
|
|
651
664
|
async context(): Promise<void> {
|
|
@@ -56,10 +56,20 @@ export class AirPurifier {
|
|
|
56
56
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
57
57
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
58
58
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
59
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
.
|
|
59
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
60
|
+
|
|
61
|
+
if (accessory.context.FirmwareRevision) {
|
|
62
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
63
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
64
|
+
accessory
|
|
65
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
66
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
67
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
68
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
69
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
70
|
+
} else {
|
|
71
|
+
this.setFirmwareRevision(accessory, device);
|
|
72
|
+
}
|
|
63
73
|
|
|
64
74
|
// get the Television service if it exists, otherwise create a new Television service
|
|
65
75
|
// you can create multiple services for each accessory
|
|
@@ -378,21 +388,26 @@ export class AirPurifier {
|
|
|
378
388
|
this.airPurifierService.updateCharacteristic(this.platform.Characteristic.Active, e);
|
|
379
389
|
}
|
|
380
390
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
);
|
|
385
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
386
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
async setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig) {
|
|
387
394
|
if (device.firmware) {
|
|
388
|
-
this.
|
|
389
|
-
|
|
395
|
+
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
396
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
390
397
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
398
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
391
399
|
} else {
|
|
392
|
-
this.
|
|
400
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
401
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
402
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
403
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
393
404
|
}
|
|
394
|
-
this.
|
|
395
|
-
|
|
405
|
+
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
406
|
+
accessory
|
|
407
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
408
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
409
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
410
|
+
.updateValue(this.FirmwareRevision);
|
|
396
411
|
}
|
|
397
412
|
|
|
398
413
|
private context() {
|
package/src/irdevice/camera.ts
CHANGED
|
@@ -38,10 +38,20 @@ export class Camera {
|
|
|
38
38
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
39
39
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
40
40
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
41
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
.
|
|
41
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
42
|
+
|
|
43
|
+
if (accessory.context.FirmwareRevision) {
|
|
44
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
45
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
46
|
+
accessory
|
|
47
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
48
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
49
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
50
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
51
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
52
|
+
} else {
|
|
53
|
+
this.setFirmwareRevision(accessory, device);
|
|
54
|
+
}
|
|
45
55
|
|
|
46
56
|
// get the Television service if it exists, otherwise create a new Television service
|
|
47
57
|
// you can create multiple services for each accessory
|
|
@@ -259,21 +269,26 @@ export class Camera {
|
|
|
259
269
|
this.switchService.updateCharacteristic(this.platform.Characteristic.On, e);
|
|
260
270
|
}
|
|
261
271
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
);
|
|
266
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
267
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
async setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig) {
|
|
268
275
|
if (device.firmware) {
|
|
269
|
-
this.
|
|
270
|
-
|
|
276
|
+
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
277
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
271
278
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
279
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
272
280
|
} else {
|
|
273
|
-
this.
|
|
281
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
282
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
283
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
284
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
274
285
|
}
|
|
275
|
-
this.
|
|
276
|
-
|
|
286
|
+
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
287
|
+
accessory
|
|
288
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
289
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
290
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
291
|
+
.updateValue(this.FirmwareRevision);
|
|
277
292
|
}
|
|
278
293
|
|
|
279
294
|
async context() {
|
package/src/irdevice/fan.ts
CHANGED
|
@@ -45,10 +45,20 @@ export class Fan {
|
|
|
45
45
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
46
46
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
47
47
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
48
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
.
|
|
48
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
49
|
+
|
|
50
|
+
if (accessory.context.FirmwareRevision) {
|
|
51
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
52
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
53
|
+
accessory
|
|
54
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
55
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
56
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
57
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
58
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
59
|
+
} else {
|
|
60
|
+
this.setFirmwareRevision(accessory, device);
|
|
61
|
+
}
|
|
52
62
|
|
|
53
63
|
// get the Television service if it exists, otherwise create a new Television service
|
|
54
64
|
// you can create multiple services for each accessory
|
|
@@ -391,21 +401,26 @@ export class Fan {
|
|
|
391
401
|
this.fanService.updateCharacteristic(this.platform.Characteristic.SwingMode, e);
|
|
392
402
|
}
|
|
393
403
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
);
|
|
398
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
399
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
async setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig) {
|
|
400
407
|
if (device.firmware) {
|
|
401
|
-
this.
|
|
402
|
-
|
|
408
|
+
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
409
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
403
410
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
411
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
404
412
|
} else {
|
|
405
|
-
this.
|
|
413
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
414
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
415
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
416
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
406
417
|
}
|
|
407
|
-
this.
|
|
408
|
-
|
|
418
|
+
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
419
|
+
accessory
|
|
420
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
421
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
422
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
423
|
+
.updateValue(this.FirmwareRevision);
|
|
409
424
|
}
|
|
410
425
|
|
|
411
426
|
async context() {
|
package/src/irdevice/light.ts
CHANGED
|
@@ -38,10 +38,20 @@ export class Light {
|
|
|
38
38
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
39
39
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
40
40
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
41
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
.
|
|
41
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
42
|
+
|
|
43
|
+
if (accessory.context.FirmwareRevision) {
|
|
44
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
45
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
46
|
+
accessory
|
|
47
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
48
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
49
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
50
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
51
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
52
|
+
} else {
|
|
53
|
+
this.setFirmwareRevision(accessory, device);
|
|
54
|
+
}
|
|
45
55
|
|
|
46
56
|
// get the Light service if it exists, otherwise create a new Light service
|
|
47
57
|
// you can create multiple services for each accessory
|
|
@@ -284,21 +294,26 @@ export class Light {
|
|
|
284
294
|
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.On, e);
|
|
285
295
|
}
|
|
286
296
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
);
|
|
291
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
292
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
async setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig) {
|
|
293
300
|
if (device.firmware) {
|
|
294
|
-
this.
|
|
295
|
-
|
|
301
|
+
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
302
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
296
303
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
304
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
297
305
|
} else {
|
|
298
|
-
this.
|
|
306
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
307
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
308
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
309
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
299
310
|
}
|
|
300
|
-
this.
|
|
301
|
-
|
|
311
|
+
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
312
|
+
accessory
|
|
313
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
314
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
315
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
316
|
+
.updateValue(this.FirmwareRevision);
|
|
302
317
|
}
|
|
303
318
|
|
|
304
319
|
async context() {
|
package/src/irdevice/other.ts
CHANGED
|
@@ -49,10 +49,20 @@ export class Others {
|
|
|
49
49
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
50
50
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
51
51
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
52
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
.
|
|
52
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
53
|
+
|
|
54
|
+
if (accessory.context.FirmwareRevision) {
|
|
55
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
56
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
57
|
+
accessory
|
|
58
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
59
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
60
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
61
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
62
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
63
|
+
} else {
|
|
64
|
+
this.setFirmwareRevision(accessory, device);
|
|
65
|
+
}
|
|
56
66
|
|
|
57
67
|
// deviceType
|
|
58
68
|
if (this.otherDeviceType === 'switch') {
|
|
@@ -349,6 +359,13 @@ export class Others {
|
|
|
349
359
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set On: ${value}`);
|
|
350
360
|
this.On = value;
|
|
351
361
|
}
|
|
362
|
+
|
|
363
|
+
//pushChanges
|
|
364
|
+
if (this.On) {
|
|
365
|
+
await this.pushOnChanges();
|
|
366
|
+
} else {
|
|
367
|
+
await this.pushOffChanges();
|
|
368
|
+
}
|
|
352
369
|
}
|
|
353
370
|
|
|
354
371
|
/**
|
|
@@ -659,7 +676,9 @@ export class Others {
|
|
|
659
676
|
|
|
660
677
|
async commandType(): Promise<string> {
|
|
661
678
|
let commandType: string;
|
|
662
|
-
if (this.device.customize) {
|
|
679
|
+
if (this.device.commandType && this.device.customize) {
|
|
680
|
+
commandType = this.device.commandType;
|
|
681
|
+
} else if (this.device.customize) {
|
|
663
682
|
commandType = 'customize';
|
|
664
683
|
} else {
|
|
665
684
|
commandType = 'command';
|
|
@@ -866,21 +885,26 @@ export class Others {
|
|
|
866
885
|
}
|
|
867
886
|
}
|
|
868
887
|
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
);
|
|
873
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
874
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
async setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig) {
|
|
875
891
|
if (device.firmware) {
|
|
876
|
-
this.
|
|
877
|
-
|
|
892
|
+
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
893
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
878
894
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
895
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
879
896
|
} else {
|
|
880
|
-
this.
|
|
897
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
898
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
899
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
900
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
881
901
|
}
|
|
882
|
-
this.
|
|
883
|
-
|
|
902
|
+
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
903
|
+
accessory
|
|
904
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
905
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
906
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
907
|
+
.updateValue(this.FirmwareRevision);
|
|
884
908
|
}
|
|
885
909
|
|
|
886
910
|
async context() {
|
package/src/irdevice/tv.ts
CHANGED
|
@@ -43,10 +43,20 @@ export class TV {
|
|
|
43
43
|
.setCharacteristic(this.platform.Characteristic.Name, `${device.deviceName} ${device.remoteType}`)
|
|
44
44
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
45
45
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
46
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
.
|
|
46
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
47
|
+
|
|
48
|
+
if (accessory.context.FirmwareRevision) {
|
|
49
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
50
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
51
|
+
accessory
|
|
52
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
53
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
54
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
55
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
56
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
57
|
+
} else {
|
|
58
|
+
this.setFirmwareRevision(accessory, device);
|
|
59
|
+
}
|
|
50
60
|
|
|
51
61
|
// set the accessory category
|
|
52
62
|
switch (device.remoteType) {
|
|
@@ -525,21 +535,26 @@ export class TV {
|
|
|
525
535
|
this.tvService.updateCharacteristic(this.platform.Characteristic.ActiveIdentifier, e);
|
|
526
536
|
}
|
|
527
537
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
);
|
|
532
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
533
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
async setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig) {
|
|
534
541
|
if (device.firmware) {
|
|
535
|
-
this.
|
|
536
|
-
|
|
542
|
+
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
543
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
537
544
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
545
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
538
546
|
} else {
|
|
539
|
-
this.
|
|
547
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
548
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
549
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
550
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
540
551
|
}
|
|
541
|
-
this.
|
|
542
|
-
|
|
552
|
+
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
553
|
+
accessory
|
|
554
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
555
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
556
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
557
|
+
.updateValue(this.FirmwareRevision);
|
|
543
558
|
}
|
|
544
559
|
|
|
545
560
|
async context() {
|