@switchbot/homebridge-switchbot 2.9.1-beta.3 → 2.9.1
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/.eslintrc +47 -14
- package/.vscode/settings.json +7 -1
- package/CHANGELOG.md +79 -70
- package/SECURITY.md +2 -2
- package/config.schema.json +348 -114
- package/dist/device/blindtilt.d.ts +0 -3
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +13 -62
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +0 -3
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +49 -116
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +0 -3
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +17 -60
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts +0 -3
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +13 -56
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +0 -3
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +19 -69
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +0 -3
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +16 -66
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/hub.d.ts +1 -4
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +16 -69
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts +0 -3
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +16 -63
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts +0 -3
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +16 -65
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts +0 -3
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +13 -56
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts +0 -3
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +22 -68
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +0 -3
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +16 -68
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +1 -4
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +16 -69
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +0 -3
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +12 -62
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +0 -3
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +6 -53
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts +0 -3
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +18 -65
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +0 -1
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +9 -47
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +0 -1
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +9 -47
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +0 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +9 -47
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +0 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +9 -47
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts +0 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +9 -47
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +0 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +44 -77
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +0 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +18 -56
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +0 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +9 -47
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +0 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +9 -47
- package/dist/irdevice/waterheater.js.map +1 -1
- package/nodemon.json +4 -2
- package/package.json +9 -14
- package/src/device/blindtilt.ts +14 -62
- package/src/device/bot.ts +51 -108
- package/src/device/ceilinglight.ts +17 -61
- package/src/device/colorbulb.ts +13 -56
- package/src/device/contact.ts +20 -69
- package/src/device/curtain.ts +17 -66
- package/src/device/hub.ts +16 -70
- package/src/device/humidifier.ts +16 -64
- package/src/device/iosensor.ts +17 -66
- package/src/device/lightstrip.ts +13 -56
- package/src/device/lock.ts +22 -69
- package/src/device/meter.ts +18 -69
- package/src/device/meterplus.ts +17 -70
- package/src/device/motion.ts +13 -62
- package/src/device/plug.ts +6 -52
- package/src/device/robotvacuumcleaner.ts +18 -65
- package/src/irdevice/airconditioner.ts +9 -46
- package/src/irdevice/airpurifier.ts +9 -48
- package/src/irdevice/camera.ts +9 -48
- package/src/irdevice/fan.ts +9 -48
- package/src/irdevice/light.ts +9 -48
- package/src/irdevice/other.ts +44 -78
- package/src/irdevice/tv.ts +18 -57
- package/src/irdevice/vacuumcleaner.ts +9 -48
- package/src/irdevice/waterheater.ts +9 -48
- package/tsconfig.json +16 -4
- package/.github/npm-version-script.js +0 -81
- package/.prettierrc +0 -9
package/src/device/colorbulb.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* eslint-disable brace-style */
|
|
2
|
-
import { Context } from 'vm';
|
|
3
1
|
import { request } from 'undici';
|
|
4
2
|
import { sleep } from '../utils';
|
|
5
3
|
import { interval, Subject } from 'rxjs';
|
|
@@ -94,25 +92,14 @@ export class ColorBulb {
|
|
|
94
92
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
95
93
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
96
94
|
.setCharacteristic(this.platform.Characteristic.Model, 'W1401400')
|
|
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
|
-
}
|
|
95
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId)
|
|
96
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision);
|
|
111
97
|
|
|
112
98
|
// get the Lightbulb service if it exists, otherwise create a new Lightbulb service
|
|
113
99
|
// you can create multiple services for each accessory
|
|
114
|
-
|
|
115
|
-
|
|
100
|
+
const lightBulbService = `${accessory.displayName} ${device.deviceType}`;
|
|
101
|
+
(this.lightBulbService = accessory.getService(this.platform.Service.Lightbulb)
|
|
102
|
+
|| accessory.addService(this.platform.Service.Lightbulb)), lightBulbService;
|
|
116
103
|
|
|
117
104
|
if (this.adaptiveLightingShift === -1 && this.accessory.context.adaptiveLighting) {
|
|
118
105
|
this.accessory.removeService(this.lightBulbService);
|
|
@@ -341,6 +328,7 @@ export class ColorBulb {
|
|
|
341
328
|
|
|
342
329
|
// FirmwareRevision
|
|
343
330
|
this.FirmwareRevision = this.OpenAPI_FirmwareRevision!;
|
|
331
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
344
332
|
}
|
|
345
333
|
|
|
346
334
|
/**
|
|
@@ -481,9 +469,9 @@ export class ColorBulb {
|
|
|
481
469
|
async pushChanges(): Promise<void> {
|
|
482
470
|
if (!this.device.enableCloudService && this.OpenAPI) {
|
|
483
471
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} pushChanges enableCloudService: ${this.device.enableCloudService}`);
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
} else
|
|
472
|
+
/*} else if (this.BLE) {
|
|
473
|
+
await this.BLEpushChanges();*/
|
|
474
|
+
} else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
487
475
|
await this.openAPIpushChanges();
|
|
488
476
|
} else {
|
|
489
477
|
await this.offlineOff();
|
|
@@ -1024,15 +1012,6 @@ export class ColorBulb {
|
|
|
1024
1012
|
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.Saturation, this.Saturation);
|
|
1025
1013
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic Saturation: ${this.Saturation}`);
|
|
1026
1014
|
}
|
|
1027
|
-
// FirmwareRevision
|
|
1028
|
-
if (this.FirmwareRevision === undefined) {
|
|
1029
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1030
|
-
} else {
|
|
1031
|
-
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
1032
|
-
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
1033
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
1034
|
-
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1035
|
-
}
|
|
1036
1015
|
}
|
|
1037
1016
|
|
|
1038
1017
|
async adaptiveLighting(device: device & devicesConfig): Promise<void> {
|
|
@@ -1189,32 +1168,6 @@ export class ColorBulb {
|
|
|
1189
1168
|
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.ColorTemperature, e);
|
|
1190
1169
|
}
|
|
1191
1170
|
|
|
1192
|
-
async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
|
|
1193
|
-
await this.refreshStatus();
|
|
1194
|
-
if (device.firmware) {
|
|
1195
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
1196
|
-
accessory.context.FirmwareRevision = device.firmware;
|
|
1197
|
-
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1198
|
-
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1199
|
-
} else if (device.version) {
|
|
1200
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
|
|
1201
|
-
accessory.context.FirmwareRevision = device.version;
|
|
1202
|
-
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1203
|
-
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1204
|
-
} else {
|
|
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}`);
|
|
1209
|
-
}
|
|
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);
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
1171
|
async context() {
|
|
1219
1172
|
if (this.On === undefined) {
|
|
1220
1173
|
this.On = false;
|
|
@@ -1243,6 +1196,10 @@ export class ColorBulb {
|
|
|
1243
1196
|
}
|
|
1244
1197
|
this.minKelvin = 2000;
|
|
1245
1198
|
this.maxKelvin = 9000;
|
|
1199
|
+
if (this.FirmwareRevision === undefined) {
|
|
1200
|
+
this.FirmwareRevision = this.platform.version;
|
|
1201
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
1202
|
+
}
|
|
1246
1203
|
}
|
|
1247
1204
|
|
|
1248
1205
|
async refreshRate(device: device & devicesConfig): Promise<void> {
|
package/src/device/contact.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Context } from 'vm';
|
|
2
1
|
import { request } from 'undici';
|
|
3
2
|
import { sleep } from '../utils';
|
|
4
3
|
import { interval, Subject } from 'rxjs';
|
|
@@ -83,26 +82,14 @@ export class Contact {
|
|
|
83
82
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
84
83
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
85
84
|
.setCharacteristic(this.platform.Characteristic.Model, 'W1201500')
|
|
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
|
-
}
|
|
85
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId)
|
|
86
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision);
|
|
100
87
|
|
|
101
88
|
// get the Contact service if it exists, otherwise create a new Contact service
|
|
102
89
|
// you can create multiple services for each accessory
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
90
|
+
const contactSensorservice = `${accessory.displayName} Contact Sensor`;
|
|
91
|
+
(this.contactSensorservice = accessory.getService(this.platform.Service.ContactSensor)
|
|
92
|
+
|| accessory.addService(this.platform.Service.ContactSensor)), contactSensorservice;
|
|
106
93
|
|
|
107
94
|
this.contactSensorservice.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
|
|
108
95
|
if (!this.contactSensorservice.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
@@ -116,9 +103,9 @@ export class Contact {
|
|
|
116
103
|
accessory.removeService(this.motionService!);
|
|
117
104
|
} else if (!this.motionService) {
|
|
118
105
|
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Motion Sensor Service`);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
106
|
+
const motionService = `${accessory.displayName} Motion Sensor`;
|
|
107
|
+
(this.motionService = this.accessory.getService(this.platform.Service.MotionSensor)
|
|
108
|
+
|| this.accessory.addService(this.platform.Service.MotionSensor)), motionService;
|
|
122
109
|
|
|
123
110
|
this.motionService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Motion Sensor`);
|
|
124
111
|
this.motionService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Motion Sensor`);
|
|
@@ -133,9 +120,10 @@ export class Contact {
|
|
|
133
120
|
accessory.removeService(this.lightSensorService!);
|
|
134
121
|
} else if (!this.lightSensorService) {
|
|
135
122
|
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Light Sensor Service`);
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
123
|
+
|
|
124
|
+
const lightSensorService = `${accessory.displayName} Light Sensor`;
|
|
125
|
+
(this.lightSensorService = this.accessory.getService(this.platform.Service.LightSensor)
|
|
126
|
+
|| this.accessory.addService(this.platform.Service.LightSensor)), lightSensorService;
|
|
139
127
|
|
|
140
128
|
this.lightSensorService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Light Sensor`);
|
|
141
129
|
this.lightSensorService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Light Sensor`);
|
|
@@ -144,8 +132,9 @@ export class Contact {
|
|
|
144
132
|
}
|
|
145
133
|
|
|
146
134
|
// Battery Service
|
|
147
|
-
|
|
148
|
-
|
|
135
|
+
const batteryService = `${accessory.displayName} Battery`;
|
|
136
|
+
(this.batteryService = this.accessory.getService(this.platform.Service.Battery)
|
|
137
|
+
|| accessory.addService(this.platform.Service.Battery)), batteryService;
|
|
149
138
|
|
|
150
139
|
this.batteryService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Battery`);
|
|
151
140
|
if (!this.batteryService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
@@ -293,6 +282,7 @@ export class Contact {
|
|
|
293
282
|
|
|
294
283
|
// FirmwareRevision
|
|
295
284
|
this.FirmwareRevision = this.OpenAPI_FirmwareRevision!;
|
|
285
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
296
286
|
}
|
|
297
287
|
|
|
298
288
|
/**
|
|
@@ -464,23 +454,6 @@ export class Contact {
|
|
|
464
454
|
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, this.StatusLowBattery);
|
|
465
455
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic StatusLowBattery: ${this.StatusLowBattery}`);
|
|
466
456
|
}
|
|
467
|
-
|
|
468
|
-
// FirmwareRevision
|
|
469
|
-
if (this.FirmwareRevision === undefined) {
|
|
470
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
471
|
-
} else {
|
|
472
|
-
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
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
|
-
}
|
|
481
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
482
|
-
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
483
|
-
}
|
|
484
457
|
}
|
|
485
458
|
|
|
486
459
|
async stopScanning(switchbot: any) {
|
|
@@ -612,32 +585,6 @@ export class Contact {
|
|
|
612
585
|
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, e);
|
|
613
586
|
}
|
|
614
587
|
|
|
615
|
-
async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
|
|
616
|
-
await this.refreshStatus();
|
|
617
|
-
if (device.firmware) {
|
|
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}`);
|
|
622
|
-
} else if (device.version) {
|
|
623
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
|
|
624
|
-
accessory.context.FirmwareRevision = device.version;
|
|
625
|
-
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
626
|
-
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
627
|
-
} else {
|
|
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}`);
|
|
632
|
-
}
|
|
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);
|
|
639
|
-
}
|
|
640
|
-
|
|
641
588
|
async context() {
|
|
642
589
|
if (this.MotionDetected === undefined) {
|
|
643
590
|
this.MotionDetected = false;
|
|
@@ -649,6 +596,10 @@ export class Contact {
|
|
|
649
596
|
} else {
|
|
650
597
|
this.ContactSensorState = this.accessory.context.ContactSensorState;
|
|
651
598
|
}
|
|
599
|
+
if (this.FirmwareRevision === undefined) {
|
|
600
|
+
this.FirmwareRevision = this.platform.version;
|
|
601
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
602
|
+
}
|
|
652
603
|
}
|
|
653
604
|
|
|
654
605
|
async refreshRate(device: device & devicesConfig): Promise<void> {
|
package/src/device/curtain.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Context } from 'vm';
|
|
2
1
|
import { request } from 'undici';
|
|
3
2
|
import { sleep } from '../utils';
|
|
4
3
|
import { MqttClient } from 'mqtt';
|
|
@@ -102,26 +101,14 @@ export class Curtain {
|
|
|
102
101
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
103
102
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
104
103
|
.setCharacteristic(this.platform.Characteristic.Model, 'W0701600')
|
|
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
|
-
}
|
|
104
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId)
|
|
105
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision);
|
|
119
106
|
|
|
120
107
|
// get the WindowCovering service if it exists, otherwise create a new WindowCovering service
|
|
121
108
|
// you can create multiple services for each accessory
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
109
|
+
const windowCoveringService = `${accessory.displayName} ${device.deviceType}`;
|
|
110
|
+
(this.windowCoveringService = accessory.getService(this.platform.Service.WindowCovering)
|
|
111
|
+
|| accessory.addService(this.platform.Service.WindowCovering)), windowCoveringService;
|
|
125
112
|
|
|
126
113
|
this.windowCoveringService.setCharacteristic(this.platform.Characteristic.Name, accessory.displayName);
|
|
127
114
|
if (!this.windowCoveringService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
@@ -163,9 +150,9 @@ export class Curtain {
|
|
|
163
150
|
accessory.removeService(this.lightSensorService!);
|
|
164
151
|
} else if (!this.lightSensorService) {
|
|
165
152
|
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Light Sensor Service`);
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
153
|
+
const lightSensorService = `${accessory.displayName} Light Sensor`;
|
|
154
|
+
(this.lightSensorService = this.accessory.getService(this.platform.Service.LightSensor)
|
|
155
|
+
|| this.accessory.addService(this.platform.Service.LightSensor)), lightSensorService;
|
|
169
156
|
|
|
170
157
|
this.lightSensorService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Light Sensor`);
|
|
171
158
|
if (!this.lightSensorService?.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
@@ -176,8 +163,9 @@ export class Curtain {
|
|
|
176
163
|
}
|
|
177
164
|
|
|
178
165
|
// Battery Service
|
|
179
|
-
|
|
180
|
-
|
|
166
|
+
const batteryService = `${accessory.displayName} Battery`;
|
|
167
|
+
(this.batteryService = this.accessory.getService(this.platform.Service.Battery)
|
|
168
|
+
|| accessory.addService(this.platform.Service.Battery)), batteryService;
|
|
181
169
|
|
|
182
170
|
this.batteryService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Battery`);
|
|
183
171
|
if (!this.batteryService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
@@ -478,10 +466,11 @@ export class Curtain {
|
|
|
478
466
|
this.BatteryLevel = 100;
|
|
479
467
|
}
|
|
480
468
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel},`
|
|
481
|
-
|
|
469
|
+
+ ` StatusLowBattery: ${this.StatusLowBattery}`);
|
|
482
470
|
|
|
483
471
|
// FirmwareRevision
|
|
484
472
|
this.FirmwareRevision = this.OpenAPI_FirmwareRevision!;
|
|
473
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
485
474
|
}
|
|
486
475
|
|
|
487
476
|
async refreshStatus(): Promise<void> {
|
|
@@ -875,22 +864,6 @@ export class Curtain {
|
|
|
875
864
|
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, this.StatusLowBattery);
|
|
876
865
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic StatusLowBattery: ${this.StatusLowBattery}`);
|
|
877
866
|
}
|
|
878
|
-
// FirmwareRevision
|
|
879
|
-
if (this.FirmwareRevision === undefined) {
|
|
880
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
881
|
-
} else {
|
|
882
|
-
if (this.device.mqttURL) {
|
|
883
|
-
this.mqttPublish('FirmwareRevision', this.FirmwareRevision);
|
|
884
|
-
}
|
|
885
|
-
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
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
|
-
}
|
|
891
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
892
|
-
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
893
|
-
}
|
|
894
867
|
}
|
|
895
868
|
|
|
896
869
|
/*
|
|
@@ -1122,32 +1095,6 @@ export class Curtain {
|
|
|
1122
1095
|
//throw new this.platform.api.hap.HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
|
|
1123
1096
|
}
|
|
1124
1097
|
|
|
1125
|
-
async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
|
|
1126
|
-
await this.refreshStatus();
|
|
1127
|
-
if (device.firmware) {
|
|
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}`);
|
|
1132
|
-
} else if (device.version) {
|
|
1133
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
|
|
1134
|
-
accessory.context.FirmwareRevision = device.version;
|
|
1135
|
-
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
1136
|
-
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
1137
|
-
} else {
|
|
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}`);
|
|
1142
|
-
}
|
|
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);
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
1098
|
async context() {
|
|
1152
1099
|
if (this.accessory.context.CurrentPosition === undefined) {
|
|
1153
1100
|
this.CurrentPosition = 0;
|
|
@@ -1193,6 +1140,10 @@ export class Curtain {
|
|
|
1193
1140
|
// removes cached values if history is turned off
|
|
1194
1141
|
delete this.accessory.context.lastActivation;
|
|
1195
1142
|
}
|
|
1143
|
+
if (this.FirmwareRevision === undefined) {
|
|
1144
|
+
this.FirmwareRevision = this.platform.version;
|
|
1145
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
1146
|
+
}
|
|
1196
1147
|
}
|
|
1197
1148
|
|
|
1198
1149
|
async refreshRate(device: device & devicesConfig): Promise<void> {
|
package/src/device/hub.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { MqttClient } from 'mqtt';
|
|
|
4
4
|
import { hostname } from 'os';
|
|
5
5
|
import { interval } from 'rxjs';
|
|
6
6
|
import { request } from 'undici';
|
|
7
|
-
import { Context } from 'vm';
|
|
8
7
|
import { SwitchBotPlatform } from '../platform';
|
|
9
8
|
import { Devices, device, deviceStatus, devicesConfig } from '../settings';
|
|
10
9
|
|
|
@@ -56,7 +55,7 @@ export class Hub {
|
|
|
56
55
|
// default placeholders
|
|
57
56
|
this.logs(device);
|
|
58
57
|
this.refreshRate(device);
|
|
59
|
-
this.context(
|
|
58
|
+
this.context();
|
|
60
59
|
this.setupHistoryService(device);
|
|
61
60
|
this.setupMqtt(device);
|
|
62
61
|
this.config(device);
|
|
@@ -72,20 +71,8 @@ export class Hub {
|
|
|
72
71
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
73
72
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
74
73
|
.setCharacteristic(this.platform.Characteristic.Model, accessory.context.model)
|
|
75
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId
|
|
76
|
-
|
|
77
|
-
if (accessory.context.FirmwareRevision) {
|
|
78
|
-
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
|
|
79
|
-
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
80
|
-
accessory
|
|
81
|
-
.getService(this.platform.Service.AccessoryInformation)!
|
|
82
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
83
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
84
|
-
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
85
|
-
.updateValue(accessory.context.FirmwareRevision);
|
|
86
|
-
} else {
|
|
87
|
-
this.setFirmwareRevision(accessory, device);
|
|
88
|
-
}
|
|
74
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId)
|
|
75
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision);
|
|
89
76
|
|
|
90
77
|
// Temperature Sensor Service
|
|
91
78
|
if (device.hub?.hide_temperature) {
|
|
@@ -94,9 +81,9 @@ export class Hub {
|
|
|
94
81
|
accessory.removeService(this.temperatureService!);
|
|
95
82
|
} else if (!this.temperatureService) {
|
|
96
83
|
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Temperature Sensor Service`);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
84
|
+
const temperatureService = `${accessory.displayName} Temperature Sensor`;
|
|
85
|
+
(this.temperatureService = this.accessory.getService(this.platform.Service.TemperatureSensor)
|
|
86
|
+
|| this.accessory.addService(this.platform.Service.TemperatureSensor)), temperatureService;
|
|
100
87
|
|
|
101
88
|
this.temperatureService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Temperature Sensor`);
|
|
102
89
|
if (!this.temperatureService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
@@ -125,9 +112,9 @@ export class Hub {
|
|
|
125
112
|
accessory.removeService(this.humidityService!);
|
|
126
113
|
} else if (!this.humidityService) {
|
|
127
114
|
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Humidity Sensor Service`);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
115
|
+
const humidityService = `${accessory.displayName} Humidity Sensor`;
|
|
116
|
+
(this.humidityService = this.accessory.getService(this.platform.Service.HumiditySensor)
|
|
117
|
+
|| this.accessory.addService(this.platform.Service.HumiditySensor)), humidityService;
|
|
131
118
|
|
|
132
119
|
this.humidityService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Humidity Sensor`);
|
|
133
120
|
if (!this.humidityService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
@@ -152,9 +139,9 @@ export class Hub {
|
|
|
152
139
|
accessory.removeService(this.lightSensorService!);
|
|
153
140
|
} else if (!this.lightSensorService) {
|
|
154
141
|
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Light Sensor Service`);
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
142
|
+
const lightSensorService = `${accessory.displayName} Light Sensor`;
|
|
143
|
+
(this.lightSensorService = this.accessory.getService(this.platform.Service.LightSensor)
|
|
144
|
+
|| this.accessory.addService(this.platform.Service.LightSensor)), lightSensorService;
|
|
158
145
|
|
|
159
146
|
this.lightSensorService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Light Sensor`);
|
|
160
147
|
this.lightSensorService.setCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Light Sensor`);
|
|
@@ -303,6 +290,7 @@ export class Hub {
|
|
|
303
290
|
|
|
304
291
|
// FirmwareRevision
|
|
305
292
|
this.FirmwareRevision = this.OpenAPI_FirmwareRevision!;
|
|
293
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
306
294
|
}
|
|
307
295
|
|
|
308
296
|
async refreshStatus(): Promise<void> {
|
|
@@ -412,25 +400,6 @@ export class Hub {
|
|
|
412
400
|
}
|
|
413
401
|
}
|
|
414
402
|
|
|
415
|
-
// FirmwareRevision
|
|
416
|
-
if (this.FirmwareRevision === undefined) {
|
|
417
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
418
|
-
} else {
|
|
419
|
-
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
420
|
-
|
|
421
|
-
if (!this.device.hub?.hide_humidity) {
|
|
422
|
-
this.humidityService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
423
|
-
}
|
|
424
|
-
if (!this.device.hub?.hide_temperature) {
|
|
425
|
-
this.temperatureService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
426
|
-
}
|
|
427
|
-
if (!this.device.hub?.hide_lightsensor) {
|
|
428
|
-
this.lightSensorService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
429
|
-
}
|
|
430
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
431
|
-
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
432
|
-
}
|
|
433
|
-
|
|
434
403
|
// MQTT
|
|
435
404
|
if (this.device.mqttURL) {
|
|
436
405
|
this.mqttPublish(`{${mqttmessage.join(',')}}`);
|
|
@@ -536,7 +505,7 @@ export class Hub {
|
|
|
536
505
|
|
|
537
506
|
async offlineOff(): Promise<void> {
|
|
538
507
|
if (this.device.offline) {
|
|
539
|
-
await this.context(
|
|
508
|
+
await this.context();
|
|
540
509
|
await this.updateHomeKitCharacteristics();
|
|
541
510
|
}
|
|
542
511
|
}
|
|
@@ -571,28 +540,7 @@ export class Hub {
|
|
|
571
540
|
return this.set_maxLux;
|
|
572
541
|
}
|
|
573
542
|
|
|
574
|
-
async
|
|
575
|
-
await this.refreshStatus();
|
|
576
|
-
if (device.firmware) {
|
|
577
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
578
|
-
accessory.context.FirmwareRevision = device.firmware;
|
|
579
|
-
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
580
|
-
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
581
|
-
} else {
|
|
582
|
-
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
|
|
583
|
-
accessory.context.FirmwareRevision = device.version;
|
|
584
|
-
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
585
|
-
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
586
|
-
}
|
|
587
|
-
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
588
|
-
accessory
|
|
589
|
-
.getService(this.platform.Service.AccessoryInformation)!
|
|
590
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
591
|
-
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
592
|
-
.updateValue(this.FirmwareRevision);
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
async context(accessory, device) {
|
|
543
|
+
async context() {
|
|
596
544
|
if (this.CurrentRelativeHumidity === undefined) {
|
|
597
545
|
this.CurrentRelativeHumidity = 0;
|
|
598
546
|
} else {
|
|
@@ -610,9 +558,7 @@ export class Hub {
|
|
|
610
558
|
}
|
|
611
559
|
if (this.FirmwareRevision === undefined) {
|
|
612
560
|
this.FirmwareRevision = this.platform.version;
|
|
613
|
-
|
|
614
|
-
this.setFirmwareRevision(accessory, device);
|
|
615
|
-
this.FirmwareRevision = this.accessory.context.FirmwareRevision;
|
|
561
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
616
562
|
}
|
|
617
563
|
}
|
|
618
564
|
|