@switchbot/homebridge-switchbot 2.9.0-beta.16 → 2.9.0-beta.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/device/blindtilt.d.ts +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.js +1 -1
- 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 +1 -1
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +42 -17
- 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 +40 -17
- 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 -1
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +40 -17
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +3 -3
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +60 -37
- 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 +28 -14
- 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/package.json +2 -2
- 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 +1 -1
- package/src/device/contact.ts +41 -19
- package/src/device/curtain.ts +38 -18
- package/src/device/hub.ts +43 -19
- package/src/device/humidifier.ts +37 -19
- package/src/device/iosensor.ts +40 -19
- package/src/device/lightstrip.ts +34 -18
- package/src/device/lock.ts +39 -20
- package/src/device/meter.ts +40 -18
- package/src/device/meterplus.ts +63 -40
- 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 +30 -15
- package/src/irdevice/tv.ts +30 -15
- package/src/irdevice/vacuumcleaner.ts +30 -15
- package/src/irdevice/waterheater.ts +30 -15
package/src/device/lightstrip.ts
CHANGED
|
@@ -86,10 +86,20 @@ export class StripLight {
|
|
|
86
86
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
87
87
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
88
88
|
.setCharacteristic(this.platform.Characteristic.Model, 'W1701100')
|
|
89
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
.
|
|
89
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
90
|
+
|
|
91
|
+
if (accessory.context.FirmwareRevision) {
|
|
92
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
|
|
93
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
94
|
+
accessory
|
|
95
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
96
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
97
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
98
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
99
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
100
|
+
} else {
|
|
101
|
+
this.setFirmwareRevision(accessory, device);
|
|
102
|
+
}
|
|
93
103
|
|
|
94
104
|
// get the Lightbulb service if it exists, otherwise create a new Lightbulb service
|
|
95
105
|
// you can create multiple services for each accessory
|
|
@@ -865,8 +875,7 @@ export class StripLight {
|
|
|
865
875
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
866
876
|
} else {
|
|
867
877
|
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
868
|
-
this.
|
|
869
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
878
|
+
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
870
879
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
871
880
|
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
872
881
|
}
|
|
@@ -1025,23 +1034,30 @@ export class StripLight {
|
|
|
1025
1034
|
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.Saturation, e);
|
|
1026
1035
|
}
|
|
1027
1036
|
|
|
1028
|
-
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig)
|
|
1029
|
-
this.
|
|
1030
|
-
`${this.device.deviceType}: ${this.accessory.displayName} ` + `accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
1031
|
-
);
|
|
1032
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
1033
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
1037
|
+
async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
|
|
1038
|
+
await this.refreshStatus();
|
|
1034
1039
|
if (device.firmware) {
|
|
1035
|
-
this.
|
|
1040
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
1041
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
1042
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1043
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1036
1044
|
} else if (device.version) {
|
|
1037
|
-
this.
|
|
1038
|
-
|
|
1045
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
|
|
1046
|
+
accessory.context.FirmwareRevision = device.version;
|
|
1039
1047
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1048
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1040
1049
|
} else {
|
|
1041
|
-
this.
|
|
1050
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
1051
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
1052
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1053
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1042
1054
|
}
|
|
1043
|
-
this.
|
|
1044
|
-
|
|
1055
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
1056
|
+
accessory
|
|
1057
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
1058
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
1059
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
1060
|
+
.updateValue(this.FirmwareRevision);
|
|
1045
1061
|
}
|
|
1046
1062
|
|
|
1047
1063
|
async context() {
|
package/src/device/lock.ts
CHANGED
|
@@ -74,10 +74,20 @@ export class Lock {
|
|
|
74
74
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
75
75
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
76
76
|
.setCharacteristic(this.platform.Characteristic.Model, 'W1601700')
|
|
77
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
.
|
|
77
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
78
|
+
|
|
79
|
+
if (accessory.context.FirmwareRevision) {
|
|
80
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
|
|
81
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
82
|
+
accessory
|
|
83
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
84
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
85
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
86
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
87
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
88
|
+
} else {
|
|
89
|
+
this.setFirmwareRevision(accessory, device);
|
|
90
|
+
}
|
|
81
91
|
|
|
82
92
|
// get the LockMechanism service if it exists, otherwise create a new LockMechanism service
|
|
83
93
|
// you can create multiple services for each accessory
|
|
@@ -237,7 +247,7 @@ export class Lock {
|
|
|
237
247
|
this.BatteryLevel = 100;
|
|
238
248
|
}
|
|
239
249
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel},`
|
|
240
|
-
|
|
250
|
+
+ ` StatusLowBattery: ${this.StatusLowBattery}`);
|
|
241
251
|
|
|
242
252
|
// FirmwareRevision
|
|
243
253
|
this.FirmwareRevision = this.OpenAPI_FirmwareRevision!;
|
|
@@ -538,8 +548,11 @@ export class Lock {
|
|
|
538
548
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
539
549
|
} else {
|
|
540
550
|
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
541
|
-
this.
|
|
542
|
-
|
|
551
|
+
this.lockService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
552
|
+
this.batteryService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
553
|
+
if (this.device.lock?.hide_contactsensor) {
|
|
554
|
+
this.contactSensorService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
555
|
+
}
|
|
543
556
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
544
557
|
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
545
558
|
}
|
|
@@ -659,24 +672,30 @@ export class Lock {
|
|
|
659
672
|
this.lockService.updateCharacteristic(this.platform.Characteristic.LockCurrentState, e);
|
|
660
673
|
}
|
|
661
674
|
|
|
662
|
-
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig)
|
|
663
|
-
|
|
664
|
-
this.debugLog(
|
|
665
|
-
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
666
|
-
);
|
|
667
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
668
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
675
|
+
async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
|
|
676
|
+
await this.refreshStatus();
|
|
669
677
|
if (device.firmware) {
|
|
670
|
-
this.
|
|
678
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
679
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
680
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
681
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
671
682
|
} else if (device.version) {
|
|
672
|
-
this.
|
|
673
|
-
|
|
683
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
|
|
684
|
+
accessory.context.FirmwareRevision = device.version;
|
|
674
685
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
686
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
675
687
|
} else {
|
|
676
|
-
this.
|
|
688
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
689
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
690
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
691
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
677
692
|
}
|
|
678
|
-
this.
|
|
679
|
-
|
|
693
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
694
|
+
accessory
|
|
695
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
696
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
697
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
698
|
+
.updateValue(this.FirmwareRevision);
|
|
680
699
|
}
|
|
681
700
|
|
|
682
701
|
async context() {
|
package/src/device/meter.ts
CHANGED
|
@@ -89,10 +89,20 @@ export class Meter {
|
|
|
89
89
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
90
90
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
91
91
|
.setCharacteristic(this.platform.Characteristic.Model, 'METERTH-S1')
|
|
92
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
.
|
|
92
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
93
|
+
|
|
94
|
+
if (accessory.context.FirmwareRevision) {
|
|
95
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
|
|
96
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
97
|
+
accessory
|
|
98
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
99
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
100
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
101
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
102
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
103
|
+
} else {
|
|
104
|
+
this.setFirmwareRevision(accessory, device);
|
|
105
|
+
}
|
|
96
106
|
|
|
97
107
|
// Temperature Sensor Service
|
|
98
108
|
if (device.meter?.hide_temperature) {
|
|
@@ -451,8 +461,13 @@ export class Meter {
|
|
|
451
461
|
mqttmessage.push(`"FirmwareRevision": ${this.FirmwareRevision}`);
|
|
452
462
|
}
|
|
453
463
|
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
454
|
-
this.
|
|
455
|
-
|
|
464
|
+
this.batteryService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
465
|
+
if (!this.device.meter?.hide_humidity) {
|
|
466
|
+
this.humidityService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
467
|
+
}
|
|
468
|
+
if (!this.device.meter?.hide_temperature) {
|
|
469
|
+
this.temperatureService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
470
|
+
}
|
|
456
471
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
457
472
|
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
458
473
|
}
|
|
@@ -628,23 +643,30 @@ export class Meter {
|
|
|
628
643
|
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, e);
|
|
629
644
|
}
|
|
630
645
|
|
|
631
|
-
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig)
|
|
632
|
-
this.
|
|
633
|
-
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
634
|
-
);
|
|
635
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
636
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
646
|
+
async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
|
|
647
|
+
await this.refreshStatus();
|
|
637
648
|
if (device.firmware) {
|
|
638
|
-
this.
|
|
649
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
650
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
651
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
652
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
639
653
|
} else if (device.version) {
|
|
640
|
-
this.
|
|
641
|
-
|
|
654
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
|
|
655
|
+
accessory.context.FirmwareRevision = device.version;
|
|
642
656
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
657
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
643
658
|
} else {
|
|
644
|
-
this.
|
|
659
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
660
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
661
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
662
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
645
663
|
}
|
|
646
|
-
this.
|
|
647
|
-
|
|
664
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
665
|
+
accessory
|
|
666
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
667
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
668
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
669
|
+
.updateValue(this.FirmwareRevision);
|
|
648
670
|
}
|
|
649
671
|
|
|
650
672
|
async context() {
|
package/src/device/meterplus.ts
CHANGED
|
@@ -18,8 +18,8 @@ import { sleep } from '../utils';
|
|
|
18
18
|
export class MeterPlus {
|
|
19
19
|
// Services
|
|
20
20
|
batteryService: Service;
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
humidityService?: Service;
|
|
22
|
+
temperatureService?: Service;
|
|
23
23
|
|
|
24
24
|
// Characteristic Values
|
|
25
25
|
BatteryLevel!: CharacteristicValue;
|
|
@@ -89,27 +89,37 @@ export class MeterPlus {
|
|
|
89
89
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
90
90
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
91
91
|
.setCharacteristic(this.platform.Characteristic.Model, this.model(device))
|
|
92
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
.
|
|
92
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
93
|
+
|
|
94
|
+
if (accessory.context.FirmwareRevision) {
|
|
95
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
|
|
96
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
97
|
+
accessory
|
|
98
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
99
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
100
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
101
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
102
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
103
|
+
} else {
|
|
104
|
+
this.setFirmwareRevision(accessory, device);
|
|
105
|
+
}
|
|
96
106
|
|
|
97
107
|
// Temperature Sensor Service
|
|
98
108
|
if (device.meter?.hide_temperature) {
|
|
99
109
|
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Temperature Sensor Service`);
|
|
100
|
-
this.
|
|
101
|
-
accessory.removeService(this.
|
|
102
|
-
} else if (!this.
|
|
110
|
+
this.temperatureService = this.accessory.getService(this.platform.Service.TemperatureSensor);
|
|
111
|
+
accessory.removeService(this.temperatureService!);
|
|
112
|
+
} else if (!this.temperatureService) {
|
|
103
113
|
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Temperature Sensor Service`);
|
|
104
|
-
(this.
|
|
114
|
+
(this.temperatureService =
|
|
105
115
|
this.accessory.getService(this.platform.Service.TemperatureSensor) || this.accessory.addService(this.platform.Service.TemperatureSensor)),
|
|
106
116
|
`${accessory.displayName} Temperature Sensor`;
|
|
107
117
|
|
|
108
|
-
this.
|
|
109
|
-
if (!this.
|
|
110
|
-
this.
|
|
118
|
+
this.temperatureService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Temperature Sensor`);
|
|
119
|
+
if (!this.temperatureService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
120
|
+
this.temperatureService.addCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Temperature Sensor`);
|
|
111
121
|
}
|
|
112
|
-
this.
|
|
122
|
+
this.temperatureService
|
|
113
123
|
.getCharacteristic(this.platform.Characteristic.CurrentTemperature)
|
|
114
124
|
.setProps({
|
|
115
125
|
unit: Units['CELSIUS'],
|
|
@@ -128,19 +138,19 @@ export class MeterPlus {
|
|
|
128
138
|
// Humidity Sensor Service
|
|
129
139
|
if (device.meter?.hide_humidity) {
|
|
130
140
|
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Humidity Sensor Service`);
|
|
131
|
-
this.
|
|
132
|
-
accessory.removeService(this.
|
|
133
|
-
} else if (!this.
|
|
141
|
+
this.humidityService = this.accessory.getService(this.platform.Service.HumiditySensor);
|
|
142
|
+
accessory.removeService(this.humidityService!);
|
|
143
|
+
} else if (!this.humidityService) {
|
|
134
144
|
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Humidity Sensor Service`);
|
|
135
|
-
(this.
|
|
145
|
+
(this.humidityService =
|
|
136
146
|
this.accessory.getService(this.platform.Service.HumiditySensor) || this.accessory.addService(this.platform.Service.HumiditySensor)),
|
|
137
147
|
`${accessory.displayName} Humidity Sensor`;
|
|
138
148
|
|
|
139
|
-
this.
|
|
140
|
-
if (!this.
|
|
141
|
-
this.
|
|
149
|
+
this.humidityService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Humidity Sensor`);
|
|
150
|
+
if (!this.humidityService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
151
|
+
this.humidityService.addCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Humidity Sensor`);
|
|
142
152
|
}
|
|
143
|
-
this.
|
|
153
|
+
this.humidityService
|
|
144
154
|
.getCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity)
|
|
145
155
|
.setProps({
|
|
146
156
|
minStep: 0.1,
|
|
@@ -393,7 +403,7 @@ export class MeterPlus {
|
|
|
393
403
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
|
|
394
404
|
} else {
|
|
395
405
|
this.accessory.context.CurrentRelativeHumidity = this.CurrentRelativeHumidity;
|
|
396
|
-
this.
|
|
406
|
+
this.humidityService?.updateCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity, this.CurrentRelativeHumidity);
|
|
397
407
|
this.debugLog(
|
|
398
408
|
`${this.device.deviceType}: ${this.accessory.displayName}` +
|
|
399
409
|
` updateCharacteristic CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`,
|
|
@@ -418,7 +428,7 @@ export class MeterPlus {
|
|
|
418
428
|
entry['temp'] = this.CurrentTemperature;
|
|
419
429
|
}
|
|
420
430
|
this.accessory.context.CurrentTemperature = this.CurrentTemperature;
|
|
421
|
-
this.
|
|
431
|
+
this.temperatureService?.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, this.CurrentTemperature);
|
|
422
432
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic CurrentTemperature: ${this.CurrentTemperature}`);
|
|
423
433
|
}
|
|
424
434
|
}
|
|
@@ -452,8 +462,14 @@ export class MeterPlus {
|
|
|
452
462
|
mqttmessage.push(`"FirmwareRevision": ${this.FirmwareRevision}`);
|
|
453
463
|
}
|
|
454
464
|
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
455
|
-
|
|
456
|
-
|
|
465
|
+
|
|
466
|
+
this.batteryService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
467
|
+
if (!this.device.meter?.hide_humidity) {
|
|
468
|
+
this.humidityService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
469
|
+
}
|
|
470
|
+
if (!this.device.meter?.hide_temperature) {
|
|
471
|
+
this.temperatureService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
472
|
+
}
|
|
457
473
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
458
474
|
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
459
475
|
}
|
|
@@ -630,32 +646,39 @@ export class MeterPlus {
|
|
|
630
646
|
|
|
631
647
|
async apiError(e: any): Promise<void> {
|
|
632
648
|
if (!this.device.meter?.hide_humidity) {
|
|
633
|
-
this.
|
|
649
|
+
this.humidityService?.updateCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity, e);
|
|
634
650
|
}
|
|
635
651
|
if (!this.device.meter?.hide_temperature) {
|
|
636
|
-
this.
|
|
652
|
+
this.temperatureService?.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, e);
|
|
637
653
|
}
|
|
638
654
|
this.batteryService?.updateCharacteristic(this.platform.Characteristic.BatteryLevel, e);
|
|
639
655
|
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, e);
|
|
640
656
|
}
|
|
641
657
|
|
|
642
|
-
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig)
|
|
643
|
-
this.
|
|
644
|
-
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
645
|
-
);
|
|
646
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
647
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
658
|
+
async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
|
|
659
|
+
await this.refreshStatus();
|
|
648
660
|
if (device.firmware) {
|
|
649
|
-
this.
|
|
661
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
662
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
663
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
664
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
650
665
|
} else if (device.version) {
|
|
651
|
-
this.
|
|
652
|
-
|
|
666
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
|
|
667
|
+
accessory.context.FirmwareRevision = device.version;
|
|
653
668
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
669
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
654
670
|
} else {
|
|
655
|
-
this.
|
|
671
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
672
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
673
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
674
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
656
675
|
}
|
|
657
|
-
this.
|
|
658
|
-
|
|
676
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
677
|
+
accessory
|
|
678
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
679
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
680
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
681
|
+
.updateValue(this.FirmwareRevision);
|
|
659
682
|
}
|
|
660
683
|
|
|
661
684
|
async context() {
|
package/src/device/motion.ts
CHANGED
|
@@ -79,10 +79,20 @@ export class Motion {
|
|
|
79
79
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
80
80
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
81
81
|
.setCharacteristic(this.platform.Characteristic.Model, 'W1101500')
|
|
82
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
.
|
|
82
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
83
|
+
|
|
84
|
+
if (accessory.context.FirmwareRevision) {
|
|
85
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
|
|
86
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
87
|
+
accessory
|
|
88
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
89
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
90
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
91
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
92
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
93
|
+
} else {
|
|
94
|
+
this.setFirmwareRevision(accessory, device);
|
|
95
|
+
}
|
|
86
96
|
|
|
87
97
|
// get the Battery service if it exists, otherwise create a new Motion service
|
|
88
98
|
// you can create multiple services for each accessory
|
|
@@ -402,14 +412,16 @@ export class Motion {
|
|
|
402
412
|
);
|
|
403
413
|
}
|
|
404
414
|
}
|
|
405
|
-
|
|
406
415
|
// FirmwareRevision
|
|
407
416
|
if (this.FirmwareRevision === undefined) {
|
|
408
417
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
409
418
|
} else {
|
|
410
419
|
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
411
|
-
this.
|
|
412
|
-
|
|
420
|
+
this.motionSensorService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
421
|
+
this.batteryService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
422
|
+
if (!this.device.motion?.hide_lightsensor) {
|
|
423
|
+
this.lightSensorService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
424
|
+
}
|
|
413
425
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
414
426
|
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
415
427
|
}
|
|
@@ -561,24 +573,30 @@ export class Motion {
|
|
|
561
573
|
}
|
|
562
574
|
}
|
|
563
575
|
|
|
564
|
-
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig)
|
|
565
|
-
|
|
566
|
-
this.debugLog(
|
|
567
|
-
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
568
|
-
);
|
|
569
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
570
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
576
|
+
async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
|
|
577
|
+
await this.refreshStatus();
|
|
571
578
|
if (device.firmware) {
|
|
572
|
-
this.
|
|
579
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
580
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
581
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
582
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
573
583
|
} else if (device.version) {
|
|
574
|
-
this.
|
|
575
|
-
|
|
584
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
|
|
585
|
+
accessory.context.FirmwareRevision = device.version;
|
|
576
586
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
587
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
577
588
|
} else {
|
|
578
|
-
this.
|
|
589
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
590
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
591
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
592
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
579
593
|
}
|
|
580
|
-
this.
|
|
581
|
-
|
|
594
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
595
|
+
accessory
|
|
596
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
597
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
598
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
599
|
+
.updateValue(this.FirmwareRevision);
|
|
582
600
|
}
|
|
583
601
|
|
|
584
602
|
async context() {
|
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() {
|