@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/colorbulb.ts
CHANGED
|
@@ -22,6 +22,7 @@ export class ColorBulb {
|
|
|
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
|
|
@@ -94,9 +95,9 @@ export class ColorBulb {
|
|
|
94
95
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
95
96
|
.setCharacteristic(this.platform.Characteristic.Model, 'W1401400')
|
|
96
97
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
97
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
98
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
|
|
98
99
|
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
99
|
-
.updateValue(this.
|
|
100
|
+
.updateValue(this.setFirmwareRevision(accessory, device));
|
|
100
101
|
|
|
101
102
|
// get the Lightbulb service if it exists, otherwise create a new Lightbulb service
|
|
102
103
|
// you can create multiple services for each accessory
|
|
@@ -327,6 +328,9 @@ export class ColorBulb {
|
|
|
327
328
|
this.ColorTemperature = Math.max(Math.min(this.ColorTemperature, 500), 140);
|
|
328
329
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} ColorTemperature: ${this.ColorTemperature}`);
|
|
329
330
|
}
|
|
331
|
+
|
|
332
|
+
// FirmwareRevision
|
|
333
|
+
this.FirmwareRevision = JSON.stringify(this.OpenAPI_FirmwareRevision);
|
|
330
334
|
}
|
|
331
335
|
|
|
332
336
|
/**
|
|
@@ -970,6 +974,7 @@ export class ColorBulb {
|
|
|
970
974
|
}
|
|
971
975
|
|
|
972
976
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
977
|
+
// On
|
|
973
978
|
if (this.On === undefined) {
|
|
974
979
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.On}`);
|
|
975
980
|
} else {
|
|
@@ -977,6 +982,7 @@ export class ColorBulb {
|
|
|
977
982
|
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.On, this.On);
|
|
978
983
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
|
|
979
984
|
}
|
|
985
|
+
// Brightness
|
|
980
986
|
if (this.Brightness === undefined) {
|
|
981
987
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Brightness: ${this.Brightness}`);
|
|
982
988
|
} else {
|
|
@@ -984,6 +990,7 @@ export class ColorBulb {
|
|
|
984
990
|
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.Brightness, this.Brightness);
|
|
985
991
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic Brightness: ${this.Brightness}`);
|
|
986
992
|
}
|
|
993
|
+
// ColorTemperature
|
|
987
994
|
if (this.ColorTemperature === undefined) {
|
|
988
995
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} ColorTemperature: ${this.ColorTemperature}`);
|
|
989
996
|
} else {
|
|
@@ -991,6 +998,7 @@ export class ColorBulb {
|
|
|
991
998
|
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.ColorTemperature, this.ColorTemperature);
|
|
992
999
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic ColorTemperature: ${this.ColorTemperature}`);
|
|
993
1000
|
}
|
|
1001
|
+
// Hue
|
|
994
1002
|
if (this.Hue === undefined) {
|
|
995
1003
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Hue: ${this.Hue}`);
|
|
996
1004
|
} else {
|
|
@@ -998,6 +1006,7 @@ export class ColorBulb {
|
|
|
998
1006
|
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.Hue, this.Hue);
|
|
999
1007
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic Hue: ${this.Hue}`);
|
|
1000
1008
|
}
|
|
1009
|
+
// Saturation
|
|
1001
1010
|
if (this.Saturation === undefined) {
|
|
1002
1011
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Saturation: ${this.Saturation}`);
|
|
1003
1012
|
} else {
|
|
@@ -1006,14 +1015,14 @@ export class ColorBulb {
|
|
|
1006
1015
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic Saturation: ${this.Saturation}`);
|
|
1007
1016
|
}
|
|
1008
1017
|
// FirmwareRevision
|
|
1009
|
-
if (this.
|
|
1010
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.
|
|
1018
|
+
if (this.FirmwareRevision === undefined) {
|
|
1019
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1011
1020
|
} else {
|
|
1012
|
-
this.accessory.context.
|
|
1021
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
1013
1022
|
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
1014
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
1023
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
1015
1024
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
1016
|
-
+ `updateCharacteristic FirmwareRevision: ${this.
|
|
1025
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1017
1026
|
}
|
|
1018
1027
|
}
|
|
1019
1028
|
|
|
@@ -1171,23 +1180,23 @@ export class ColorBulb {
|
|
|
1171
1180
|
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.ColorTemperature, e);
|
|
1172
1181
|
}
|
|
1173
1182
|
|
|
1174
|
-
|
|
1175
|
-
let FirmwareRevision: string;
|
|
1183
|
+
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
|
|
1176
1184
|
this.debugLog(
|
|
1177
1185
|
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
1178
1186
|
);
|
|
1179
1187
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
1180
1188
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
1181
1189
|
if (device.firmware) {
|
|
1182
|
-
FirmwareRevision = device.firmware;
|
|
1190
|
+
this.FirmwareRevision = device.firmware;
|
|
1183
1191
|
} else if (device.version) {
|
|
1184
|
-
FirmwareRevision = JSON.stringify(device.version);
|
|
1192
|
+
this.FirmwareRevision = JSON.stringify(device.version);
|
|
1185
1193
|
} if (accessory.context.FirmwareRevision) {
|
|
1186
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1194
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1187
1195
|
} else {
|
|
1188
|
-
FirmwareRevision = this.platform.version;
|
|
1196
|
+
this.FirmwareRevision = this.platform.version;
|
|
1189
1197
|
}
|
|
1190
|
-
|
|
1198
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
1199
|
+
return this.FirmwareRevision;
|
|
1191
1200
|
}
|
|
1192
1201
|
|
|
1193
1202
|
async context() {
|
package/src/device/contact.ts
CHANGED
|
@@ -23,6 +23,7 @@ export class Contact {
|
|
|
23
23
|
BatteryLevel!: CharacteristicValue;
|
|
24
24
|
MotionDetected!: CharacteristicValue;
|
|
25
25
|
StatusLowBattery!: CharacteristicValue;
|
|
26
|
+
FirmwareRevision!: CharacteristicValue;
|
|
26
27
|
ContactSensorState!: CharacteristicValue;
|
|
27
28
|
CurrentAmbientLightLevel!: CharacteristicValue;
|
|
28
29
|
|
|
@@ -83,9 +84,9 @@ export class Contact {
|
|
|
83
84
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
84
85
|
.setCharacteristic(this.platform.Characteristic.Model, 'W1201500')
|
|
85
86
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
86
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
87
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
|
|
87
88
|
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
88
|
-
.updateValue(this.
|
|
89
|
+
.updateValue(this.setFirmwareRevision(accessory, device));
|
|
89
90
|
|
|
90
91
|
// get the Contact service if it exists, otherwise create a new Contact service
|
|
91
92
|
// you can create multiple services for each accessory
|
|
@@ -279,6 +280,9 @@ export class Contact {
|
|
|
279
280
|
this.debugLog(
|
|
280
281
|
`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel}, ` + `StatusLowBattery: ${this.StatusLowBattery}`,
|
|
281
282
|
);
|
|
283
|
+
|
|
284
|
+
// FirmwareRevision
|
|
285
|
+
this.FirmwareRevision = JSON.stringify(this.OpenAPI_FirmwareRevision);
|
|
282
286
|
}
|
|
283
287
|
|
|
284
288
|
/**
|
|
@@ -450,15 +454,16 @@ export class Contact {
|
|
|
450
454
|
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, this.StatusLowBattery);
|
|
451
455
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic StatusLowBattery: ${this.StatusLowBattery}`);
|
|
452
456
|
}
|
|
457
|
+
|
|
453
458
|
// FirmwareRevision
|
|
454
|
-
if (this.
|
|
455
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.
|
|
459
|
+
if (this.FirmwareRevision === undefined) {
|
|
460
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
456
461
|
} else {
|
|
457
|
-
this.accessory.context.
|
|
462
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
458
463
|
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
459
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
464
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
460
465
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
461
|
-
+ `updateCharacteristic FirmwareRevision: ${this.
|
|
466
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
462
467
|
}
|
|
463
468
|
}
|
|
464
469
|
|
|
@@ -591,23 +596,24 @@ export class Contact {
|
|
|
591
596
|
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, e);
|
|
592
597
|
}
|
|
593
598
|
|
|
594
|
-
|
|
595
|
-
|
|
599
|
+
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
|
|
600
|
+
|
|
596
601
|
this.debugLog(
|
|
597
602
|
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
598
603
|
);
|
|
599
604
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
600
605
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
601
606
|
if (device.firmware) {
|
|
602
|
-
FirmwareRevision = device.firmware;
|
|
607
|
+
this.FirmwareRevision = device.firmware;
|
|
603
608
|
} else if (device.version) {
|
|
604
|
-
FirmwareRevision = JSON.stringify(device.version);
|
|
609
|
+
this.FirmwareRevision = JSON.stringify(device.version);
|
|
605
610
|
} else if (accessory.context.FirmwareRevision) {
|
|
606
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
611
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
607
612
|
} else {
|
|
608
|
-
FirmwareRevision = this.platform.version;
|
|
613
|
+
this.FirmwareRevision = this.platform.version;
|
|
609
614
|
}
|
|
610
|
-
|
|
615
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
616
|
+
return this.FirmwareRevision;
|
|
611
617
|
}
|
|
612
618
|
|
|
613
619
|
async context() {
|
package/src/device/curtain.ts
CHANGED
|
@@ -14,19 +14,20 @@ export class Curtain {
|
|
|
14
14
|
// Services
|
|
15
15
|
batteryService: Service;
|
|
16
16
|
lightSensorService?: Service;
|
|
17
|
-
windowCoveringService
|
|
17
|
+
windowCoveringService!: Service;
|
|
18
18
|
|
|
19
19
|
// Characteristic Values
|
|
20
20
|
BatteryLevel!: CharacteristicValue;
|
|
21
21
|
PositionState!: CharacteristicValue;
|
|
22
22
|
TargetPosition!: CharacteristicValue;
|
|
23
23
|
CurrentPosition!: CharacteristicValue;
|
|
24
|
+
FirmwareRevision!: CharacteristicValue;
|
|
24
25
|
StatusLowBattery!: CharacteristicValue;
|
|
25
26
|
CurrentAmbientLightLevel?: CharacteristicValue;
|
|
26
27
|
|
|
27
28
|
// OpenAPI Status
|
|
28
29
|
OpenAPI_InMotion: deviceStatus['moving'];
|
|
29
|
-
|
|
30
|
+
OpenAPI_BatteryLevel: deviceStatus['battery'];
|
|
30
31
|
OpenAPI_FirmwareRevision: deviceStatus['version'];
|
|
31
32
|
OpenAPI_CurrentPosition: deviceStatus['slidePosition'];
|
|
32
33
|
OpenAPI_CurrentAmbientLightLevel: deviceStatus['brightness'];
|
|
@@ -36,8 +37,8 @@ export class Curtain {
|
|
|
36
37
|
setPositionMode?: string | number;
|
|
37
38
|
|
|
38
39
|
// BLE Status
|
|
39
|
-
BLE_Battery: serviceData['battery'];
|
|
40
40
|
BLE_InMotion: serviceData['inMotion'];
|
|
41
|
+
BLE_BatteryLevel: serviceData['battery'];
|
|
41
42
|
BLE_Calibration: serviceData['calibration'];
|
|
42
43
|
BLE_CurrentPosition: serviceData['position'];
|
|
43
44
|
BLE_CurrentAmbientLightLevel: serviceData['lightLevel'];
|
|
@@ -102,9 +103,9 @@ export class Curtain {
|
|
|
102
103
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
103
104
|
.setCharacteristic(this.platform.Characteristic.Model, 'W0701600')
|
|
104
105
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId)
|
|
105
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
106
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
|
|
106
107
|
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
107
|
-
.updateValue(this.
|
|
108
|
+
.updateValue(this.setFirmwareRevision(accessory, device));
|
|
108
109
|
|
|
109
110
|
// get the WindowCovering service if it exists, otherwise create a new WindowCovering service
|
|
110
111
|
// you can create multiple services for each accessory
|
|
@@ -391,7 +392,7 @@ export class Curtain {
|
|
|
391
392
|
);
|
|
392
393
|
}
|
|
393
394
|
// Battery
|
|
394
|
-
this.BatteryLevel = Number(this.
|
|
395
|
+
this.BatteryLevel = Number(this.BLE_BatteryLevel);
|
|
395
396
|
if (this.BatteryLevel < 10) {
|
|
396
397
|
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW;
|
|
397
398
|
} else {
|
|
@@ -441,10 +442,10 @@ export class Curtain {
|
|
|
441
442
|
` TargetPosition: ${this.TargetPosition}, PositionState: ${this.PositionState},`,
|
|
442
443
|
);
|
|
443
444
|
|
|
445
|
+
// Brightness
|
|
444
446
|
if (!this.device.curtain?.hide_lightsensor) {
|
|
445
447
|
this.set_minLux = this.minLux();
|
|
446
448
|
this.set_maxLux = this.maxLux();
|
|
447
|
-
// Brightness
|
|
448
449
|
switch (this.OpenAPI_CurrentAmbientLightLevel) {
|
|
449
450
|
case 'dim':
|
|
450
451
|
this.CurrentAmbientLightLevel = this.set_minLux;
|
|
@@ -455,6 +456,22 @@ export class Curtain {
|
|
|
455
456
|
}
|
|
456
457
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} CurrentAmbientLightLevel: ${this.CurrentAmbientLightLevel}`);
|
|
457
458
|
}
|
|
459
|
+
|
|
460
|
+
// BatteryLevel
|
|
461
|
+
this.BatteryLevel = Number(this.OpenAPI_BatteryLevel);
|
|
462
|
+
if (this.BatteryLevel < 10) {
|
|
463
|
+
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW;
|
|
464
|
+
} else {
|
|
465
|
+
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL;
|
|
466
|
+
}
|
|
467
|
+
if (Number.isNaN(this.BatteryLevel)) {
|
|
468
|
+
this.BatteryLevel = 100;
|
|
469
|
+
}
|
|
470
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel},`
|
|
471
|
+
+ ` StatusLowBattery: ${this.StatusLowBattery}`);
|
|
472
|
+
|
|
473
|
+
// FirmwareRevision
|
|
474
|
+
this.FirmwareRevision = JSON.stringify(this.OpenAPI_FirmwareRevision);
|
|
458
475
|
}
|
|
459
476
|
|
|
460
477
|
async refreshStatus(): Promise<void> {
|
|
@@ -498,7 +515,7 @@ export class Curtain {
|
|
|
498
515
|
` BLE Address Found: ${ad.address}`,
|
|
499
516
|
);
|
|
500
517
|
this.BLE_Calibration = ad.serviceData.calibration;
|
|
501
|
-
this.
|
|
518
|
+
this.BLE_BatteryLevel = ad.serviceData.battery;
|
|
502
519
|
this.BLE_InMotion = ad.serviceData.inMotion;
|
|
503
520
|
this.BLE_CurrentPosition = ad.serviceData.position;
|
|
504
521
|
this.BLE_CurrentAmbientLightLevel = ad.serviceData.lightLevel;
|
|
@@ -557,7 +574,7 @@ export class Curtain {
|
|
|
557
574
|
this.OpenAPI_CurrentPosition = deviceStatus.body.slidePosition;
|
|
558
575
|
this.OpenAPI_InMotion = deviceStatus.body.moving;
|
|
559
576
|
this.OpenAPI_CurrentAmbientLightLevel = deviceStatus.body.brightness;
|
|
560
|
-
this.
|
|
577
|
+
this.OpenAPI_BatteryLevel = deviceStatus.body.battery;
|
|
561
578
|
this.OpenAPI_FirmwareRevision = deviceStatus.body.version;
|
|
562
579
|
this.openAPIparseStatus();
|
|
563
580
|
this.updateHomeKitCharacteristics();
|
|
@@ -849,14 +866,17 @@ export class Curtain {
|
|
|
849
866
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic StatusLowBattery: ${this.StatusLowBattery}`);
|
|
850
867
|
}
|
|
851
868
|
// FirmwareRevision
|
|
852
|
-
if (this.
|
|
853
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.
|
|
869
|
+
if (this.FirmwareRevision === undefined) {
|
|
870
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
854
871
|
} else {
|
|
855
|
-
this.
|
|
872
|
+
if (this.device.mqttURL) {
|
|
873
|
+
this.mqttPublish('FirmwareRevision', this.FirmwareRevision);
|
|
874
|
+
}
|
|
875
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
856
876
|
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
857
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
877
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
858
878
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
859
|
-
+ `updateCharacteristic FirmwareRevision: ${this.
|
|
879
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
860
880
|
}
|
|
861
881
|
}
|
|
862
882
|
|
|
@@ -1089,23 +1109,23 @@ export class Curtain {
|
|
|
1089
1109
|
//throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
|
|
1090
1110
|
}
|
|
1091
1111
|
|
|
1092
|
-
|
|
1093
|
-
let FirmwareRevision: string;
|
|
1112
|
+
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
|
|
1094
1113
|
this.debugLog(
|
|
1095
1114
|
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
1096
1115
|
);
|
|
1097
1116
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
1098
1117
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
1099
1118
|
if (device.firmware) {
|
|
1100
|
-
FirmwareRevision = device.firmware;
|
|
1119
|
+
this.FirmwareRevision = device.firmware;
|
|
1101
1120
|
} else if (device.version) {
|
|
1102
|
-
FirmwareRevision = JSON.stringify(device.version);
|
|
1121
|
+
this.FirmwareRevision = JSON.stringify(device.version);
|
|
1103
1122
|
} if (accessory.context.FirmwareRevision) {
|
|
1104
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1123
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1105
1124
|
} else {
|
|
1106
|
-
FirmwareRevision = this.platform.version;
|
|
1125
|
+
this.FirmwareRevision = this.platform.version;
|
|
1107
1126
|
}
|
|
1108
|
-
|
|
1127
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
1128
|
+
return this.FirmwareRevision;
|
|
1109
1129
|
}
|
|
1110
1130
|
|
|
1111
1131
|
async context() {
|
package/src/device/hub.ts
CHANGED
|
@@ -13,6 +13,7 @@ export class Hub {
|
|
|
13
13
|
temperatureService?: Service;
|
|
14
14
|
|
|
15
15
|
// Characteristic Values
|
|
16
|
+
FirmwareRevision!: CharacteristicValue;
|
|
16
17
|
CurrentTemperature!: CharacteristicValue;
|
|
17
18
|
CurrentRelativeHumidity!: CharacteristicValue;
|
|
18
19
|
CurrentAmbientLightLevel!: CharacteristicValue;
|
|
@@ -61,9 +62,9 @@ export class Hub {
|
|
|
61
62
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
62
63
|
.setCharacteristic(this.platform.Characteristic.Model, accessory.context.model)
|
|
63
64
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId)
|
|
64
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
65
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
|
|
65
66
|
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
66
|
-
.updateValue(this.
|
|
67
|
+
.updateValue(this.setFirmwareRevision(accessory, device));
|
|
67
68
|
|
|
68
69
|
// Temperature Sensor Service
|
|
69
70
|
if (device.hub?.hide_temperature) {
|
|
@@ -275,6 +276,9 @@ export class Hub {
|
|
|
275
276
|
this.lightSensorService?.setCharacteristic(this.platform.Characteristic.CurrentAmbientLightLevel, this.CurrentAmbientLightLevel);
|
|
276
277
|
}
|
|
277
278
|
}
|
|
279
|
+
|
|
280
|
+
// FirmwareRevision
|
|
281
|
+
this.FirmwareRevision = JSON.stringify(this.OpenAPI_FirmwareRevision);
|
|
278
282
|
}
|
|
279
283
|
|
|
280
284
|
async refreshStatus(): Promise<void> {
|
|
@@ -378,15 +382,16 @@ export class Hub {
|
|
|
378
382
|
);
|
|
379
383
|
}
|
|
380
384
|
}
|
|
385
|
+
|
|
381
386
|
// FirmwareRevision
|
|
382
|
-
if (this.
|
|
383
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.
|
|
387
|
+
if (this.FirmwareRevision === undefined) {
|
|
388
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
384
389
|
} else {
|
|
385
|
-
this.accessory.context.
|
|
390
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
386
391
|
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
387
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
392
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
388
393
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
389
|
-
+ `updateCharacteristic FirmwareRevision: ${this.
|
|
394
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
390
395
|
}
|
|
391
396
|
}
|
|
392
397
|
|
|
@@ -468,23 +473,24 @@ export class Hub {
|
|
|
468
473
|
return this.set_maxLux;
|
|
469
474
|
}
|
|
470
475
|
|
|
471
|
-
|
|
472
|
-
|
|
476
|
+
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
|
|
477
|
+
|
|
473
478
|
this.debugLog(
|
|
474
479
|
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
475
480
|
);
|
|
476
481
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
477
482
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
478
483
|
if (device.firmware) {
|
|
479
|
-
FirmwareRevision = device.firmware;
|
|
484
|
+
this.FirmwareRevision = device.firmware;
|
|
480
485
|
} else if (device.version) {
|
|
481
|
-
FirmwareRevision = JSON.stringify(device.version);
|
|
486
|
+
this.FirmwareRevision = JSON.stringify(device.version);
|
|
482
487
|
} else if (accessory.context.FirmwareRevision) {
|
|
483
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
488
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
484
489
|
} else {
|
|
485
|
-
FirmwareRevision = this.platform.version;
|
|
490
|
+
this.FirmwareRevision = this.platform.version;
|
|
486
491
|
}
|
|
487
|
-
|
|
492
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
493
|
+
return this.FirmwareRevision;
|
|
488
494
|
}
|
|
489
495
|
|
|
490
496
|
async refreshRate(device: device & devicesConfig): Promise<void> {
|
package/src/device/humidifier.ts
CHANGED
|
@@ -19,13 +19,14 @@ export class Humidifier {
|
|
|
19
19
|
temperatureservice?: Service;
|
|
20
20
|
|
|
21
21
|
// Characteristic Values
|
|
22
|
-
|
|
22
|
+
Active!: CharacteristicValue;
|
|
23
|
+
WaterLevel!: CharacteristicValue;
|
|
24
|
+
FirmwareRevision!: CharacteristicValue;
|
|
23
25
|
CurrentTemperature!: CharacteristicValue;
|
|
26
|
+
CurrentRelativeHumidity!: CharacteristicValue;
|
|
24
27
|
TargetHumidifierDehumidifierState!: CharacteristicValue;
|
|
25
28
|
CurrentHumidifierDehumidifierState!: CharacteristicValue;
|
|
26
29
|
RelativeHumidityHumidifierThreshold!: CharacteristicValue;
|
|
27
|
-
Active!: CharacteristicValue;
|
|
28
|
-
WaterLevel!: CharacteristicValue;
|
|
29
30
|
|
|
30
31
|
// OpenAPI
|
|
31
32
|
OpenAPI_Active: deviceStatus['power'];
|
|
@@ -81,9 +82,9 @@ export class Humidifier {
|
|
|
81
82
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
82
83
|
.setCharacteristic(this.platform.Characteristic.Model, 'W0801800')
|
|
83
84
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
84
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
85
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
|
|
85
86
|
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
86
|
-
.updateValue(this.
|
|
87
|
+
.updateValue(this.setFirmwareRevision(accessory, device));
|
|
87
88
|
|
|
88
89
|
// get the service if it exists, otherwise create a new service
|
|
89
90
|
// you can create multiple services for each accessory
|
|
@@ -280,6 +281,9 @@ export class Humidifier {
|
|
|
280
281
|
this.WaterLevel = 100;
|
|
281
282
|
}
|
|
282
283
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} WaterLevel: ${this.WaterLevel}`);
|
|
284
|
+
|
|
285
|
+
// FirmwareRevision
|
|
286
|
+
this.FirmwareRevision = JSON.stringify(this.OpenAPI_FirmwareRevision);
|
|
283
287
|
}
|
|
284
288
|
|
|
285
289
|
/**
|
|
@@ -733,15 +737,16 @@ export class Humidifier {
|
|
|
733
737
|
this.accessory.context.CurrentTemperature = this.CurrentTemperature;
|
|
734
738
|
}
|
|
735
739
|
}
|
|
740
|
+
|
|
736
741
|
// FirmwareRevision
|
|
737
|
-
if (this.
|
|
738
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.
|
|
742
|
+
if (this.FirmwareRevision === undefined) {
|
|
743
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
739
744
|
} else {
|
|
740
|
-
this.accessory.context.
|
|
745
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
741
746
|
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
742
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
747
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
743
748
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
744
|
-
+ `updateCharacteristic FirmwareRevision: ${this.
|
|
749
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
745
750
|
}
|
|
746
751
|
}
|
|
747
752
|
|
|
@@ -878,23 +883,24 @@ export class Humidifier {
|
|
|
878
883
|
}
|
|
879
884
|
}
|
|
880
885
|
|
|
881
|
-
|
|
882
|
-
|
|
886
|
+
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
|
|
887
|
+
|
|
883
888
|
this.debugLog(
|
|
884
889
|
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
885
890
|
);
|
|
886
891
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
887
892
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
888
893
|
if (device.firmware) {
|
|
889
|
-
FirmwareRevision = device.firmware;
|
|
894
|
+
this.FirmwareRevision = device.firmware;
|
|
890
895
|
} else if (device.version) {
|
|
891
|
-
FirmwareRevision = JSON.stringify(device.version);
|
|
896
|
+
this.FirmwareRevision = JSON.stringify(device.version);
|
|
892
897
|
} else if (accessory.context.FirmwareRevision) {
|
|
893
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
898
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
894
899
|
} else {
|
|
895
|
-
FirmwareRevision = this.platform.version;
|
|
900
|
+
this.FirmwareRevision = this.platform.version;
|
|
896
901
|
}
|
|
897
|
-
|
|
902
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
903
|
+
return this.FirmwareRevision;
|
|
898
904
|
}
|
|
899
905
|
|
|
900
906
|
async context() {
|
package/src/device/iosensor.ts
CHANGED
|
@@ -24,6 +24,7 @@ export class IOSensor {
|
|
|
24
24
|
// Characteristic Values
|
|
25
25
|
BatteryLevel!: CharacteristicValue;
|
|
26
26
|
StatusLowBattery!: CharacteristicValue;
|
|
27
|
+
FirmwareRevision!: CharacteristicValue;
|
|
27
28
|
CurrentTemperature?: CharacteristicValue;
|
|
28
29
|
CurrentRelativeHumidity!: CharacteristicValue;
|
|
29
30
|
|
|
@@ -89,9 +90,9 @@ export class IOSensor {
|
|
|
89
90
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
90
91
|
.setCharacteristic(this.platform.Characteristic.Model, 'WoIOSensor')
|
|
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) {
|
|
@@ -238,6 +239,22 @@ export class IOSensor {
|
|
|
238
239
|
this.CurrentTemperature = this.OpenAPI_CurrentTemperature!;
|
|
239
240
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Temperature: ${this.CurrentTemperature}°c`);
|
|
240
241
|
}
|
|
242
|
+
|
|
243
|
+
// BatteryLevel
|
|
244
|
+
this.BatteryLevel = Number(this.OpenAPI_BatteryLevel);
|
|
245
|
+
if (this.BatteryLevel < 10) {
|
|
246
|
+
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW;
|
|
247
|
+
} else {
|
|
248
|
+
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL;
|
|
249
|
+
}
|
|
250
|
+
if (Number.isNaN(this.BatteryLevel)) {
|
|
251
|
+
this.BatteryLevel = 100;
|
|
252
|
+
}
|
|
253
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel},`
|
|
254
|
+
+ ` StatusLowBattery: ${this.StatusLowBattery}`);
|
|
255
|
+
|
|
256
|
+
// FirmwareRevision
|
|
257
|
+
this.FirmwareRevision = JSON.stringify(this.OpenAPI_FirmwareRevision);
|
|
241
258
|
}
|
|
242
259
|
|
|
243
260
|
/**
|
|
@@ -430,15 +447,16 @@ export class IOSensor {
|
|
|
430
447
|
this.historyService?.addEntry(entry);
|
|
431
448
|
}
|
|
432
449
|
}
|
|
450
|
+
|
|
433
451
|
// FirmwareRevision
|
|
434
|
-
if (this.
|
|
435
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.
|
|
452
|
+
if (this.FirmwareRevision === undefined) {
|
|
453
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
436
454
|
} else {
|
|
437
|
-
this.accessory.context.
|
|
455
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
438
456
|
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
439
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
457
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
440
458
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
441
|
-
+ `updateCharacteristic FirmwareRevision: ${this.
|
|
459
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
442
460
|
}
|
|
443
461
|
}
|
|
444
462
|
|
|
@@ -601,23 +619,24 @@ export class IOSensor {
|
|
|
601
619
|
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, e);
|
|
602
620
|
}
|
|
603
621
|
|
|
604
|
-
|
|
605
|
-
|
|
622
|
+
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
|
|
623
|
+
|
|
606
624
|
this.debugLog(
|
|
607
625
|
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
608
626
|
);
|
|
609
627
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
610
628
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
611
629
|
if (device.firmware) {
|
|
612
|
-
FirmwareRevision = device.firmware;
|
|
630
|
+
this.FirmwareRevision = device.firmware;
|
|
613
631
|
} else if (device.version) {
|
|
614
|
-
FirmwareRevision = JSON.stringify(device.version);
|
|
632
|
+
this.FirmwareRevision = JSON.stringify(device.version);
|
|
615
633
|
} else if (accessory.context.FirmwareRevision) {
|
|
616
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
634
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
617
635
|
} else {
|
|
618
|
-
FirmwareRevision = this.platform.version;
|
|
636
|
+
this.FirmwareRevision = this.platform.version;
|
|
619
637
|
}
|
|
620
|
-
|
|
638
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
639
|
+
return this.FirmwareRevision;
|
|
621
640
|
}
|
|
622
641
|
|
|
623
642
|
async context() {
|