@switchbot/homebridge-switchbot 2.9.0-beta.9 → 2.9.0
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 +1 -1
- package/config.schema.json +11 -5
- 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.d.ts +1 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +31 -17
- 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 +8 -9
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +172 -55
- 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 +41 -18
- 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 -9
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +47 -32
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +4 -7
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +69 -50
- 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 +35 -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/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +4 -0
- package/dist/platform.js.map +1 -1
- package/package.json +11 -11
- 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 +31 -18
- package/src/device/contact.ts +41 -19
- package/src/device/curtain.ts +38 -18
- package/src/device/hub.ts +188 -65
- package/src/device/humidifier.ts +37 -19
- package/src/device/iosensor.ts +41 -20
- package/src/device/lightstrip.ts +34 -18
- package/src/device/lock.ts +39 -20
- package/src/device/meter.ts +48 -40
- package/src/device/meterplus.ts +74 -60
- 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 +37 -15
- package/src/irdevice/tv.ts +30 -15
- package/src/irdevice/vacuumcleaner.ts +30 -15
- package/src/irdevice/waterheater.ts +30 -15
- package/src/platform.ts +4 -0
- package/.github/npm-version-script.js +0 -81
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
|
@@ -94,10 +94,20 @@ export class ColorBulb {
|
|
|
94
94
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
95
95
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
96
96
|
.setCharacteristic(this.platform.Characteristic.Model, 'W1401400')
|
|
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
|
// get the Lightbulb service if it exists, otherwise create a new Lightbulb service
|
|
103
113
|
// you can create multiple services for each accessory
|
|
@@ -1019,8 +1029,7 @@ export class ColorBulb {
|
|
|
1019
1029
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1020
1030
|
} else {
|
|
1021
1031
|
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
1022
|
-
this.
|
|
1023
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
1032
|
+
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
1024
1033
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
1025
1034
|
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1026
1035
|
}
|
|
@@ -1180,26 +1189,30 @@ export class ColorBulb {
|
|
|
1180
1189
|
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.ColorTemperature, e);
|
|
1181
1190
|
}
|
|
1182
1191
|
|
|
1183
|
-
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig)
|
|
1184
|
-
this.
|
|
1185
|
-
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
1186
|
-
);
|
|
1187
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
1188
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
|
|
1189
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
1192
|
+
async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
|
|
1193
|
+
await this.refreshStatus();
|
|
1190
1194
|
if (device.firmware) {
|
|
1195
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
1191
1196
|
accessory.context.FirmwareRevision = device.firmware;
|
|
1192
1197
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1198
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1193
1199
|
} else if (device.version) {
|
|
1200
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
|
|
1194
1201
|
accessory.context.FirmwareRevision = device.version;
|
|
1195
1202
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1196
|
-
|
|
1197
|
-
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1203
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1198
1204
|
} else {
|
|
1199
|
-
this.
|
|
1205
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
1206
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
1207
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1208
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1200
1209
|
}
|
|
1201
|
-
this.
|
|
1202
|
-
|
|
1210
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
1211
|
+
accessory
|
|
1212
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
1213
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
1214
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
1215
|
+
.updateValue(this.FirmwareRevision);
|
|
1203
1216
|
}
|
|
1204
1217
|
|
|
1205
1218
|
async context() {
|
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() {
|