@switchbot/homebridge-switchbot 2.9.0-beta.17 → 2.9.0-beta.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/device/blindtilt.d.ts +1 -1
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +38 -17
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +1 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +64 -17
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +1 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +34 -17
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.js +1 -1
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +1 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +41 -17
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +38 -17
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/hub.d.ts +1 -1
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +42 -17
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +37 -17
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts +1 -1
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +40 -17
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts +1 -1
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +34 -17
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts +1 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +38 -17
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +1 -1
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +40 -17
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +3 -3
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +60 -37
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +1 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +38 -17
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +1 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +35 -17
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts +1 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +35 -17
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +1 -1
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +28 -14
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +1 -1
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +28 -14
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +1 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +28 -14
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +1 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +28 -14
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts +1 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +28 -14
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +1 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +28 -14
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +1 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +28 -14
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +28 -14
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +1 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +28 -14
- package/dist/irdevice/waterheater.js.map +1 -1
- package/package.json +1 -1
- package/src/device/blindtilt.ts +38 -18
- package/src/device/bot.ts +55 -18
- package/src/device/ceilinglight.ts +34 -19
- package/src/device/colorbulb.ts +1 -1
- package/src/device/contact.ts +41 -19
- package/src/device/curtain.ts +38 -18
- package/src/device/hub.ts +43 -19
- package/src/device/humidifier.ts +37 -19
- package/src/device/iosensor.ts +40 -19
- package/src/device/lightstrip.ts +34 -18
- package/src/device/lock.ts +39 -20
- package/src/device/meter.ts +40 -18
- package/src/device/meterplus.ts +63 -40
- package/src/device/motion.ts +38 -20
- package/src/device/plug.ts +35 -19
- package/src/device/robotvacuumcleaner.ts +35 -18
- package/src/irdevice/airconditioner.ts +28 -15
- package/src/irdevice/airpurifier.ts +30 -15
- package/src/irdevice/camera.ts +30 -15
- package/src/irdevice/fan.ts +30 -15
- package/src/irdevice/light.ts +30 -15
- package/src/irdevice/other.ts +30 -15
- package/src/irdevice/tv.ts +30 -15
- package/src/irdevice/vacuumcleaner.ts +30 -15
- package/src/irdevice/waterheater.ts +30 -15
package/src/device/bot.ts
CHANGED
|
@@ -94,10 +94,20 @@ export class Bot {
|
|
|
94
94
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
95
95
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
96
96
|
.setCharacteristic(this.platform.Characteristic.Model, 'SWITCHBOT-BOT-S1')
|
|
97
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
.
|
|
97
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
98
|
+
|
|
99
|
+
if (accessory.context.FirmwareRevision) {
|
|
100
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
|
|
101
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
102
|
+
accessory
|
|
103
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
104
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
105
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
106
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
107
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
108
|
+
} else {
|
|
109
|
+
this.setFirmwareRevision(accessory, device);
|
|
110
|
+
}
|
|
101
111
|
|
|
102
112
|
// deviceType
|
|
103
113
|
if (this.botDeviceType === 'switch') {
|
|
@@ -1037,8 +1047,28 @@ export class Bot {
|
|
|
1037
1047
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1038
1048
|
} else {
|
|
1039
1049
|
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
1040
|
-
this.
|
|
1041
|
-
|
|
1050
|
+
this.batteryService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
1051
|
+
if (this.botDeviceType === 'garagedoor') {
|
|
1052
|
+
this.garageDoorService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
1053
|
+
} else if (this.botDeviceType === 'door') {
|
|
1054
|
+
this.doorService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
1055
|
+
} else if (this.botDeviceType === 'window') {
|
|
1056
|
+
this.windowService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
1057
|
+
} else if (this.botDeviceType === 'windowcovering') {
|
|
1058
|
+
this.windowCoveringService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
1059
|
+
} else if (this.botDeviceType === 'lock') {
|
|
1060
|
+
this.lockService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
1061
|
+
} else if (this.botDeviceType === 'faucet') {
|
|
1062
|
+
this.faucetService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
1063
|
+
} else if (this.botDeviceType === 'fan') {
|
|
1064
|
+
this.fanService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
1065
|
+
} else if (this.botDeviceType === 'stateful') {
|
|
1066
|
+
this.statefulProgrammableSwitchService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
1067
|
+
} else if (this.botDeviceType === 'switch') {
|
|
1068
|
+
this.switchService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
1069
|
+
} else {
|
|
1070
|
+
this.outletService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
1071
|
+
}
|
|
1042
1072
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
1043
1073
|
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1044
1074
|
}
|
|
@@ -1333,23 +1363,30 @@ export class Bot {
|
|
|
1333
1363
|
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, e);
|
|
1334
1364
|
}
|
|
1335
1365
|
|
|
1336
|
-
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig)
|
|
1337
|
-
this.
|
|
1338
|
-
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
1339
|
-
);
|
|
1340
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
1341
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
1366
|
+
async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
|
|
1367
|
+
await this.refreshStatus();
|
|
1342
1368
|
if (device.firmware) {
|
|
1343
|
-
this.
|
|
1369
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
1370
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
1371
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1372
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1344
1373
|
} else if (device.version) {
|
|
1345
|
-
this.
|
|
1346
|
-
|
|
1374
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
|
|
1375
|
+
accessory.context.FirmwareRevision = device.version;
|
|
1347
1376
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1377
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1348
1378
|
} else {
|
|
1349
|
-
this.
|
|
1379
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
1380
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
1381
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1382
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1350
1383
|
}
|
|
1351
|
-
this.
|
|
1352
|
-
|
|
1384
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
1385
|
+
accessory
|
|
1386
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
1387
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
1388
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
1389
|
+
.updateValue(this.FirmwareRevision);
|
|
1353
1390
|
}
|
|
1354
1391
|
|
|
1355
1392
|
async deviceType(device: device & devicesConfig): Promise<void> {
|
|
@@ -88,10 +88,20 @@ export class CeilingLight {
|
|
|
88
88
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
89
89
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
90
90
|
.setCharacteristic(this.platform.Characteristic.Model, this.model(device))
|
|
91
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
.
|
|
91
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
92
|
+
|
|
93
|
+
if (accessory.context.FirmwareRevision) {
|
|
94
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
|
|
95
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
96
|
+
accessory
|
|
97
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
98
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
99
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
100
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
101
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
102
|
+
} else {
|
|
103
|
+
this.setFirmwareRevision(accessory, device);
|
|
104
|
+
}
|
|
95
105
|
|
|
96
106
|
// get the Lightbulb service if it exists, otherwise create a new Lightbulb service
|
|
97
107
|
// you can create multiple services for each accessory
|
|
@@ -852,8 +862,7 @@ export class CeilingLight {
|
|
|
852
862
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
853
863
|
} else {
|
|
854
864
|
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
855
|
-
this.
|
|
856
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
865
|
+
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
857
866
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
858
867
|
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
859
868
|
}
|
|
@@ -1013,24 +1022,30 @@ export class CeilingLight {
|
|
|
1013
1022
|
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.ColorTemperature, e);
|
|
1014
1023
|
}
|
|
1015
1024
|
|
|
1016
|
-
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig)
|
|
1017
|
-
|
|
1018
|
-
this.debugLog(
|
|
1019
|
-
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
1020
|
-
);
|
|
1021
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
1022
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
1025
|
+
async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
|
|
1026
|
+
await this.refreshStatus();
|
|
1023
1027
|
if (device.firmware) {
|
|
1024
|
-
this.
|
|
1028
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
1029
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
1030
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1031
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1025
1032
|
} else if (device.version) {
|
|
1026
|
-
this.
|
|
1027
|
-
|
|
1033
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
|
|
1034
|
+
accessory.context.FirmwareRevision = device.version;
|
|
1028
1035
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1036
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1029
1037
|
} else {
|
|
1030
|
-
this.
|
|
1038
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
1039
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
1040
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1041
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1031
1042
|
}
|
|
1032
|
-
this.
|
|
1033
|
-
|
|
1043
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
1044
|
+
accessory
|
|
1045
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
1046
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
1047
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
1048
|
+
.updateValue(this.FirmwareRevision);
|
|
1034
1049
|
}
|
|
1035
1050
|
|
|
1036
1051
|
async context() {
|
package/src/device/colorbulb.ts
CHANGED
|
@@ -97,7 +97,7 @@ export class ColorBulb {
|
|
|
97
97
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
98
98
|
|
|
99
99
|
if (accessory.context.FirmwareRevision) {
|
|
100
|
-
this.
|
|
100
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
|
|
101
101
|
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
102
102
|
accessory
|
|
103
103
|
.getService(this.platform.Service.AccessoryInformation)!
|
package/src/device/contact.ts
CHANGED
|
@@ -83,10 +83,20 @@ export class Contact {
|
|
|
83
83
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
84
84
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
85
85
|
.setCharacteristic(this.platform.Characteristic.Model, 'W1201500')
|
|
86
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
.
|
|
86
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
87
|
+
|
|
88
|
+
if (accessory.context.FirmwareRevision) {
|
|
89
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
|
|
90
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
91
|
+
accessory
|
|
92
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
93
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
94
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
95
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
96
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
97
|
+
} else {
|
|
98
|
+
this.setFirmwareRevision(accessory, device);
|
|
99
|
+
}
|
|
90
100
|
|
|
91
101
|
// get the Contact service if it exists, otherwise create a new Contact service
|
|
92
102
|
// you can create multiple services for each accessory
|
|
@@ -460,8 +470,14 @@ export class Contact {
|
|
|
460
470
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
461
471
|
} else {
|
|
462
472
|
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
463
|
-
this.
|
|
464
|
-
|
|
473
|
+
this.batteryService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
474
|
+
this.contactSensorservice.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
475
|
+
if (!this.device.contact?.hide_motionsensor) {
|
|
476
|
+
this.motionService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
477
|
+
}
|
|
478
|
+
if (!this.device.contact?.hide_lightsensor) {
|
|
479
|
+
this.lightSensorService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
480
|
+
}
|
|
465
481
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
466
482
|
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
467
483
|
}
|
|
@@ -596,24 +612,30 @@ export class Contact {
|
|
|
596
612
|
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, e);
|
|
597
613
|
}
|
|
598
614
|
|
|
599
|
-
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig)
|
|
600
|
-
|
|
601
|
-
this.debugLog(
|
|
602
|
-
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
603
|
-
);
|
|
604
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
605
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
615
|
+
async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
|
|
616
|
+
await this.refreshStatus();
|
|
606
617
|
if (device.firmware) {
|
|
607
|
-
this.
|
|
618
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
619
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
620
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
621
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
608
622
|
} else if (device.version) {
|
|
609
|
-
this.
|
|
610
|
-
|
|
623
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
|
|
624
|
+
accessory.context.FirmwareRevision = device.version;
|
|
611
625
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
626
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
612
627
|
} else {
|
|
613
|
-
this.
|
|
628
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
629
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
630
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
631
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
614
632
|
}
|
|
615
|
-
this.
|
|
616
|
-
|
|
633
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
634
|
+
accessory
|
|
635
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
636
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
637
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
638
|
+
.updateValue(this.FirmwareRevision);
|
|
617
639
|
}
|
|
618
640
|
|
|
619
641
|
async context() {
|
package/src/device/curtain.ts
CHANGED
|
@@ -102,10 +102,20 @@ export class Curtain {
|
|
|
102
102
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
103
103
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
104
104
|
.setCharacteristic(this.platform.Characteristic.Model, 'W0701600')
|
|
105
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId)
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
.
|
|
105
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
106
|
+
|
|
107
|
+
if (accessory.context.FirmwareRevision) {
|
|
108
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
|
|
109
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
110
|
+
accessory
|
|
111
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
112
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
113
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
114
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
115
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
116
|
+
} else {
|
|
117
|
+
this.setFirmwareRevision(accessory, device);
|
|
118
|
+
}
|
|
109
119
|
|
|
110
120
|
// get the WindowCovering service if it exists, otherwise create a new WindowCovering service
|
|
111
121
|
// you can create multiple services for each accessory
|
|
@@ -873,8 +883,11 @@ export class Curtain {
|
|
|
873
883
|
this.mqttPublish('FirmwareRevision', this.FirmwareRevision);
|
|
874
884
|
}
|
|
875
885
|
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
876
|
-
this.
|
|
877
|
-
|
|
886
|
+
this.batteryService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
887
|
+
this.windowCoveringService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
888
|
+
if (this.device.curtain?.hide_lightsensor) {
|
|
889
|
+
this.windowCoveringService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
890
|
+
}
|
|
878
891
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
879
892
|
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
880
893
|
}
|
|
@@ -1109,23 +1122,30 @@ export class Curtain {
|
|
|
1109
1122
|
//throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
|
|
1110
1123
|
}
|
|
1111
1124
|
|
|
1112
|
-
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig)
|
|
1113
|
-
this.
|
|
1114
|
-
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
1115
|
-
);
|
|
1116
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
1117
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
1125
|
+
async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
|
|
1126
|
+
await this.refreshStatus();
|
|
1118
1127
|
if (device.firmware) {
|
|
1119
|
-
this.
|
|
1128
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
1129
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
1130
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1131
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1120
1132
|
} else if (device.version) {
|
|
1121
|
-
this.
|
|
1122
|
-
|
|
1133
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
|
|
1134
|
+
accessory.context.FirmwareRevision = device.version;
|
|
1123
1135
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1136
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1124
1137
|
} else {
|
|
1125
|
-
this.
|
|
1138
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
1139
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
1140
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1141
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1126
1142
|
}
|
|
1127
|
-
this.
|
|
1128
|
-
|
|
1143
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
1144
|
+
accessory
|
|
1145
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
1146
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
1147
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
1148
|
+
.updateValue(this.FirmwareRevision);
|
|
1129
1149
|
}
|
|
1130
1150
|
|
|
1131
1151
|
async context() {
|
package/src/device/hub.ts
CHANGED
|
@@ -61,10 +61,20 @@ export class Hub {
|
|
|
61
61
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
62
62
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
63
63
|
.setCharacteristic(this.platform.Characteristic.Model, accessory.context.model)
|
|
64
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
.
|
|
64
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
65
|
+
|
|
66
|
+
if (accessory.context.FirmwareRevision) {
|
|
67
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
|
|
68
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
69
|
+
accessory
|
|
70
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
71
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
72
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
73
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
74
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
75
|
+
} else {
|
|
76
|
+
this.setFirmwareRevision(accessory, device);
|
|
77
|
+
}
|
|
68
78
|
|
|
69
79
|
// Temperature Sensor Service
|
|
70
80
|
if (device.hub?.hide_temperature) {
|
|
@@ -388,8 +398,16 @@ export class Hub {
|
|
|
388
398
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
389
399
|
} else {
|
|
390
400
|
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
391
|
-
|
|
392
|
-
|
|
401
|
+
|
|
402
|
+
if (!this.device.hub?.hide_humidity) {
|
|
403
|
+
this.humidityService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
404
|
+
}
|
|
405
|
+
if (!this.device.hub?.hide_temperature) {
|
|
406
|
+
this.temperatureService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
407
|
+
}
|
|
408
|
+
if (!this.device.hub?.hide_lightsensor) {
|
|
409
|
+
this.lightSensorService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
410
|
+
}
|
|
393
411
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
394
412
|
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
395
413
|
}
|
|
@@ -473,24 +491,30 @@ export class Hub {
|
|
|
473
491
|
return this.set_maxLux;
|
|
474
492
|
}
|
|
475
493
|
|
|
476
|
-
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig)
|
|
477
|
-
|
|
478
|
-
this.debugLog(
|
|
479
|
-
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
480
|
-
);
|
|
481
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
482
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
494
|
+
async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
|
|
495
|
+
await this.refreshStatus();
|
|
483
496
|
if (device.firmware) {
|
|
484
|
-
this.
|
|
497
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
498
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
499
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
500
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
485
501
|
} else if (device.version) {
|
|
486
|
-
this.
|
|
487
|
-
|
|
502
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
|
|
503
|
+
accessory.context.FirmwareRevision = device.version;
|
|
488
504
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
505
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
489
506
|
} else {
|
|
490
|
-
this.
|
|
507
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
508
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
509
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
510
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
491
511
|
}
|
|
492
|
-
this.
|
|
493
|
-
|
|
512
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
513
|
+
accessory
|
|
514
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
515
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
516
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
517
|
+
.updateValue(this.FirmwareRevision);
|
|
494
518
|
}
|
|
495
519
|
|
|
496
520
|
async refreshRate(device: device & devicesConfig): Promise<void> {
|
package/src/device/humidifier.ts
CHANGED
|
@@ -81,10 +81,20 @@ export class Humidifier {
|
|
|
81
81
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
82
82
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
83
83
|
.setCharacteristic(this.platform.Characteristic.Model, 'W0801800')
|
|
84
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
.
|
|
84
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
85
|
+
|
|
86
|
+
if (accessory.context.FirmwareRevision) {
|
|
87
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
|
|
88
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
89
|
+
accessory
|
|
90
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
91
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
92
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
93
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
94
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
95
|
+
} else {
|
|
96
|
+
this.setFirmwareRevision(accessory, device);
|
|
97
|
+
}
|
|
88
98
|
|
|
89
99
|
// get the service if it exists, otherwise create a new service
|
|
90
100
|
// you can create multiple services for each accessory
|
|
@@ -743,8 +753,10 @@ export class Humidifier {
|
|
|
743
753
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
744
754
|
} else {
|
|
745
755
|
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
746
|
-
this.
|
|
747
|
-
|
|
756
|
+
this.humidifierService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
757
|
+
if (!this.device.humidifier?.hide_temperature) {
|
|
758
|
+
this.temperatureservice!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
759
|
+
}
|
|
748
760
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
749
761
|
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
750
762
|
}
|
|
@@ -883,24 +895,30 @@ export class Humidifier {
|
|
|
883
895
|
}
|
|
884
896
|
}
|
|
885
897
|
|
|
886
|
-
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig)
|
|
887
|
-
|
|
888
|
-
this.debugLog(
|
|
889
|
-
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
890
|
-
);
|
|
891
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
892
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
898
|
+
async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
|
|
899
|
+
await this.refreshStatus();
|
|
893
900
|
if (device.firmware) {
|
|
894
|
-
this.
|
|
901
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
902
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
903
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
904
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
895
905
|
} else if (device.version) {
|
|
896
|
-
this.
|
|
897
|
-
|
|
906
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
|
|
907
|
+
accessory.context.FirmwareRevision = device.version;
|
|
898
908
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
909
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
899
910
|
} else {
|
|
900
|
-
this.
|
|
911
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
912
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
913
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
914
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
901
915
|
}
|
|
902
|
-
this.
|
|
903
|
-
|
|
916
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
917
|
+
accessory
|
|
918
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
919
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
920
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
921
|
+
.updateValue(this.FirmwareRevision);
|
|
904
922
|
}
|
|
905
923
|
|
|
906
924
|
async context() {
|
package/src/device/iosensor.ts
CHANGED
|
@@ -89,10 +89,20 @@ export class IOSensor {
|
|
|
89
89
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
90
90
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
91
91
|
.setCharacteristic(this.platform.Characteristic.Model, 'WoIOSensor')
|
|
92
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
.
|
|
92
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
93
|
+
|
|
94
|
+
if (accessory.context.FirmwareRevision) {
|
|
95
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
|
|
96
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
97
|
+
accessory
|
|
98
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
99
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
100
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
101
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
102
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
103
|
+
} else {
|
|
104
|
+
this.setFirmwareRevision(accessory, device);
|
|
105
|
+
}
|
|
96
106
|
|
|
97
107
|
// Temperature Sensor Service
|
|
98
108
|
if (device.meter?.hide_temperature) {
|
|
@@ -453,8 +463,13 @@ export class IOSensor {
|
|
|
453
463
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
454
464
|
} else {
|
|
455
465
|
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
456
|
-
this.
|
|
457
|
-
|
|
466
|
+
this.batteryService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
467
|
+
if (this.device.meter?.hide_humidity) {
|
|
468
|
+
this.humidityservice!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
469
|
+
}
|
|
470
|
+
if (this.device.meter?.hide_temperature) {
|
|
471
|
+
this.temperatureservice!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
472
|
+
}
|
|
458
473
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
459
474
|
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
460
475
|
}
|
|
@@ -619,24 +634,30 @@ export class IOSensor {
|
|
|
619
634
|
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, e);
|
|
620
635
|
}
|
|
621
636
|
|
|
622
|
-
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig)
|
|
623
|
-
|
|
624
|
-
this.debugLog(
|
|
625
|
-
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
626
|
-
);
|
|
627
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
628
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
637
|
+
async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
|
|
638
|
+
await this.refreshStatus();
|
|
629
639
|
if (device.firmware) {
|
|
630
|
-
this.
|
|
640
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
641
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
642
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
643
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
631
644
|
} else if (device.version) {
|
|
632
|
-
this.
|
|
633
|
-
|
|
645
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
|
|
646
|
+
accessory.context.FirmwareRevision = device.version;
|
|
634
647
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
648
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
635
649
|
} else {
|
|
636
|
-
this.
|
|
650
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
651
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
652
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
653
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
637
654
|
}
|
|
638
|
-
this.
|
|
639
|
-
|
|
655
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
656
|
+
accessory
|
|
657
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
658
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
659
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
660
|
+
.updateValue(this.FirmwareRevision);
|
|
640
661
|
}
|
|
641
662
|
|
|
642
663
|
async context() {
|