@switchbot/homebridge-switchbot 2.8.2-beta.1 → 2.8.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/CHANGELOG.md +10 -0
- package/config.schema.json +1 -1
- package/dist/device/blindtilt.d.ts +2 -1
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +39 -14
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +2 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +23 -17
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +2 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +16 -14
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts +2 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +21 -14
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +2 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +16 -14
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +4 -3
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +36 -18
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/hub.d.ts +2 -1
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +16 -14
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts +5 -4
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +16 -14
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts +2 -1
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +29 -14
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts +2 -1
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +21 -14
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts +2 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +18 -15
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +3 -2
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +48 -26
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +3 -2
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +46 -23
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +5 -4
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +22 -19
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +2 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +17 -14
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts +2 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +19 -13
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +7 -19
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +36 -18
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +4 -7
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +26 -12
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +4 -7
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +24 -12
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +4 -7
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +23 -12
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts +4 -7
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +24 -12
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +4 -7
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +24 -12
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +5 -10
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +27 -14
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +4 -7
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +24 -12
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +6 -16
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +28 -16
- package/dist/irdevice/waterheater.js.map +1 -1
- package/package.json +3 -3
- package/src/device/blindtilt.ts +41 -16
- package/src/device/bot.ts +25 -17
- package/src/device/ceilinglight.ts +20 -14
- package/src/device/colorbulb.ts +23 -14
- package/src/device/contact.ts +20 -14
- package/src/device/curtain.ts +41 -21
- package/src/device/hub.ts +20 -14
- package/src/device/humidifier.ts +23 -17
- package/src/device/iosensor.ts +33 -14
- package/src/device/lightstrip.ts +23 -14
- package/src/device/lock.ts +22 -15
- package/src/device/meter.ts +52 -27
- package/src/device/meterplus.ts +51 -26
- package/src/device/motion.ts +31 -30
- package/src/device/plug.ts +20 -14
- package/src/device/robotvacuumcleaner.ts +21 -13
- package/src/irdevice/airconditioner.ts +36 -18
- package/src/irdevice/airpurifier.ts +26 -12
- package/src/irdevice/camera.ts +24 -12
- package/src/irdevice/fan.ts +23 -12
- package/src/irdevice/light.ts +24 -12
- package/src/irdevice/other.ts +24 -12
- package/src/irdevice/tv.ts +27 -14
- package/src/irdevice/vacuumcleaner.ts +24 -12
- package/src/irdevice/waterheater.ts +28 -16
- package/.github/npm-version-script.js +0 -81
package/src/device/lightstrip.ts
CHANGED
|
@@ -22,6 +22,7 @@ export class StripLight {
|
|
|
22
22
|
Hue!: CharacteristicValue;
|
|
23
23
|
Saturation!: CharacteristicValue;
|
|
24
24
|
Brightness!: CharacteristicValue;
|
|
25
|
+
FirmwareRevision!: CharacteristicValue;
|
|
25
26
|
ColorTemperature?: CharacteristicValue;
|
|
26
27
|
|
|
27
28
|
// OpenAPI Status
|
|
@@ -86,9 +87,9 @@ export class StripLight {
|
|
|
86
87
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
87
88
|
.setCharacteristic(this.platform.Characteristic.Model, 'W1701100')
|
|
88
89
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
89
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
90
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
|
|
90
91
|
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
91
|
-
.updateValue(this.
|
|
92
|
+
.updateValue(this.setFirmwareRevision(accessory, device));
|
|
92
93
|
|
|
93
94
|
// get the Lightbulb service if it exists, otherwise create a new Lightbulb service
|
|
94
95
|
// you can create multiple services for each accessory
|
|
@@ -275,6 +276,9 @@ export class StripLight {
|
|
|
275
276
|
this.Saturation = saturation;
|
|
276
277
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Saturation: ${this.Saturation}`);
|
|
277
278
|
}
|
|
279
|
+
|
|
280
|
+
// FirmwareRevision
|
|
281
|
+
this.FirmwareRevision = JSON.stringify(this.OpenAPI_FirmwareRevision);
|
|
278
282
|
}
|
|
279
283
|
|
|
280
284
|
/**
|
|
@@ -816,6 +820,7 @@ export class StripLight {
|
|
|
816
820
|
}
|
|
817
821
|
|
|
818
822
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
823
|
+
// On
|
|
819
824
|
if (this.On === undefined) {
|
|
820
825
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.On}`);
|
|
821
826
|
} else {
|
|
@@ -823,6 +828,7 @@ export class StripLight {
|
|
|
823
828
|
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.On, this.On);
|
|
824
829
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
|
|
825
830
|
}
|
|
831
|
+
// Brightness
|
|
826
832
|
if (this.Brightness === undefined) {
|
|
827
833
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Brightness: ${this.Brightness}`);
|
|
828
834
|
} else {
|
|
@@ -830,6 +836,7 @@ export class StripLight {
|
|
|
830
836
|
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.Brightness, this.Brightness);
|
|
831
837
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic Brightness: ${this.Brightness}`);
|
|
832
838
|
}
|
|
839
|
+
// ColorTemperature
|
|
833
840
|
if (this.ColorTemperature === undefined) {
|
|
834
841
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} ColorTemperature: ${this.ColorTemperature}`);
|
|
835
842
|
} else {
|
|
@@ -837,6 +844,7 @@ export class StripLight {
|
|
|
837
844
|
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.ColorTemperature, this.ColorTemperature);
|
|
838
845
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic ColorTemperature: ${this.ColorTemperature}`);
|
|
839
846
|
}
|
|
847
|
+
// Hue
|
|
840
848
|
if (this.Hue === undefined) {
|
|
841
849
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Hue: ${this.Hue}`);
|
|
842
850
|
} else {
|
|
@@ -844,6 +852,7 @@ export class StripLight {
|
|
|
844
852
|
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.Hue, this.Hue);
|
|
845
853
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic Hue: ${this.Hue}`);
|
|
846
854
|
}
|
|
855
|
+
// Saturation
|
|
847
856
|
if (this.Saturation === undefined) {
|
|
848
857
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Saturation: ${this.Saturation}`);
|
|
849
858
|
} else {
|
|
@@ -852,14 +861,14 @@ export class StripLight {
|
|
|
852
861
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic Saturation: ${this.Saturation}`);
|
|
853
862
|
}
|
|
854
863
|
// FirmwareRevision
|
|
855
|
-
if (this.
|
|
856
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.
|
|
864
|
+
if (this.FirmwareRevision === undefined) {
|
|
865
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
857
866
|
} else {
|
|
858
|
-
this.accessory.context.
|
|
867
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
859
868
|
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
860
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
869
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
861
870
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
862
|
-
+ `updateCharacteristic FirmwareRevision: ${this.
|
|
871
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
863
872
|
}
|
|
864
873
|
}
|
|
865
874
|
|
|
@@ -1016,23 +1025,23 @@ export class StripLight {
|
|
|
1016
1025
|
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.Saturation, e);
|
|
1017
1026
|
}
|
|
1018
1027
|
|
|
1019
|
-
|
|
1020
|
-
let FirmwareRevision: string;
|
|
1028
|
+
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
|
|
1021
1029
|
this.debugLog(
|
|
1022
1030
|
`${this.device.deviceType}: ${this.accessory.displayName} ` + `accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
1023
1031
|
);
|
|
1024
1032
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
1025
1033
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
1026
1034
|
if (device.firmware) {
|
|
1027
|
-
FirmwareRevision = device.firmware;
|
|
1035
|
+
this.FirmwareRevision = device.firmware;
|
|
1028
1036
|
} else if (device.version) {
|
|
1029
|
-
FirmwareRevision = JSON.stringify(device.version);
|
|
1037
|
+
this.FirmwareRevision = JSON.stringify(device.version);
|
|
1030
1038
|
} else if (accessory.context.FirmwareRevision) {
|
|
1031
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1039
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1032
1040
|
} else {
|
|
1033
|
-
FirmwareRevision = this.platform.version;
|
|
1041
|
+
this.FirmwareRevision = this.platform.version;
|
|
1034
1042
|
}
|
|
1035
|
-
|
|
1043
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
1044
|
+
return this.FirmwareRevision;
|
|
1036
1045
|
}
|
|
1037
1046
|
|
|
1038
1047
|
async context() {
|
package/src/device/lock.ts
CHANGED
|
@@ -18,6 +18,7 @@ export class Lock {
|
|
|
18
18
|
BatteryLevel!: CharacteristicValue;
|
|
19
19
|
LockTargetState!: CharacteristicValue;
|
|
20
20
|
LockCurrentState!: CharacteristicValue;
|
|
21
|
+
FirmwareRevision!: CharacteristicValue;
|
|
21
22
|
StatusLowBattery!: CharacteristicValue;
|
|
22
23
|
ContactSensorState!: CharacteristicValue;
|
|
23
24
|
|
|
@@ -74,9 +75,9 @@ export class Lock {
|
|
|
74
75
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
75
76
|
.setCharacteristic(this.platform.Characteristic.Model, 'W1601700')
|
|
76
77
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
77
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
78
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
|
|
78
79
|
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
79
|
-
.updateValue(this.
|
|
80
|
+
.updateValue(this.setFirmwareRevision(accessory, device));
|
|
80
81
|
|
|
81
82
|
// get the LockMechanism service if it exists, otherwise create a new LockMechanism service
|
|
82
83
|
// you can create multiple services for each accessory
|
|
@@ -235,7 +236,11 @@ export class Lock {
|
|
|
235
236
|
if (Number.isNaN(this.BatteryLevel)) {
|
|
236
237
|
this.BatteryLevel = 100;
|
|
237
238
|
}
|
|
238
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel}
|
|
239
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel},`
|
|
240
|
+
+ ` StatusLowBattery: ${this.StatusLowBattery}`);
|
|
241
|
+
|
|
242
|
+
// FirmwareRevision
|
|
243
|
+
this.FirmwareRevision = JSON.stringify(this.OpenAPI_FirmwareRevision);
|
|
239
244
|
}
|
|
240
245
|
|
|
241
246
|
/**
|
|
@@ -527,15 +532,16 @@ export class Lock {
|
|
|
527
532
|
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, this.StatusLowBattery);
|
|
528
533
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic StatusLowBattery: ${this.StatusLowBattery}`);
|
|
529
534
|
}
|
|
535
|
+
|
|
530
536
|
// FirmwareRevision
|
|
531
|
-
if (this.
|
|
532
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.
|
|
537
|
+
if (this.FirmwareRevision === undefined) {
|
|
538
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
533
539
|
} else {
|
|
534
|
-
this.accessory.context.
|
|
540
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
535
541
|
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
536
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
542
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
537
543
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
538
|
-
+ `updateCharacteristic FirmwareRevision: ${this.
|
|
544
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
539
545
|
}
|
|
540
546
|
}
|
|
541
547
|
|
|
@@ -653,23 +659,24 @@ export class Lock {
|
|
|
653
659
|
this.lockService.updateCharacteristic(this.platform.Characteristic.LockCurrentState, e);
|
|
654
660
|
}
|
|
655
661
|
|
|
656
|
-
|
|
657
|
-
|
|
662
|
+
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
|
|
663
|
+
|
|
658
664
|
this.debugLog(
|
|
659
665
|
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
660
666
|
);
|
|
661
667
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
662
668
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
663
669
|
if (device.firmware) {
|
|
664
|
-
FirmwareRevision = device.firmware;
|
|
670
|
+
this.FirmwareRevision = device.firmware;
|
|
665
671
|
} else if (device.version) {
|
|
666
|
-
FirmwareRevision = JSON.stringify(device.version);
|
|
672
|
+
this.FirmwareRevision = JSON.stringify(device.version);
|
|
667
673
|
} else if (accessory.context.FirmwareRevision) {
|
|
668
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
674
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
669
675
|
} else {
|
|
670
|
-
FirmwareRevision = this.platform.version;
|
|
676
|
+
this.FirmwareRevision = this.platform.version;
|
|
671
677
|
}
|
|
672
|
-
|
|
678
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
679
|
+
return this.FirmwareRevision;
|
|
673
680
|
}
|
|
674
681
|
|
|
675
682
|
async context() {
|
package/src/device/meter.ts
CHANGED
|
@@ -23,9 +23,10 @@ export class Meter {
|
|
|
23
23
|
|
|
24
24
|
// Characteristic Values
|
|
25
25
|
BatteryLevel!: CharacteristicValue;
|
|
26
|
+
FirmwareRevision!: CharacteristicValue;
|
|
26
27
|
StatusLowBattery!: CharacteristicValue;
|
|
27
28
|
CurrentTemperature?: CharacteristicValue;
|
|
28
|
-
CurrentRelativeHumidity
|
|
29
|
+
CurrentRelativeHumidity?: CharacteristicValue;
|
|
29
30
|
|
|
30
31
|
// OpenAPI Status
|
|
31
32
|
OpenAPI_BatteryLevel: deviceStatus['battery'];
|
|
@@ -89,9 +90,9 @@ export class Meter {
|
|
|
89
90
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
90
91
|
.setCharacteristic(this.platform.Characteristic.Model, 'METERTH-S1')
|
|
91
92
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
92
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
93
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
|
|
93
94
|
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
94
|
-
.updateValue(this.
|
|
95
|
+
.updateValue(this.setFirmwareRevision(accessory, device));
|
|
95
96
|
|
|
96
97
|
// Temperature Sensor Service
|
|
97
98
|
if (device.meter?.hide_temperature) {
|
|
@@ -145,7 +146,7 @@ export class Meter {
|
|
|
145
146
|
minStep: 0.1,
|
|
146
147
|
})
|
|
147
148
|
.onGet(() => {
|
|
148
|
-
return this.CurrentRelativeHumidity
|
|
149
|
+
return this.CurrentRelativeHumidity!;
|
|
149
150
|
});
|
|
150
151
|
} else {
|
|
151
152
|
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Humidity Sensor Service Not Added`);
|
|
@@ -193,7 +194,7 @@ export class Meter {
|
|
|
193
194
|
async BLEparseStatus(): Promise<void> {
|
|
194
195
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BLEparseStatus`);
|
|
195
196
|
|
|
196
|
-
//
|
|
197
|
+
// BatteryLevel
|
|
197
198
|
this.BatteryLevel = Number(this.BLE_BatteryLevel);
|
|
198
199
|
if (this.BatteryLevel < 15) {
|
|
199
200
|
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW;
|
|
@@ -202,13 +203,13 @@ export class Meter {
|
|
|
202
203
|
}
|
|
203
204
|
this.debugLog(`${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel}, StatusLowBattery: ${this.StatusLowBattery}`);
|
|
204
205
|
|
|
205
|
-
//
|
|
206
|
+
// CurrentRelativeHumidity
|
|
206
207
|
if (!this.device.meter?.hide_humidity) {
|
|
207
208
|
this.CurrentRelativeHumidity = this.BLE_CurrentRelativeHumidity!;
|
|
208
209
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Humidity: ${this.CurrentRelativeHumidity}%`);
|
|
209
210
|
}
|
|
210
211
|
|
|
211
|
-
//
|
|
212
|
+
// CurrentTemperature
|
|
212
213
|
if (!this.device.meter?.hide_temperature) {
|
|
213
214
|
this.BLE_Celsius < 0 ? 0 : this.BLE_Celsius > 100 ? 100 : this.BLE_Celsius;
|
|
214
215
|
this.CurrentTemperature = this.BLE_Celsius;
|
|
@@ -219,7 +220,7 @@ export class Meter {
|
|
|
219
220
|
async openAPIparseStatus(): Promise<void> {
|
|
220
221
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIparseStatus`);
|
|
221
222
|
|
|
222
|
-
//
|
|
223
|
+
// BatteryLevel
|
|
223
224
|
this.BatteryLevel = Number(this.OpenAPI_BatteryLevel);
|
|
224
225
|
if (this.BatteryLevel < 15) {
|
|
225
226
|
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW;
|
|
@@ -228,17 +229,33 @@ export class Meter {
|
|
|
228
229
|
}
|
|
229
230
|
this.debugLog(`${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel}, StatusLowBattery: ${this.StatusLowBattery}`);
|
|
230
231
|
|
|
231
|
-
//
|
|
232
|
+
// CurrentRelativeHumidity
|
|
232
233
|
if (!this.device.meter?.hide_humidity) {
|
|
233
234
|
this.CurrentRelativeHumidity = this.OpenAPI_CurrentRelativeHumidity!;
|
|
234
235
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Humidity: ${this.CurrentRelativeHumidity}%`);
|
|
235
236
|
}
|
|
236
237
|
|
|
237
|
-
//
|
|
238
|
+
// CurrentTemperature
|
|
238
239
|
if (!this.device.meter?.hide_temperature) {
|
|
239
240
|
this.CurrentTemperature = this.OpenAPI_CurrentTemperature!;
|
|
240
241
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Temperature: ${this.CurrentTemperature}°c`);
|
|
241
242
|
}
|
|
243
|
+
|
|
244
|
+
// Battery
|
|
245
|
+
this.BatteryLevel = Number(this.OpenAPI_BatteryLevel);
|
|
246
|
+
if (this.BatteryLevel < 10) {
|
|
247
|
+
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW;
|
|
248
|
+
} else {
|
|
249
|
+
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL;
|
|
250
|
+
}
|
|
251
|
+
if (Number.isNaN(this.BatteryLevel)) {
|
|
252
|
+
this.BatteryLevel = 100;
|
|
253
|
+
}
|
|
254
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel},`
|
|
255
|
+
+ ` StatusLowBattery: ${this.StatusLowBattery}`);
|
|
256
|
+
|
|
257
|
+
// FirmwareRevision
|
|
258
|
+
this.FirmwareRevision = JSON.stringify(this.OpenAPI_FirmwareRevision);
|
|
242
259
|
}
|
|
243
260
|
|
|
244
261
|
/**
|
|
@@ -369,6 +386,8 @@ export class Meter {
|
|
|
369
386
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
370
387
|
const mqttmessage: string[] = [];
|
|
371
388
|
const entry = { time: Math.round(new Date().valueOf() / 1000) };
|
|
389
|
+
|
|
390
|
+
// CurrentRelativeHumidity
|
|
372
391
|
if (!this.device.meter?.hide_humidity) {
|
|
373
392
|
if (this.CurrentRelativeHumidity === undefined) {
|
|
374
393
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
|
|
@@ -387,6 +406,7 @@ export class Meter {
|
|
|
387
406
|
}
|
|
388
407
|
}
|
|
389
408
|
}
|
|
409
|
+
// CurrentTemperature
|
|
390
410
|
if (!this.device.meter?.hide_temperature) {
|
|
391
411
|
if (this.CurrentTemperature === undefined) {
|
|
392
412
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} CurrentTemperature: ${this.CurrentTemperature}`);
|
|
@@ -402,6 +422,7 @@ export class Meter {
|
|
|
402
422
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic CurrentTemperature: ${this.CurrentTemperature}`);
|
|
403
423
|
}
|
|
404
424
|
}
|
|
425
|
+
// BatteryLevel
|
|
405
426
|
if (this.BatteryLevel === undefined) {
|
|
406
427
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel}`);
|
|
407
428
|
} else {
|
|
@@ -422,7 +443,21 @@ export class Meter {
|
|
|
422
443
|
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, this.StatusLowBattery);
|
|
423
444
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic StatusLowBattery: ${this.StatusLowBattery}`);
|
|
424
445
|
}
|
|
446
|
+
// FirmwareRevision
|
|
447
|
+
if (this.FirmwareRevision === undefined) {
|
|
448
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
449
|
+
} else {
|
|
450
|
+
if (this.device.mqttURL) {
|
|
451
|
+
mqttmessage.push(`"FirmwareRevision": ${this.FirmwareRevision}`);
|
|
452
|
+
}
|
|
453
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
454
|
+
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
455
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
456
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
457
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
458
|
+
}
|
|
425
459
|
|
|
460
|
+
// MQTT
|
|
426
461
|
if (this.device.mqttURL) {
|
|
427
462
|
this.mqttPublish(`{${mqttmessage.join(',')}}`);
|
|
428
463
|
}
|
|
@@ -432,16 +467,6 @@ export class Meter {
|
|
|
432
467
|
this.historyService?.addEntry(entry);
|
|
433
468
|
}
|
|
434
469
|
}
|
|
435
|
-
// FirmwareRevision
|
|
436
|
-
if (this.OpenAPI_FirmwareRevision === undefined) {
|
|
437
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.OpenAPI_FirmwareRevision}`);
|
|
438
|
-
} else {
|
|
439
|
-
this.accessory.context.OpenAPI_FirmwareRevision = this.OpenAPI_FirmwareRevision;
|
|
440
|
-
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
441
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.OpenAPI_FirmwareRevision);
|
|
442
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
443
|
-
+ `updateCharacteristic FirmwareRevision: ${this.OpenAPI_FirmwareRevision}`);
|
|
444
|
-
}
|
|
445
470
|
}
|
|
446
471
|
|
|
447
472
|
/*
|
|
@@ -603,23 +628,23 @@ export class Meter {
|
|
|
603
628
|
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, e);
|
|
604
629
|
}
|
|
605
630
|
|
|
606
|
-
|
|
607
|
-
let FirmwareRevision: string;
|
|
631
|
+
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
|
|
608
632
|
this.debugLog(
|
|
609
633
|
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
610
634
|
);
|
|
611
635
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
612
636
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
613
637
|
if (device.firmware) {
|
|
614
|
-
FirmwareRevision = device.firmware;
|
|
638
|
+
this.FirmwareRevision = device.firmware;
|
|
615
639
|
} else if (device.version) {
|
|
616
|
-
FirmwareRevision = JSON.stringify(device.version);
|
|
640
|
+
this.FirmwareRevision = JSON.stringify(device.version);
|
|
617
641
|
} else if (accessory.context.FirmwareRevision) {
|
|
618
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
642
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
619
643
|
} else {
|
|
620
|
-
FirmwareRevision = this.platform.version;
|
|
644
|
+
this.FirmwareRevision = this.platform.version;
|
|
621
645
|
}
|
|
622
|
-
|
|
646
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
647
|
+
return this.FirmwareRevision;
|
|
623
648
|
}
|
|
624
649
|
|
|
625
650
|
async context() {
|
package/src/device/meterplus.ts
CHANGED
|
@@ -23,9 +23,10 @@ export class MeterPlus {
|
|
|
23
23
|
|
|
24
24
|
// Characteristic Values
|
|
25
25
|
BatteryLevel!: CharacteristicValue;
|
|
26
|
+
FirmwareRevision!: CharacteristicValue;
|
|
26
27
|
StatusLowBattery!: CharacteristicValue;
|
|
27
28
|
CurrentTemperature?: CharacteristicValue;
|
|
28
|
-
CurrentRelativeHumidity
|
|
29
|
+
CurrentRelativeHumidity?: CharacteristicValue;
|
|
29
30
|
|
|
30
31
|
// OpenAPI Status
|
|
31
32
|
OpenAPI_BatteryLevel: deviceStatus['battery'];
|
|
@@ -89,9 +90,9 @@ export class MeterPlus {
|
|
|
89
90
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
90
91
|
.setCharacteristic(this.platform.Characteristic.Model, this.model(device))
|
|
91
92
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
92
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
93
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
|
|
93
94
|
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
94
|
-
.updateValue(this.
|
|
95
|
+
.updateValue(this.setFirmwareRevision(accessory, device));
|
|
95
96
|
|
|
96
97
|
// Temperature Sensor Service
|
|
97
98
|
if (device.meter?.hide_temperature) {
|
|
@@ -145,7 +146,7 @@ export class MeterPlus {
|
|
|
145
146
|
minStep: 0.1,
|
|
146
147
|
})
|
|
147
148
|
.onGet(() => {
|
|
148
|
-
return this.CurrentRelativeHumidity
|
|
149
|
+
return this.CurrentRelativeHumidity!;
|
|
149
150
|
});
|
|
150
151
|
} else {
|
|
151
152
|
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Humidity Sensor Service Not Added`);
|
|
@@ -219,7 +220,7 @@ export class MeterPlus {
|
|
|
219
220
|
async openAPIparseStatus(): Promise<void> {
|
|
220
221
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} openAPIparseStatus`);
|
|
221
222
|
|
|
222
|
-
//
|
|
223
|
+
// BatteryLevel
|
|
223
224
|
this.BatteryLevel = Number(this.OpenAPI_BatteryLevel);
|
|
224
225
|
if (this.BatteryLevel < 15) {
|
|
225
226
|
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW;
|
|
@@ -228,17 +229,33 @@ export class MeterPlus {
|
|
|
228
229
|
}
|
|
229
230
|
this.debugLog(`${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel}, StatusLowBattery: ${this.StatusLowBattery}`);
|
|
230
231
|
|
|
231
|
-
//
|
|
232
|
+
// CurrentRelativeHumidity
|
|
232
233
|
if (!this.device.meter?.hide_humidity) {
|
|
233
234
|
this.CurrentRelativeHumidity = this.OpenAPI_CurrentRelativeHumidity!;
|
|
234
235
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Humidity: ${this.CurrentRelativeHumidity}%`);
|
|
235
236
|
}
|
|
236
237
|
|
|
237
|
-
//
|
|
238
|
+
// CurrentTemperature
|
|
238
239
|
if (!this.device.meter?.hide_temperature) {
|
|
239
240
|
this.CurrentTemperature = this.OpenAPI_CurrentTemperature!;
|
|
240
241
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Temperature: ${this.CurrentTemperature}°c`);
|
|
241
242
|
}
|
|
243
|
+
|
|
244
|
+
// Battery
|
|
245
|
+
this.BatteryLevel = Number(this.OpenAPI_BatteryLevel);
|
|
246
|
+
if (this.BatteryLevel < 10) {
|
|
247
|
+
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW;
|
|
248
|
+
} else {
|
|
249
|
+
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL;
|
|
250
|
+
}
|
|
251
|
+
if (Number.isNaN(this.BatteryLevel)) {
|
|
252
|
+
this.BatteryLevel = 100;
|
|
253
|
+
}
|
|
254
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel},`
|
|
255
|
+
+ ` StatusLowBattery: ${this.StatusLowBattery}`);
|
|
256
|
+
|
|
257
|
+
// FirmwareRevision
|
|
258
|
+
this.FirmwareRevision = JSON.stringify(this.OpenAPI_FirmwareRevision);
|
|
242
259
|
}
|
|
243
260
|
|
|
244
261
|
/**
|
|
@@ -369,6 +386,8 @@ export class MeterPlus {
|
|
|
369
386
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
370
387
|
const mqttmessage: string[] = [];
|
|
371
388
|
const entry = { time: Math.round(new Date().valueOf() / 1000) };
|
|
389
|
+
|
|
390
|
+
// CurrentRelativeHumidity
|
|
372
391
|
if (!this.device.meter?.hide_humidity) {
|
|
373
392
|
if (this.CurrentRelativeHumidity === undefined) {
|
|
374
393
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
|
|
@@ -387,6 +406,7 @@ export class MeterPlus {
|
|
|
387
406
|
}
|
|
388
407
|
}
|
|
389
408
|
}
|
|
409
|
+
// CurrentTemperature
|
|
390
410
|
if (!this.device.meter?.hide_temperature) {
|
|
391
411
|
if (this.CurrentTemperature === undefined) {
|
|
392
412
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} CurrentTemperature: ${this.CurrentTemperature}`);
|
|
@@ -402,7 +422,7 @@ export class MeterPlus {
|
|
|
402
422
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic CurrentTemperature: ${this.CurrentTemperature}`);
|
|
403
423
|
}
|
|
404
424
|
}
|
|
405
|
-
|
|
425
|
+
// BatteryLevel
|
|
406
426
|
if (this.BatteryLevel === undefined) {
|
|
407
427
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel}`);
|
|
408
428
|
} else {
|
|
@@ -413,7 +433,7 @@ export class MeterPlus {
|
|
|
413
433
|
this.batteryService?.updateCharacteristic(this.platform.Characteristic.BatteryLevel, this.BatteryLevel);
|
|
414
434
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic BatteryLevel: ${this.BatteryLevel}`);
|
|
415
435
|
}
|
|
416
|
-
|
|
436
|
+
// StatusLowBattery
|
|
417
437
|
if (this.StatusLowBattery === undefined) {
|
|
418
438
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} StatusLowBattery: ${this.StatusLowBattery}`);
|
|
419
439
|
} else {
|
|
@@ -424,6 +444,21 @@ export class MeterPlus {
|
|
|
424
444
|
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, this.StatusLowBattery);
|
|
425
445
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic StatusLowBattery: ${this.StatusLowBattery}`);
|
|
426
446
|
}
|
|
447
|
+
// FirmwareRevision
|
|
448
|
+
if (this.FirmwareRevision === undefined) {
|
|
449
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
450
|
+
} else {
|
|
451
|
+
if (this.device.mqttURL) {
|
|
452
|
+
mqttmessage.push(`"FirmwareRevision": ${this.FirmwareRevision}`);
|
|
453
|
+
}
|
|
454
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
455
|
+
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
456
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
457
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
458
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
// MQTT
|
|
427
462
|
if (this.device.mqttURL) {
|
|
428
463
|
this.mqttPublish(`{${mqttmessage.join(',')}}`);
|
|
429
464
|
}
|
|
@@ -433,16 +468,6 @@ export class MeterPlus {
|
|
|
433
468
|
this.historyService?.addEntry(entry);
|
|
434
469
|
}
|
|
435
470
|
}
|
|
436
|
-
// FirmwareRevision
|
|
437
|
-
if (this.OpenAPI_FirmwareRevision === undefined) {
|
|
438
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.OpenAPI_FirmwareRevision}`);
|
|
439
|
-
} else {
|
|
440
|
-
this.accessory.context.OpenAPI_FirmwareRevision = this.OpenAPI_FirmwareRevision;
|
|
441
|
-
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
442
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.OpenAPI_FirmwareRevision);
|
|
443
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
444
|
-
+ `updateCharacteristic FirmwareRevision: ${this.OpenAPI_FirmwareRevision}`);
|
|
445
|
-
}
|
|
446
471
|
}
|
|
447
472
|
|
|
448
473
|
/*
|
|
@@ -614,23 +639,23 @@ export class MeterPlus {
|
|
|
614
639
|
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, e);
|
|
615
640
|
}
|
|
616
641
|
|
|
617
|
-
|
|
618
|
-
let FirmwareRevision: string;
|
|
642
|
+
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
|
|
619
643
|
this.debugLog(
|
|
620
644
|
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
621
645
|
);
|
|
622
646
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
623
647
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
624
648
|
if (device.firmware) {
|
|
625
|
-
FirmwareRevision = device.firmware;
|
|
649
|
+
this.FirmwareRevision = device.firmware;
|
|
626
650
|
} else if (device.version) {
|
|
627
|
-
FirmwareRevision = JSON.stringify(device.version);
|
|
651
|
+
this.FirmwareRevision = JSON.stringify(device.version);
|
|
628
652
|
} else if (accessory.context.FirmwareRevision) {
|
|
629
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
653
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
630
654
|
} else {
|
|
631
|
-
FirmwareRevision = this.platform.version;
|
|
655
|
+
this.FirmwareRevision = this.platform.version;
|
|
632
656
|
}
|
|
633
|
-
|
|
657
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
658
|
+
return this.FirmwareRevision;
|
|
634
659
|
}
|
|
635
660
|
|
|
636
661
|
async context() {
|