@switchbot/homebridge-switchbot 2.8.2-beta.0 → 2.8.2-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +26 -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 +19 -15
- 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 +2 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +19 -14
- 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 +16 -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 +16 -14
- 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 +35 -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 +33 -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 +16 -14
- 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 +2 -2
- package/src/device/blindtilt.ts +28 -16
- package/src/device/bot.ts +21 -15
- 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 +22 -15
- package/src/device/hub.ts +20 -14
- package/src/device/humidifier.ts +23 -17
- package/src/device/iosensor.ts +20 -14
- package/src/device/lightstrip.ts +23 -14
- package/src/device/lock.ts +20 -14
- package/src/device/meter.ts +39 -27
- package/src/device/meterplus.ts +38 -26
- package/src/device/motion.ts +24 -23
- 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/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,13 +14,14 @@ 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
|
|
|
@@ -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
|
|
@@ -455,6 +456,9 @@ export class Curtain {
|
|
|
455
456
|
}
|
|
456
457
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} CurrentAmbientLightLevel: ${this.CurrentAmbientLightLevel}`);
|
|
457
458
|
}
|
|
459
|
+
|
|
460
|
+
// FirmwareRevision
|
|
461
|
+
this.FirmwareRevision = JSON.stringify(this.OpenAPI_FirmwareRevision);
|
|
458
462
|
}
|
|
459
463
|
|
|
460
464
|
async refreshStatus(): Promise<void> {
|
|
@@ -849,14 +853,17 @@ export class Curtain {
|
|
|
849
853
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic StatusLowBattery: ${this.StatusLowBattery}`);
|
|
850
854
|
}
|
|
851
855
|
// FirmwareRevision
|
|
852
|
-
if (this.
|
|
853
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.
|
|
856
|
+
if (this.FirmwareRevision === undefined) {
|
|
857
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
854
858
|
} else {
|
|
855
|
-
this.
|
|
859
|
+
if (this.device.mqttURL) {
|
|
860
|
+
this.mqttPublish('FirmwareRevision', this.FirmwareRevision);
|
|
861
|
+
}
|
|
862
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
856
863
|
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
857
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
864
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
858
865
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
859
|
-
+ `updateCharacteristic FirmwareRevision: ${this.
|
|
866
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
860
867
|
}
|
|
861
868
|
}
|
|
862
869
|
|
|
@@ -1089,23 +1096,23 @@ export class Curtain {
|
|
|
1089
1096
|
//throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
|
|
1090
1097
|
}
|
|
1091
1098
|
|
|
1092
|
-
|
|
1093
|
-
let FirmwareRevision: string;
|
|
1099
|
+
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
|
|
1094
1100
|
this.debugLog(
|
|
1095
1101
|
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
1096
1102
|
);
|
|
1097
1103
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
1098
1104
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
1099
1105
|
if (device.firmware) {
|
|
1100
|
-
FirmwareRevision = device.firmware;
|
|
1106
|
+
this.FirmwareRevision = device.firmware;
|
|
1101
1107
|
} else if (device.version) {
|
|
1102
|
-
FirmwareRevision = JSON.stringify(device.version);
|
|
1108
|
+
this.FirmwareRevision = JSON.stringify(device.version);
|
|
1103
1109
|
} if (accessory.context.FirmwareRevision) {
|
|
1104
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1110
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1105
1111
|
} else {
|
|
1106
|
-
FirmwareRevision = this.platform.version;
|
|
1112
|
+
this.FirmwareRevision = this.platform.version;
|
|
1107
1113
|
}
|
|
1108
|
-
|
|
1114
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
1115
|
+
return this.FirmwareRevision;
|
|
1109
1116
|
}
|
|
1110
1117
|
|
|
1111
1118
|
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,9 @@ 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
|
+
// FirmwareRevision
|
|
244
|
+
this.FirmwareRevision = JSON.stringify(this.OpenAPI_FirmwareRevision);
|
|
241
245
|
}
|
|
242
246
|
|
|
243
247
|
/**
|
|
@@ -430,15 +434,16 @@ export class IOSensor {
|
|
|
430
434
|
this.historyService?.addEntry(entry);
|
|
431
435
|
}
|
|
432
436
|
}
|
|
437
|
+
|
|
433
438
|
// FirmwareRevision
|
|
434
|
-
if (this.
|
|
435
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.
|
|
439
|
+
if (this.FirmwareRevision === undefined) {
|
|
440
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
436
441
|
} else {
|
|
437
|
-
this.accessory.context.
|
|
442
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
438
443
|
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
439
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
444
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
440
445
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
441
|
-
+ `updateCharacteristic FirmwareRevision: ${this.
|
|
446
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
442
447
|
}
|
|
443
448
|
}
|
|
444
449
|
|
|
@@ -601,23 +606,24 @@ export class IOSensor {
|
|
|
601
606
|
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, e);
|
|
602
607
|
}
|
|
603
608
|
|
|
604
|
-
|
|
605
|
-
|
|
609
|
+
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
|
|
610
|
+
|
|
606
611
|
this.debugLog(
|
|
607
612
|
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
608
613
|
);
|
|
609
614
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
610
615
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
611
616
|
if (device.firmware) {
|
|
612
|
-
FirmwareRevision = device.firmware;
|
|
617
|
+
this.FirmwareRevision = device.firmware;
|
|
613
618
|
} else if (device.version) {
|
|
614
|
-
FirmwareRevision = JSON.stringify(device.version);
|
|
619
|
+
this.FirmwareRevision = JSON.stringify(device.version);
|
|
615
620
|
} else if (accessory.context.FirmwareRevision) {
|
|
616
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
621
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
617
622
|
} else {
|
|
618
|
-
FirmwareRevision = this.platform.version;
|
|
623
|
+
this.FirmwareRevision = this.platform.version;
|
|
619
624
|
}
|
|
620
|
-
|
|
625
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
626
|
+
return this.FirmwareRevision;
|
|
621
627
|
}
|
|
622
628
|
|
|
623
629
|
async context() {
|