@switchbot/homebridge-switchbot 2.9.1-beta.2 → 2.9.1-beta.4
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 +0 -3
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +7 -58
- 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 +7 -81
- 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 +14 -58
- 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 +10 -54
- 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 +7 -58
- 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 +7 -58
- 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 +7 -60
- 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 +10 -57
- 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 +7 -57
- 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 +10 -54
- 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 +13 -61
- 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 +7 -60
- 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 +7 -61
- 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 +3 -55
- 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 +3 -51
- 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 +12 -61
- 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 +6 -45
- 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 +6 -45
- 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 +6 -45
- 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 +6 -45
- 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 +6 -45
- 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 +6 -45
- 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 +6 -45
- 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 +6 -45
- 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 +6 -45
- package/dist/irdevice/waterheater.js.map +1 -1
- package/package.json +10 -10
- package/src/device/blindtilt.ts +7 -57
- package/src/device/bot.ts +7 -71
- package/src/device/ceilinglight.ts +14 -59
- package/src/device/colorbulb.ts +10 -54
- package/src/device/contact.ts +7 -58
- package/src/device/curtain.ts +7 -57
- package/src/device/hub.ts +7 -61
- package/src/device/humidifier.ts +10 -58
- package/src/device/iosensor.ts +7 -57
- package/src/device/lightstrip.ts +10 -54
- package/src/device/lock.ts +13 -62
- package/src/device/meter.ts +7 -59
- package/src/device/meterplus.ts +7 -61
- package/src/device/motion.ts +3 -54
- package/src/device/plug.ts +3 -50
- package/src/device/robotvacuumcleaner.ts +12 -61
- package/src/irdevice/airconditioner.ts +6 -44
- package/src/irdevice/airpurifier.ts +6 -46
- package/src/irdevice/camera.ts +6 -46
- package/src/irdevice/fan.ts +6 -46
- package/src/irdevice/light.ts +6 -46
- package/src/irdevice/other.ts +6 -46
- package/src/irdevice/tv.ts +6 -46
- package/src/irdevice/vacuumcleaner.ts +6 -46
- package/src/irdevice/waterheater.ts +6 -46
|
@@ -56,20 +56,8 @@ export class AirPurifier {
|
|
|
56
56
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
57
57
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
58
58
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
59
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId
|
|
60
|
-
|
|
61
|
-
if (accessory.context.FirmwareRevision) {
|
|
62
|
-
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
63
|
-
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
64
|
-
accessory
|
|
65
|
-
.getService(this.platform.Service.AccessoryInformation)!
|
|
66
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
67
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
68
|
-
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
69
|
-
.updateValue(accessory.context.FirmwareRevision);
|
|
70
|
-
} else {
|
|
71
|
-
this.setFirmwareRevision(accessory, device);
|
|
72
|
-
}
|
|
59
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId)
|
|
60
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision);
|
|
73
61
|
|
|
74
62
|
// get the Television service if it exists, otherwise create a new Television service
|
|
75
63
|
// you can create multiple services for each accessory
|
|
@@ -283,16 +271,6 @@ export class AirPurifier {
|
|
|
283
271
|
` updateCharacteristic CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`,
|
|
284
272
|
);
|
|
285
273
|
}
|
|
286
|
-
// FirmwareRevision
|
|
287
|
-
if (this.FirmwareRevision === undefined) {
|
|
288
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
289
|
-
} else {
|
|
290
|
-
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
291
|
-
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
292
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
293
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
294
|
-
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
295
|
-
}
|
|
296
274
|
}
|
|
297
275
|
|
|
298
276
|
async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
@@ -388,28 +366,6 @@ export class AirPurifier {
|
|
|
388
366
|
this.airPurifierService.updateCharacteristic(this.platform.Characteristic.Active, e);
|
|
389
367
|
}
|
|
390
368
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
async setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig) {
|
|
394
|
-
if (device.firmware) {
|
|
395
|
-
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
396
|
-
accessory.context.FirmwareRevision = device.firmware;
|
|
397
|
-
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
398
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
399
|
-
} else {
|
|
400
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
401
|
-
accessory.context.FirmwareRevision = this.platform.version;
|
|
402
|
-
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
403
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
404
|
-
}
|
|
405
|
-
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
406
|
-
accessory
|
|
407
|
-
.getService(this.platform.Service.AccessoryInformation)!
|
|
408
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
409
|
-
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
410
|
-
.updateValue(this.FirmwareRevision);
|
|
411
|
-
}
|
|
412
|
-
|
|
413
369
|
private context() {
|
|
414
370
|
if (this.Active === undefined) {
|
|
415
371
|
this.Active = this.platform.Characteristic.Active.INACTIVE;
|
|
@@ -421,6 +377,10 @@ export class AirPurifier {
|
|
|
421
377
|
} else {
|
|
422
378
|
this.CurrentTemperature = this.accessory.context.CurrentTemperature;
|
|
423
379
|
}
|
|
380
|
+
if (this.FirmwareRevision === undefined) {
|
|
381
|
+
this.FirmwareRevision = this.platform.version;
|
|
382
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
383
|
+
}
|
|
424
384
|
}
|
|
425
385
|
|
|
426
386
|
async config(device: irdevice & irDevicesConfig): Promise<void> {
|
package/src/irdevice/camera.ts
CHANGED
|
@@ -38,20 +38,8 @@ export class Camera {
|
|
|
38
38
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
39
39
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
40
40
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
41
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId
|
|
42
|
-
|
|
43
|
-
if (accessory.context.FirmwareRevision) {
|
|
44
|
-
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
45
|
-
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
46
|
-
accessory
|
|
47
|
-
.getService(this.platform.Service.AccessoryInformation)!
|
|
48
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
49
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
50
|
-
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
51
|
-
.updateValue(accessory.context.FirmwareRevision);
|
|
52
|
-
} else {
|
|
53
|
-
this.setFirmwareRevision(accessory, device);
|
|
54
|
-
}
|
|
41
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId)
|
|
42
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision);
|
|
55
43
|
|
|
56
44
|
// get the Television service if it exists, otherwise create a new Television service
|
|
57
45
|
// you can create multiple services for each accessory
|
|
@@ -167,16 +155,6 @@ export class Camera {
|
|
|
167
155
|
this.switchService?.updateCharacteristic(this.platform.Characteristic.On, this.On);
|
|
168
156
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
|
|
169
157
|
}
|
|
170
|
-
// FirmwareRevision
|
|
171
|
-
if (this.FirmwareRevision === undefined) {
|
|
172
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
173
|
-
} else {
|
|
174
|
-
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
175
|
-
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
176
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
177
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
178
|
-
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
179
|
-
}
|
|
180
158
|
}
|
|
181
159
|
|
|
182
160
|
async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
@@ -269,34 +247,16 @@ export class Camera {
|
|
|
269
247
|
this.switchService.updateCharacteristic(this.platform.Characteristic.On, e);
|
|
270
248
|
}
|
|
271
249
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
async setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig) {
|
|
275
|
-
if (device.firmware) {
|
|
276
|
-
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
277
|
-
accessory.context.FirmwareRevision = device.firmware;
|
|
278
|
-
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
279
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
280
|
-
} else {
|
|
281
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
282
|
-
accessory.context.FirmwareRevision = this.platform.version;
|
|
283
|
-
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
284
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
285
|
-
}
|
|
286
|
-
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
287
|
-
accessory
|
|
288
|
-
.getService(this.platform.Service.AccessoryInformation)!
|
|
289
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
290
|
-
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
291
|
-
.updateValue(this.FirmwareRevision);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
250
|
async context() {
|
|
295
251
|
if (this.On === undefined) {
|
|
296
252
|
this.On = false;
|
|
297
253
|
} else {
|
|
298
254
|
this.On = this.accessory.context.On;
|
|
299
255
|
}
|
|
256
|
+
if (this.FirmwareRevision === undefined) {
|
|
257
|
+
this.FirmwareRevision = this.platform.version;
|
|
258
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
259
|
+
}
|
|
300
260
|
}
|
|
301
261
|
|
|
302
262
|
async config(device: irdevice & irDevicesConfig): Promise<void> {
|
package/src/irdevice/fan.ts
CHANGED
|
@@ -45,20 +45,8 @@ export class Fan {
|
|
|
45
45
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
46
46
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
47
47
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
48
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId
|
|
49
|
-
|
|
50
|
-
if (accessory.context.FirmwareRevision) {
|
|
51
|
-
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
52
|
-
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
53
|
-
accessory
|
|
54
|
-
.getService(this.platform.Service.AccessoryInformation)!
|
|
55
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
56
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
57
|
-
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
58
|
-
.updateValue(accessory.context.FirmwareRevision);
|
|
59
|
-
} else {
|
|
60
|
-
this.setFirmwareRevision(accessory, device);
|
|
61
|
-
}
|
|
48
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId)
|
|
49
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision);
|
|
62
50
|
|
|
63
51
|
// get the Television service if it exists, otherwise create a new Television service
|
|
64
52
|
// you can create multiple services for each accessory
|
|
@@ -297,16 +285,6 @@ export class Fan {
|
|
|
297
285
|
this.fanService?.updateCharacteristic(this.platform.Characteristic.RotationSpeed, this.RotationSpeed);
|
|
298
286
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic RotationSpeed: ${this.RotationSpeed}`);
|
|
299
287
|
}
|
|
300
|
-
// FirmwareRevision
|
|
301
|
-
if (this.FirmwareRevision === undefined) {
|
|
302
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
303
|
-
} else {
|
|
304
|
-
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
305
|
-
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
306
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
307
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
308
|
-
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
309
|
-
}
|
|
310
288
|
}
|
|
311
289
|
|
|
312
290
|
async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
@@ -401,34 +379,16 @@ export class Fan {
|
|
|
401
379
|
this.fanService.updateCharacteristic(this.platform.Characteristic.SwingMode, e);
|
|
402
380
|
}
|
|
403
381
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
async setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig) {
|
|
407
|
-
if (device.firmware) {
|
|
408
|
-
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
409
|
-
accessory.context.FirmwareRevision = device.firmware;
|
|
410
|
-
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
411
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
412
|
-
} else {
|
|
413
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
414
|
-
accessory.context.FirmwareRevision = this.platform.version;
|
|
415
|
-
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
416
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
417
|
-
}
|
|
418
|
-
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
419
|
-
accessory
|
|
420
|
-
.getService(this.platform.Service.AccessoryInformation)!
|
|
421
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
422
|
-
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
423
|
-
.updateValue(this.FirmwareRevision);
|
|
424
|
-
}
|
|
425
|
-
|
|
426
382
|
async context() {
|
|
427
383
|
if (this.Active === undefined) {
|
|
428
384
|
this.Active = this.platform.Characteristic.Active.INACTIVE;
|
|
429
385
|
} else {
|
|
430
386
|
this.Active = this.accessory.context.Active;
|
|
431
387
|
}
|
|
388
|
+
if (this.FirmwareRevision === undefined) {
|
|
389
|
+
this.FirmwareRevision = this.platform.version;
|
|
390
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
391
|
+
}
|
|
432
392
|
}
|
|
433
393
|
|
|
434
394
|
async config(device: irdevice & irDevicesConfig): Promise<void> {
|
package/src/irdevice/light.ts
CHANGED
|
@@ -38,20 +38,8 @@ export class Light {
|
|
|
38
38
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
39
39
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
40
40
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
41
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId
|
|
42
|
-
|
|
43
|
-
if (accessory.context.FirmwareRevision) {
|
|
44
|
-
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
45
|
-
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
46
|
-
accessory
|
|
47
|
-
.getService(this.platform.Service.AccessoryInformation)!
|
|
48
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
49
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
50
|
-
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
51
|
-
.updateValue(accessory.context.FirmwareRevision);
|
|
52
|
-
} else {
|
|
53
|
-
this.setFirmwareRevision(accessory, device);
|
|
54
|
-
}
|
|
41
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId)
|
|
42
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision);
|
|
55
43
|
|
|
56
44
|
// get the Light service if it exists, otherwise create a new Light service
|
|
57
45
|
// you can create multiple services for each accessory
|
|
@@ -192,16 +180,6 @@ export class Light {
|
|
|
192
180
|
this.lightBulbService?.updateCharacteristic(this.platform.Characteristic.On, this.On);
|
|
193
181
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
|
|
194
182
|
}
|
|
195
|
-
// FirmwareRevision
|
|
196
|
-
if (this.FirmwareRevision === undefined) {
|
|
197
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
198
|
-
} else {
|
|
199
|
-
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
200
|
-
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
201
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
202
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
203
|
-
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
204
|
-
}
|
|
205
183
|
}
|
|
206
184
|
|
|
207
185
|
async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
@@ -294,34 +272,16 @@ export class Light {
|
|
|
294
272
|
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.On, e);
|
|
295
273
|
}
|
|
296
274
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
async setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig) {
|
|
300
|
-
if (device.firmware) {
|
|
301
|
-
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
302
|
-
accessory.context.FirmwareRevision = device.firmware;
|
|
303
|
-
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
304
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
305
|
-
} else {
|
|
306
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
307
|
-
accessory.context.FirmwareRevision = this.platform.version;
|
|
308
|
-
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
309
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
310
|
-
}
|
|
311
|
-
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
312
|
-
accessory
|
|
313
|
-
.getService(this.platform.Service.AccessoryInformation)!
|
|
314
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
315
|
-
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
316
|
-
.updateValue(this.FirmwareRevision);
|
|
317
|
-
}
|
|
318
|
-
|
|
319
275
|
async context() {
|
|
320
276
|
if (this.On === undefined) {
|
|
321
277
|
this.On = false;
|
|
322
278
|
} else {
|
|
323
279
|
this.On = this.accessory.context.On;
|
|
324
280
|
}
|
|
281
|
+
if (this.FirmwareRevision === undefined) {
|
|
282
|
+
this.FirmwareRevision = this.platform.version;
|
|
283
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
284
|
+
}
|
|
325
285
|
}
|
|
326
286
|
|
|
327
287
|
async config(device: irdevice & irDevicesConfig): Promise<void> {
|
package/src/irdevice/other.ts
CHANGED
|
@@ -49,20 +49,8 @@ export class Others {
|
|
|
49
49
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
50
50
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
51
51
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
52
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId
|
|
53
|
-
|
|
54
|
-
if (accessory.context.FirmwareRevision) {
|
|
55
|
-
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
56
|
-
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
57
|
-
accessory
|
|
58
|
-
.getService(this.platform.Service.AccessoryInformation)!
|
|
59
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
60
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
61
|
-
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
62
|
-
.updateValue(accessory.context.FirmwareRevision);
|
|
63
|
-
} else {
|
|
64
|
-
this.setFirmwareRevision(accessory, device);
|
|
65
|
-
}
|
|
52
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId)
|
|
53
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision);
|
|
66
54
|
|
|
67
55
|
// deviceType
|
|
68
56
|
if (this.otherDeviceType === 'switch') {
|
|
@@ -646,16 +634,6 @@ export class Others {
|
|
|
646
634
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
|
|
647
635
|
}
|
|
648
636
|
}
|
|
649
|
-
// FirmwareRevision
|
|
650
|
-
if (this.FirmwareRevision === undefined) {
|
|
651
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
652
|
-
} else {
|
|
653
|
-
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
654
|
-
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
655
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
656
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
657
|
-
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
658
|
-
}
|
|
659
637
|
}
|
|
660
638
|
|
|
661
639
|
async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
@@ -885,34 +863,16 @@ export class Others {
|
|
|
885
863
|
}
|
|
886
864
|
}
|
|
887
865
|
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
async setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig) {
|
|
891
|
-
if (device.firmware) {
|
|
892
|
-
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
893
|
-
accessory.context.FirmwareRevision = device.firmware;
|
|
894
|
-
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
895
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
896
|
-
} else {
|
|
897
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
898
|
-
accessory.context.FirmwareRevision = this.platform.version;
|
|
899
|
-
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
900
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
901
|
-
}
|
|
902
|
-
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
903
|
-
accessory
|
|
904
|
-
.getService(this.platform.Service.AccessoryInformation)!
|
|
905
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
906
|
-
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
907
|
-
.updateValue(this.FirmwareRevision);
|
|
908
|
-
}
|
|
909
|
-
|
|
910
866
|
async context() {
|
|
911
867
|
if (this.On === undefined) {
|
|
912
868
|
this.On = true;
|
|
913
869
|
} else {
|
|
914
870
|
this.On = this.accessory.context.On;
|
|
915
871
|
}
|
|
872
|
+
if (this.FirmwareRevision === undefined) {
|
|
873
|
+
this.FirmwareRevision = this.platform.version;
|
|
874
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
875
|
+
}
|
|
916
876
|
}
|
|
917
877
|
|
|
918
878
|
async config(device: irdevice & irDevicesConfig): Promise<void> {
|
package/src/irdevice/tv.ts
CHANGED
|
@@ -43,20 +43,8 @@ export class TV {
|
|
|
43
43
|
.setCharacteristic(this.platform.Characteristic.Name, `${device.deviceName} ${device.remoteType}`)
|
|
44
44
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
45
45
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
46
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId
|
|
47
|
-
|
|
48
|
-
if (accessory.context.FirmwareRevision) {
|
|
49
|
-
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
50
|
-
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
51
|
-
accessory
|
|
52
|
-
.getService(this.platform.Service.AccessoryInformation)!
|
|
53
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
54
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
55
|
-
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
56
|
-
.updateValue(accessory.context.FirmwareRevision);
|
|
57
|
-
} else {
|
|
58
|
-
this.setFirmwareRevision(accessory, device);
|
|
59
|
-
}
|
|
46
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId)
|
|
47
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision);
|
|
60
48
|
|
|
61
49
|
// set the accessory category
|
|
62
50
|
switch (device.remoteType) {
|
|
@@ -424,16 +412,6 @@ export class TV {
|
|
|
424
412
|
this.tvService?.updateCharacteristic(this.platform.Characteristic.ActiveIdentifier, this.ActiveIdentifier);
|
|
425
413
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName}` + ` updateCharacteristic ActiveIdentifier: ${this.ActiveIdentifier}`);
|
|
426
414
|
}
|
|
427
|
-
// FirmwareRevision
|
|
428
|
-
if (this.FirmwareRevision === undefined) {
|
|
429
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
430
|
-
} else {
|
|
431
|
-
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
432
|
-
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
433
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
434
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
435
|
-
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
436
|
-
}
|
|
437
415
|
}
|
|
438
416
|
|
|
439
417
|
async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
@@ -535,28 +513,6 @@ export class TV {
|
|
|
535
513
|
this.tvService.updateCharacteristic(this.platform.Characteristic.ActiveIdentifier, e);
|
|
536
514
|
}
|
|
537
515
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
async setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig) {
|
|
541
|
-
if (device.firmware) {
|
|
542
|
-
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
543
|
-
accessory.context.FirmwareRevision = device.firmware;
|
|
544
|
-
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
545
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
546
|
-
} else {
|
|
547
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
548
|
-
accessory.context.FirmwareRevision = this.platform.version;
|
|
549
|
-
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
550
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
551
|
-
}
|
|
552
|
-
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
553
|
-
accessory
|
|
554
|
-
.getService(this.platform.Service.AccessoryInformation)!
|
|
555
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
556
|
-
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
557
|
-
.updateValue(this.FirmwareRevision);
|
|
558
|
-
}
|
|
559
|
-
|
|
560
516
|
async context() {
|
|
561
517
|
if (this.Active === undefined) {
|
|
562
518
|
this.Active = this.platform.Characteristic.Active.INACTIVE;
|
|
@@ -568,6 +524,10 @@ export class TV {
|
|
|
568
524
|
} else {
|
|
569
525
|
this.ActiveIdentifier = this.accessory.context.ActiveIdentifier;
|
|
570
526
|
}
|
|
527
|
+
if (this.FirmwareRevision === undefined) {
|
|
528
|
+
this.FirmwareRevision = this.platform.version;
|
|
529
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
530
|
+
}
|
|
571
531
|
}
|
|
572
532
|
|
|
573
533
|
async config(device: irdevice & irDevicesConfig): Promise<void> {
|
|
@@ -38,20 +38,8 @@ export class VacuumCleaner {
|
|
|
38
38
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
39
39
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
40
40
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
41
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId
|
|
42
|
-
|
|
43
|
-
if (accessory.context.FirmwareRevision) {
|
|
44
|
-
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
45
|
-
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
46
|
-
accessory
|
|
47
|
-
.getService(this.platform.Service.AccessoryInformation)!
|
|
48
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
49
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
50
|
-
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
51
|
-
.updateValue(accessory.context.FirmwareRevision);
|
|
52
|
-
} else {
|
|
53
|
-
this.setFirmwareRevision(accessory, device);
|
|
54
|
-
}
|
|
41
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId)
|
|
42
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision);
|
|
55
43
|
|
|
56
44
|
// get the Television service if it exists, otherwise create a new Television service
|
|
57
45
|
// you can create multiple services for each accessory
|
|
@@ -163,16 +151,6 @@ export class VacuumCleaner {
|
|
|
163
151
|
this.switchService?.updateCharacteristic(this.platform.Characteristic.On, this.On);
|
|
164
152
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
|
|
165
153
|
}
|
|
166
|
-
// FirmwareRevision
|
|
167
|
-
if (this.FirmwareRevision === undefined) {
|
|
168
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
169
|
-
} else {
|
|
170
|
-
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
171
|
-
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
172
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
173
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
174
|
-
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
175
|
-
}
|
|
176
154
|
}
|
|
177
155
|
|
|
178
156
|
async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
@@ -265,34 +243,16 @@ export class VacuumCleaner {
|
|
|
265
243
|
this.switchService.updateCharacteristic(this.platform.Characteristic.On, e);
|
|
266
244
|
}
|
|
267
245
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
async setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig) {
|
|
271
|
-
if (device.firmware) {
|
|
272
|
-
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
273
|
-
accessory.context.FirmwareRevision = device.firmware;
|
|
274
|
-
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
275
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
276
|
-
} else {
|
|
277
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
278
|
-
accessory.context.FirmwareRevision = this.platform.version;
|
|
279
|
-
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
280
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
281
|
-
}
|
|
282
|
-
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
283
|
-
accessory
|
|
284
|
-
.getService(this.platform.Service.AccessoryInformation)!
|
|
285
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
286
|
-
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
287
|
-
.updateValue(this.FirmwareRevision);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
246
|
async context() {
|
|
291
247
|
if (this.On === undefined) {
|
|
292
248
|
this.On = false;
|
|
293
249
|
} else {
|
|
294
250
|
this.On = this.accessory.context.On;
|
|
295
251
|
}
|
|
252
|
+
if (this.FirmwareRevision === undefined) {
|
|
253
|
+
this.FirmwareRevision = this.platform.version;
|
|
254
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
255
|
+
}
|
|
296
256
|
}
|
|
297
257
|
|
|
298
258
|
async config(device: irdevice & irDevicesConfig): Promise<void> {
|
|
@@ -38,20 +38,8 @@ export class WaterHeater {
|
|
|
38
38
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
39
39
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
40
40
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
41
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId
|
|
42
|
-
|
|
43
|
-
if (accessory.context.FirmwareRevision) {
|
|
44
|
-
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
45
|
-
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
46
|
-
accessory
|
|
47
|
-
.getService(this.platform.Service.AccessoryInformation)!
|
|
48
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
49
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
50
|
-
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
51
|
-
.updateValue(accessory.context.FirmwareRevision);
|
|
52
|
-
} else {
|
|
53
|
-
this.setFirmwareRevision(accessory, device);
|
|
54
|
-
}
|
|
41
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId)
|
|
42
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision);
|
|
55
43
|
|
|
56
44
|
// get the Television service if it exists, otherwise create a new Television service
|
|
57
45
|
// you can create multiple services for each accessory
|
|
@@ -172,16 +160,6 @@ export class WaterHeater {
|
|
|
172
160
|
this.valveService?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
|
|
173
161
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
|
|
174
162
|
}
|
|
175
|
-
// FirmwareRevision
|
|
176
|
-
if (this.FirmwareRevision === undefined) {
|
|
177
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
178
|
-
} else {
|
|
179
|
-
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
180
|
-
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
181
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
182
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
183
|
-
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
184
|
-
}
|
|
185
163
|
}
|
|
186
164
|
|
|
187
165
|
async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
@@ -274,34 +252,16 @@ export class WaterHeater {
|
|
|
274
252
|
this.valveService.updateCharacteristic(this.platform.Characteristic.Active, e);
|
|
275
253
|
}
|
|
276
254
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
async setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig) {
|
|
280
|
-
if (device.firmware) {
|
|
281
|
-
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
282
|
-
accessory.context.FirmwareRevision = device.firmware;
|
|
283
|
-
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
284
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
285
|
-
} else {
|
|
286
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
287
|
-
accessory.context.FirmwareRevision = this.platform.version;
|
|
288
|
-
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
289
|
-
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
290
|
-
}
|
|
291
|
-
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
292
|
-
accessory
|
|
293
|
-
.getService(this.platform.Service.AccessoryInformation)!
|
|
294
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
295
|
-
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
296
|
-
.updateValue(this.FirmwareRevision);
|
|
297
|
-
}
|
|
298
|
-
|
|
299
255
|
async context(): Promise<void> {
|
|
300
256
|
if (this.Active === undefined) {
|
|
301
257
|
this.Active = this.platform.Characteristic.Active.INACTIVE;
|
|
302
258
|
} else {
|
|
303
259
|
this.Active = this.accessory.context.Active;
|
|
304
260
|
}
|
|
261
|
+
if (this.FirmwareRevision === undefined) {
|
|
262
|
+
this.FirmwareRevision = this.platform.version;
|
|
263
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
264
|
+
}
|
|
305
265
|
}
|
|
306
266
|
|
|
307
267
|
async config(device: irdevice & irDevicesConfig): Promise<void> {
|