@switchbot/homebridge-switchbot 2.9.0-beta.2 → 2.9.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config.schema.json +18 -4
- package/dist/device/blindtilt.d.ts +1 -1
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +39 -18
- 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 +73 -20
- 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 +35 -18
- 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 +35 -18
- 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 +42 -18
- 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 +39 -18
- 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 +160 -56
- 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 +38 -18
- 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 +42 -19
- 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 +35 -18
- 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 +39 -18
- 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 +48 -33
- 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 +70 -51
- 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 +39 -18
- 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 +36 -18
- 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 +38 -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 +29 -15
- 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 +29 -15
- 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 +29 -15
- 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 +29 -15
- 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 +29 -15
- 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 +50 -23
- 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 +29 -15
- 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 +29 -15
- 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 +29 -15
- 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/dist/settings.d.ts +1 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js.map +1 -1
- package/package.json +10 -10
- package/src/device/blindtilt.ts +39 -19
- package/src/device/bot.ts +63 -21
- package/src/device/ceilinglight.ts +35 -20
- package/src/device/colorbulb.ts +35 -19
- package/src/device/contact.ts +42 -20
- package/src/device/curtain.ts +39 -19
- package/src/device/hub.ts +176 -66
- package/src/device/humidifier.ts +38 -20
- package/src/device/iosensor.ts +42 -21
- package/src/device/lightstrip.ts +35 -19
- package/src/device/lock.ts +40 -21
- package/src/device/meter.ts +49 -41
- package/src/device/meterplus.ts +75 -61
- package/src/device/motion.ts +39 -21
- package/src/device/plug.ts +36 -20
- package/src/device/robotvacuumcleaner.ts +38 -19
- package/src/irdevice/airconditioner.ts +29 -16
- package/src/irdevice/airpurifier.ts +31 -16
- package/src/irdevice/camera.ts +31 -16
- package/src/irdevice/fan.ts +31 -16
- package/src/irdevice/light.ts +31 -16
- package/src/irdevice/other.ts +50 -24
- package/src/irdevice/tv.ts +31 -16
- package/src/irdevice/vacuumcleaner.ts +31 -16
- package/src/irdevice/waterheater.ts +31 -16
- package/src/platform.ts +4 -0
- package/src/settings.ts +1 -0
|
@@ -56,10 +56,20 @@ 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
|
-
|
|
62
|
-
.
|
|
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
|
+
}
|
|
63
73
|
|
|
64
74
|
// get the Television service if it exists, otherwise create a new Television service
|
|
65
75
|
// you can create multiple services for each accessory
|
|
@@ -378,21 +388,26 @@ export class AirPurifier {
|
|
|
378
388
|
this.airPurifierService.updateCharacteristic(this.platform.Characteristic.Active, e);
|
|
379
389
|
}
|
|
380
390
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
)
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
if (accessory.context.FirmwareRevision) {
|
|
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;
|
|
388
397
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
389
|
-
|
|
390
|
-
this.FirmwareRevision = device.firmware;
|
|
398
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
391
399
|
} else {
|
|
392
|
-
this.
|
|
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}`);
|
|
393
404
|
}
|
|
394
|
-
this.
|
|
395
|
-
|
|
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);
|
|
396
411
|
}
|
|
397
412
|
|
|
398
413
|
private context() {
|
package/src/irdevice/camera.ts
CHANGED
|
@@ -38,10 +38,20 @@ 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
|
-
|
|
44
|
-
.
|
|
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
|
+
}
|
|
45
55
|
|
|
46
56
|
// get the Television service if it exists, otherwise create a new Television service
|
|
47
57
|
// you can create multiple services for each accessory
|
|
@@ -259,21 +269,26 @@ export class Camera {
|
|
|
259
269
|
this.switchService.updateCharacteristic(this.platform.Characteristic.On, e);
|
|
260
270
|
}
|
|
261
271
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
)
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
if (accessory.context.FirmwareRevision) {
|
|
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;
|
|
269
278
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
270
|
-
|
|
271
|
-
this.FirmwareRevision = device.firmware;
|
|
279
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
272
280
|
} else {
|
|
273
|
-
this.
|
|
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}`);
|
|
274
285
|
}
|
|
275
|
-
this.
|
|
276
|
-
|
|
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);
|
|
277
292
|
}
|
|
278
293
|
|
|
279
294
|
async context() {
|
package/src/irdevice/fan.ts
CHANGED
|
@@ -45,10 +45,20 @@ 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
|
-
|
|
51
|
-
.
|
|
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
|
+
}
|
|
52
62
|
|
|
53
63
|
// get the Television service if it exists, otherwise create a new Television service
|
|
54
64
|
// you can create multiple services for each accessory
|
|
@@ -391,21 +401,26 @@ export class Fan {
|
|
|
391
401
|
this.fanService.updateCharacteristic(this.platform.Characteristic.SwingMode, e);
|
|
392
402
|
}
|
|
393
403
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
)
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
if (accessory.context.FirmwareRevision) {
|
|
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;
|
|
401
410
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
402
|
-
|
|
403
|
-
this.FirmwareRevision = device.firmware;
|
|
411
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
404
412
|
} else {
|
|
405
|
-
this.
|
|
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}`);
|
|
406
417
|
}
|
|
407
|
-
this.
|
|
408
|
-
|
|
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);
|
|
409
424
|
}
|
|
410
425
|
|
|
411
426
|
async context() {
|
package/src/irdevice/light.ts
CHANGED
|
@@ -38,10 +38,20 @@ 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
|
-
|
|
44
|
-
.
|
|
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
|
+
}
|
|
45
55
|
|
|
46
56
|
// get the Light service if it exists, otherwise create a new Light service
|
|
47
57
|
// you can create multiple services for each accessory
|
|
@@ -284,21 +294,26 @@ export class Light {
|
|
|
284
294
|
this.lightBulbService.updateCharacteristic(this.platform.Characteristic.On, e);
|
|
285
295
|
}
|
|
286
296
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
)
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
if (accessory.context.FirmwareRevision) {
|
|
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;
|
|
294
303
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
295
|
-
|
|
296
|
-
this.FirmwareRevision = device.firmware;
|
|
304
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
297
305
|
} else {
|
|
298
|
-
this.
|
|
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}`);
|
|
299
310
|
}
|
|
300
|
-
this.
|
|
301
|
-
|
|
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);
|
|
302
317
|
}
|
|
303
318
|
|
|
304
319
|
async context() {
|
package/src/irdevice/other.ts
CHANGED
|
@@ -49,10 +49,20 @@ 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
|
-
|
|
55
|
-
.
|
|
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
|
+
}
|
|
56
66
|
|
|
57
67
|
// deviceType
|
|
58
68
|
if (this.otherDeviceType === 'switch') {
|
|
@@ -349,6 +359,13 @@ export class Others {
|
|
|
349
359
|
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} Set On: ${value}`);
|
|
350
360
|
this.On = value;
|
|
351
361
|
}
|
|
362
|
+
|
|
363
|
+
//pushChanges
|
|
364
|
+
if (this.On) {
|
|
365
|
+
await this.pushOnChanges();
|
|
366
|
+
} else {
|
|
367
|
+
await this.pushOffChanges();
|
|
368
|
+
}
|
|
352
369
|
}
|
|
353
370
|
|
|
354
371
|
/**
|
|
@@ -659,7 +676,9 @@ export class Others {
|
|
|
659
676
|
|
|
660
677
|
async commandType(): Promise<string> {
|
|
661
678
|
let commandType: string;
|
|
662
|
-
if (this.device.customize) {
|
|
679
|
+
if (this.device.commandType && this.device.customize) {
|
|
680
|
+
commandType = this.device.commandType;
|
|
681
|
+
} else if (this.device.customize) {
|
|
663
682
|
commandType = 'customize';
|
|
664
683
|
} else {
|
|
665
684
|
commandType = 'command';
|
|
@@ -852,33 +871,40 @@ export class Others {
|
|
|
852
871
|
}
|
|
853
872
|
|
|
854
873
|
async deviceType(device: irdevice & irDevicesConfig): Promise<void> {
|
|
855
|
-
if (device.other?.deviceType) {
|
|
856
|
-
this.otherDeviceType = this.accessory.context.deviceType
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
874
|
+
if (!device.other?.deviceType && this.accessory.context.deviceType) {
|
|
875
|
+
this.otherDeviceType = this.accessory.context.deviceType;
|
|
876
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Type: ${this.otherDeviceType}, from Accesory Cache.`);
|
|
877
|
+
} else if (device.other?.deviceType) {
|
|
878
|
+
this.accessory.context.deviceType = device.other.deviceType;
|
|
879
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Accesory Cache: ${this.accessory.context.deviceType}`);
|
|
880
|
+
this.otherDeviceType = this.accessory.context.deviceType;
|
|
881
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Device Type: ${this.otherDeviceType}`);
|
|
860
882
|
} else {
|
|
861
883
|
this.otherDeviceType = 'outlet';
|
|
862
|
-
this.
|
|
863
|
-
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} Using default deviceType: ${this.otherDeviceType}`);
|
|
884
|
+
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} no deviceType set, using default deviceType: ${this.otherDeviceType}`);
|
|
864
885
|
}
|
|
865
886
|
}
|
|
866
887
|
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
)
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
if (accessory.context.FirmwareRevision) {
|
|
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;
|
|
874
894
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
875
|
-
|
|
876
|
-
this.FirmwareRevision = device.firmware;
|
|
895
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
877
896
|
} else {
|
|
878
|
-
this.
|
|
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}`);
|
|
879
901
|
}
|
|
880
|
-
this.
|
|
881
|
-
|
|
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);
|
|
882
908
|
}
|
|
883
909
|
|
|
884
910
|
async context() {
|
package/src/irdevice/tv.ts
CHANGED
|
@@ -43,10 +43,20 @@ 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
|
-
|
|
49
|
-
.
|
|
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
|
+
}
|
|
50
60
|
|
|
51
61
|
// set the accessory category
|
|
52
62
|
switch (device.remoteType) {
|
|
@@ -525,21 +535,26 @@ export class TV {
|
|
|
525
535
|
this.tvService.updateCharacteristic(this.platform.Characteristic.ActiveIdentifier, e);
|
|
526
536
|
}
|
|
527
537
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
)
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
if (accessory.context.FirmwareRevision) {
|
|
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;
|
|
535
544
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
536
|
-
|
|
537
|
-
this.FirmwareRevision = device.firmware;
|
|
545
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
538
546
|
} else {
|
|
539
|
-
this.
|
|
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}`);
|
|
540
551
|
}
|
|
541
|
-
this.
|
|
542
|
-
|
|
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);
|
|
543
558
|
}
|
|
544
559
|
|
|
545
560
|
async context() {
|
|
@@ -38,10 +38,20 @@ 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
|
-
|
|
44
|
-
.
|
|
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
|
+
}
|
|
45
55
|
|
|
46
56
|
// get the Television service if it exists, otherwise create a new Television service
|
|
47
57
|
// you can create multiple services for each accessory
|
|
@@ -255,21 +265,26 @@ export class VacuumCleaner {
|
|
|
255
265
|
this.switchService.updateCharacteristic(this.platform.Characteristic.On, e);
|
|
256
266
|
}
|
|
257
267
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
)
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
if (accessory.context.FirmwareRevision) {
|
|
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;
|
|
265
274
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
266
|
-
|
|
267
|
-
this.FirmwareRevision = device.firmware;
|
|
275
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
268
276
|
} else {
|
|
269
|
-
this.
|
|
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}`);
|
|
270
281
|
}
|
|
271
|
-
this.
|
|
272
|
-
|
|
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);
|
|
273
288
|
}
|
|
274
289
|
|
|
275
290
|
async context() {
|
|
@@ -38,10 +38,20 @@ 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
|
-
|
|
44
|
-
.
|
|
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
|
+
}
|
|
45
55
|
|
|
46
56
|
// get the Television service if it exists, otherwise create a new Television service
|
|
47
57
|
// you can create multiple services for each accessory
|
|
@@ -264,21 +274,26 @@ export class WaterHeater {
|
|
|
264
274
|
this.valveService.updateCharacteristic(this.platform.Characteristic.Active, e);
|
|
265
275
|
}
|
|
266
276
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
)
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
if (accessory.context.FirmwareRevision) {
|
|
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;
|
|
274
283
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
275
|
-
|
|
276
|
-
this.FirmwareRevision = device.firmware;
|
|
284
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
277
285
|
} else {
|
|
278
|
-
this.
|
|
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}`);
|
|
279
290
|
}
|
|
280
|
-
this.
|
|
281
|
-
|
|
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);
|
|
282
297
|
}
|
|
283
298
|
|
|
284
299
|
async context(): Promise<void> {
|
package/src/platform.ts
CHANGED
|
@@ -425,6 +425,10 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
425
425
|
}
|
|
426
426
|
|
|
427
427
|
private createDevice(device: device & devicesConfig) {
|
|
428
|
+
if (!device.deviceType) {
|
|
429
|
+
device.deviceType = device.configDeviceType;
|
|
430
|
+
this.errorLog(`API has displaying no deviceType: ${device.deviceType}, So using configDeviceType: ${device.configDeviceType}`);
|
|
431
|
+
}
|
|
428
432
|
switch (device.deviceType!) {
|
|
429
433
|
case 'Humidifier':
|
|
430
434
|
this.debugLog(`Discovered ${device.deviceType}: ${device.deviceId}`);
|
package/src/settings.ts
CHANGED