@switchbot/homebridge-switchbot 2.8.2-beta.0 → 2.8.2-beta.2
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 +1 -1
- package/dist/device/blindtilt.d.ts +2 -1
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +26 -14
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts +2 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +19 -15
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts +2 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +16 -14
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts +2 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +21 -14
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts +2 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +16 -14
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts +2 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +19 -14
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/hub.d.ts +2 -1
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +16 -14
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts +5 -4
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +16 -14
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts +2 -1
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +16 -14
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts +2 -1
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +21 -14
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts +2 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +16 -14
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +3 -2
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +35 -26
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts +3 -2
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +33 -23
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts +5 -4
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +16 -14
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts +2 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +17 -14
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts +2 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +19 -13
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +7 -19
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +36 -18
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +4 -7
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +26 -12
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +4 -7
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +24 -12
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +4 -7
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +23 -12
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts +4 -7
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +24 -12
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +4 -7
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +24 -12
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +5 -10
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +27 -14
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +4 -7
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +24 -12
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +6 -16
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +28 -16
- package/dist/irdevice/waterheater.js.map +1 -1
- package/package.json +2 -2
- package/src/device/blindtilt.ts +28 -16
- package/src/device/bot.ts +21 -15
- package/src/device/ceilinglight.ts +20 -14
- package/src/device/colorbulb.ts +23 -14
- package/src/device/contact.ts +20 -14
- package/src/device/curtain.ts +22 -15
- package/src/device/hub.ts +20 -14
- package/src/device/humidifier.ts +23 -17
- package/src/device/iosensor.ts +20 -14
- package/src/device/lightstrip.ts +23 -14
- package/src/device/lock.ts +20 -14
- package/src/device/meter.ts +39 -27
- package/src/device/meterplus.ts +38 -26
- package/src/device/motion.ts +24 -23
- package/src/device/plug.ts +20 -14
- package/src/device/robotvacuumcleaner.ts +21 -13
- package/src/irdevice/airconditioner.ts +36 -18
- package/src/irdevice/airpurifier.ts +26 -12
- package/src/irdevice/camera.ts +24 -12
- package/src/irdevice/fan.ts +23 -12
- package/src/irdevice/light.ts +24 -12
- package/src/irdevice/other.ts +24 -12
- package/src/irdevice/tv.ts +27 -14
- package/src/irdevice/vacuumcleaner.ts +24 -12
- package/src/irdevice/waterheater.ts +28 -16
package/src/device/plug.ts
CHANGED
|
@@ -13,6 +13,7 @@ export class Plug {
|
|
|
13
13
|
|
|
14
14
|
// Characteristic Values
|
|
15
15
|
On!: CharacteristicValue;
|
|
16
|
+
FirmwareRevision!: CharacteristicValue;
|
|
16
17
|
|
|
17
18
|
// OpenAPI Others
|
|
18
19
|
OpenAPI_On: deviceStatus['power'];
|
|
@@ -60,9 +61,9 @@ export class Plug {
|
|
|
60
61
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
61
62
|
.setCharacteristic(this.platform.Characteristic.Model, this.model(device))
|
|
62
63
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
63
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
64
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
|
|
64
65
|
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
65
|
-
.updateValue(this.
|
|
66
|
+
.updateValue(this.setFirmwareRevision(accessory, device));
|
|
66
67
|
|
|
67
68
|
// get the Outlet service if it exists, otherwise create a new Outlet service
|
|
68
69
|
// you can create multiple services for each accessory
|
|
@@ -153,6 +154,9 @@ export class Plug {
|
|
|
153
154
|
this.On = false;
|
|
154
155
|
}
|
|
155
156
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.On}`);
|
|
157
|
+
|
|
158
|
+
// FirmwareRevision
|
|
159
|
+
this.FirmwareRevision = JSON.stringify(this.OpenAPI_FirmwareRevision);
|
|
156
160
|
}
|
|
157
161
|
|
|
158
162
|
/**
|
|
@@ -413,6 +417,7 @@ export class Plug {
|
|
|
413
417
|
}
|
|
414
418
|
|
|
415
419
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
420
|
+
// On
|
|
416
421
|
if (this.On === undefined) {
|
|
417
422
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.On}`);
|
|
418
423
|
} else {
|
|
@@ -421,14 +426,14 @@ export class Plug {
|
|
|
421
426
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
|
|
422
427
|
}
|
|
423
428
|
// FirmwareRevision
|
|
424
|
-
if (this.
|
|
425
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.
|
|
429
|
+
if (this.FirmwareRevision === undefined) {
|
|
430
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
426
431
|
} else {
|
|
427
|
-
this.accessory.context.
|
|
432
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
428
433
|
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
429
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
434
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
430
435
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
431
|
-
+ `updateCharacteristic FirmwareRevision: ${this.
|
|
436
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
432
437
|
}
|
|
433
438
|
}
|
|
434
439
|
|
|
@@ -582,23 +587,24 @@ export class Plug {
|
|
|
582
587
|
this.outletService.updateCharacteristic(this.platform.Characteristic.On, e);
|
|
583
588
|
}
|
|
584
589
|
|
|
585
|
-
|
|
586
|
-
|
|
590
|
+
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
|
|
591
|
+
|
|
587
592
|
this.debugLog(
|
|
588
593
|
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
589
594
|
);
|
|
590
595
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
591
596
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
592
597
|
if (device.firmware) {
|
|
593
|
-
FirmwareRevision = device.firmware;
|
|
598
|
+
this.FirmwareRevision = device.firmware;
|
|
594
599
|
} else if (device.version) {
|
|
595
|
-
FirmwareRevision = JSON.stringify(device.version);
|
|
600
|
+
this.FirmwareRevision = JSON.stringify(device.version);
|
|
596
601
|
} else if (accessory.context.FirmwareRevision) {
|
|
597
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
602
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
598
603
|
} else {
|
|
599
|
-
FirmwareRevision = this.platform.version;
|
|
604
|
+
this.FirmwareRevision = this.platform.version;
|
|
600
605
|
}
|
|
601
|
-
|
|
606
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
607
|
+
return this.FirmwareRevision;
|
|
602
608
|
}
|
|
603
609
|
|
|
604
610
|
async context() {
|
|
@@ -18,6 +18,7 @@ export class RobotVacuumCleaner {
|
|
|
18
18
|
Brightness!: CharacteristicValue;
|
|
19
19
|
BatteryLevel!: CharacteristicValue;
|
|
20
20
|
StatusLowBattery!: CharacteristicValue;
|
|
21
|
+
FirmwareRevision!: CharacteristicValue;
|
|
21
22
|
|
|
22
23
|
// OpenAPI Status
|
|
23
24
|
OpenAPI_On: deviceStatus['power'];
|
|
@@ -68,9 +69,9 @@ export class RobotVacuumCleaner {
|
|
|
68
69
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
69
70
|
.setCharacteristic(this.platform.Characteristic.Model, this.model(device))
|
|
70
71
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
71
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
72
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
|
|
72
73
|
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
73
|
-
.updateValue(this.
|
|
74
|
+
.updateValue(this.setFirmwareRevision(accessory, device));
|
|
74
75
|
|
|
75
76
|
// get the Lightbulb service if it exists, otherwise create a new Lightbulb service
|
|
76
77
|
// you can create multiple services for each accessory
|
|
@@ -199,6 +200,9 @@ export class RobotVacuumCleaner {
|
|
|
199
200
|
this.StatusLowBattery = this.platform.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL;
|
|
200
201
|
}
|
|
201
202
|
this.debugLog(`${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel}, StatusLowBattery: ${this.StatusLowBattery}`);
|
|
203
|
+
|
|
204
|
+
// FirmwareRevision
|
|
205
|
+
this.FirmwareRevision = JSON.stringify(this.OpenAPI_FirmwareRevision);
|
|
202
206
|
}
|
|
203
207
|
|
|
204
208
|
/**
|
|
@@ -553,6 +557,7 @@ export class RobotVacuumCleaner {
|
|
|
553
557
|
}
|
|
554
558
|
|
|
555
559
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
560
|
+
// On
|
|
556
561
|
if (this.On === undefined) {
|
|
557
562
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.On}`);
|
|
558
563
|
} else {
|
|
@@ -560,6 +565,7 @@ export class RobotVacuumCleaner {
|
|
|
560
565
|
this.robotVacuumCleanerService.updateCharacteristic(this.platform.Characteristic.On, this.On);
|
|
561
566
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
|
|
562
567
|
}
|
|
568
|
+
// Brightness
|
|
563
569
|
if (this.Brightness === undefined) {
|
|
564
570
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Brightness: ${this.Brightness}`);
|
|
565
571
|
} else {
|
|
@@ -567,6 +573,7 @@ export class RobotVacuumCleaner {
|
|
|
567
573
|
this.robotVacuumCleanerService.updateCharacteristic(this.platform.Characteristic.Brightness, this.Brightness);
|
|
568
574
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic Brightness: ${this.Brightness}`);
|
|
569
575
|
}
|
|
576
|
+
// BatteryLevel
|
|
570
577
|
if (this.BatteryLevel === undefined) {
|
|
571
578
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel}`);
|
|
572
579
|
} else {
|
|
@@ -574,6 +581,7 @@ export class RobotVacuumCleaner {
|
|
|
574
581
|
this.batteryService?.updateCharacteristic(this.platform.Characteristic.BatteryLevel, this.BatteryLevel);
|
|
575
582
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic BatteryLevel: ${this.BatteryLevel}`);
|
|
576
583
|
}
|
|
584
|
+
// StatusLowBattery
|
|
577
585
|
if (this.StatusLowBattery === undefined) {
|
|
578
586
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} StatusLowBattery: ${this.StatusLowBattery}`);
|
|
579
587
|
} else {
|
|
@@ -582,14 +590,14 @@ export class RobotVacuumCleaner {
|
|
|
582
590
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic StatusLowBattery: ${this.StatusLowBattery}`);
|
|
583
591
|
}
|
|
584
592
|
// FirmwareRevision
|
|
585
|
-
if (this.
|
|
586
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.
|
|
593
|
+
if (this.FirmwareRevision === undefined) {
|
|
594
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
587
595
|
} else {
|
|
588
|
-
this.accessory.context.
|
|
596
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
589
597
|
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
590
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
598
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
591
599
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
592
|
-
+ `updateCharacteristic FirmwareRevision: ${this.
|
|
600
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
593
601
|
}
|
|
594
602
|
}
|
|
595
603
|
|
|
@@ -743,21 +751,21 @@ export class RobotVacuumCleaner {
|
|
|
743
751
|
this.robotVacuumCleanerService.updateCharacteristic(this.platform.Characteristic.On, e);
|
|
744
752
|
}
|
|
745
753
|
|
|
746
|
-
|
|
747
|
-
let FirmwareRevision: string;
|
|
754
|
+
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
|
|
748
755
|
this.debugLog(
|
|
749
756
|
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
750
757
|
);
|
|
751
758
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
752
759
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
753
760
|
if (accessory.context.FirmwareRevision) {
|
|
754
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
761
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
755
762
|
} else if (device.firmware) {
|
|
756
|
-
FirmwareRevision = device.firmware;
|
|
763
|
+
this.FirmwareRevision = device.firmware;
|
|
757
764
|
} else {
|
|
758
|
-
FirmwareRevision = this.platform.version;
|
|
765
|
+
this.FirmwareRevision = this.platform.version;
|
|
759
766
|
}
|
|
760
|
-
|
|
767
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
768
|
+
return this.FirmwareRevision;
|
|
761
769
|
}
|
|
762
770
|
|
|
763
771
|
async context() {
|
|
@@ -15,6 +15,7 @@ export class AirConditioner {
|
|
|
15
15
|
// Characteristic Values
|
|
16
16
|
Active!: CharacteristicValue;
|
|
17
17
|
RotationSpeed!: CharacteristicValue;
|
|
18
|
+
FirmwareRevision!: CharacteristicValue;
|
|
18
19
|
CurrentTemperature!: CharacteristicValue;
|
|
19
20
|
ThresholdTemperature!: CharacteristicValue;
|
|
20
21
|
CurrentRelativeHumidity?: CharacteristicValue;
|
|
@@ -49,12 +50,12 @@ export class AirConditioner {
|
|
|
49
50
|
public device: irdevice & irDevicesConfig,
|
|
50
51
|
) {
|
|
51
52
|
// default placeholders
|
|
52
|
-
this.logs(
|
|
53
|
+
this.logs(device);
|
|
53
54
|
this.context();
|
|
54
|
-
this.disablePushOnChanges(
|
|
55
|
-
this.disablePushOffChanges(
|
|
56
|
-
this.disablePushDetailChanges(
|
|
57
|
-
this.config(
|
|
55
|
+
this.disablePushOnChanges(device);
|
|
56
|
+
this.disablePushOffChanges(device);
|
|
57
|
+
this.disablePushDetailChanges(device);
|
|
58
|
+
this.config(device);
|
|
58
59
|
|
|
59
60
|
// set accessory information
|
|
60
61
|
accessory
|
|
@@ -62,9 +63,9 @@ export class AirConditioner {
|
|
|
62
63
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
63
64
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
64
65
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
65
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
66
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
|
|
66
67
|
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
67
|
-
.updateValue(this.
|
|
68
|
+
.updateValue(this.setFirmwareRevision(accessory, device));
|
|
68
69
|
|
|
69
70
|
// get the Television service if it exists, otherwise create a new Television service
|
|
70
71
|
// you can create multiple services for each accessory
|
|
@@ -445,6 +446,7 @@ export class AirConditioner {
|
|
|
445
446
|
}
|
|
446
447
|
|
|
447
448
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
449
|
+
// Active
|
|
448
450
|
if (this.Active === undefined) {
|
|
449
451
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Active}`);
|
|
450
452
|
} else {
|
|
@@ -452,6 +454,7 @@ export class AirConditioner {
|
|
|
452
454
|
this.coolerService?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
|
|
453
455
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
|
|
454
456
|
}
|
|
457
|
+
// RotationSpeed
|
|
455
458
|
if (this.RotationSpeed === undefined) {
|
|
456
459
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} RotationSpeed: ${this.RotationSpeed}`);
|
|
457
460
|
} else {
|
|
@@ -459,6 +462,7 @@ export class AirConditioner {
|
|
|
459
462
|
this.coolerService?.updateCharacteristic(this.platform.Characteristic.RotationSpeed, this.RotationSpeed);
|
|
460
463
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic RotationSpeed: ${this.RotationSpeed}`);
|
|
461
464
|
}
|
|
465
|
+
// CurrentTemperature
|
|
462
466
|
if (this.CurrentTemperature === undefined) {
|
|
463
467
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentTemperature: ${this.CurrentTemperature}`);
|
|
464
468
|
} else {
|
|
@@ -466,6 +470,7 @@ export class AirConditioner {
|
|
|
466
470
|
this.coolerService?.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, this.CurrentTemperature);
|
|
467
471
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic CurrentTemperature: ${this.CurrentTemperature}`);
|
|
468
472
|
}
|
|
473
|
+
// CurrentRelativeHumidity
|
|
469
474
|
if (this.meter) {
|
|
470
475
|
if (this.CurrentRelativeHumidity === undefined) {
|
|
471
476
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
|
|
@@ -477,6 +482,7 @@ export class AirConditioner {
|
|
|
477
482
|
);
|
|
478
483
|
}
|
|
479
484
|
}
|
|
485
|
+
// TargetHeaterCoolerState
|
|
480
486
|
if (this.TargetHeaterCoolerState === undefined) {
|
|
481
487
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`);
|
|
482
488
|
} else {
|
|
@@ -486,6 +492,7 @@ export class AirConditioner {
|
|
|
486
492
|
`${this.device.remoteType}: ${this.accessory.displayName}` + ` updateCharacteristic TargetHeaterCoolerState: ${this.TargetHeaterCoolerState}`,
|
|
487
493
|
);
|
|
488
494
|
}
|
|
495
|
+
// CurrentHeaterCoolerState
|
|
489
496
|
if (this.CurrentHeaterCoolerState === undefined) {
|
|
490
497
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
|
|
491
498
|
} else {
|
|
@@ -496,6 +503,7 @@ export class AirConditioner {
|
|
|
496
503
|
` updateCharacteristic CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`,
|
|
497
504
|
);
|
|
498
505
|
}
|
|
506
|
+
// ThresholdTemperature
|
|
499
507
|
if (this.ThresholdTemperature === undefined) {
|
|
500
508
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} ThresholdTemperature: ${this.ThresholdTemperature}`);
|
|
501
509
|
} else {
|
|
@@ -506,9 +514,19 @@ export class AirConditioner {
|
|
|
506
514
|
`${this.device.remoteType}: ${this.accessory.displayName}` + ` updateCharacteristic ThresholdTemperature: ${this.ThresholdTemperature}`,
|
|
507
515
|
);
|
|
508
516
|
}
|
|
517
|
+
// FirmwareRevision
|
|
518
|
+
if (this.FirmwareRevision === undefined) {
|
|
519
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
520
|
+
} else {
|
|
521
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
522
|
+
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
523
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
524
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
525
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
526
|
+
}
|
|
509
527
|
}
|
|
510
528
|
|
|
511
|
-
async disablePushOnChanges(
|
|
529
|
+
async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
512
530
|
if (device.disablePushOn === undefined) {
|
|
513
531
|
this.disablePushOn = false;
|
|
514
532
|
} else {
|
|
@@ -516,7 +534,7 @@ export class AirConditioner {
|
|
|
516
534
|
}
|
|
517
535
|
}
|
|
518
536
|
|
|
519
|
-
async disablePushOffChanges(
|
|
537
|
+
async disablePushOffChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
520
538
|
if (device.disablePushOff === undefined) {
|
|
521
539
|
this.disablePushOff = false;
|
|
522
540
|
} else {
|
|
@@ -524,7 +542,7 @@ export class AirConditioner {
|
|
|
524
542
|
}
|
|
525
543
|
}
|
|
526
544
|
|
|
527
|
-
async disablePushDetailChanges(
|
|
545
|
+
async disablePushDetailChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
528
546
|
if (device.disablePushDetail === undefined) {
|
|
529
547
|
this.disablePushDetail = false;
|
|
530
548
|
} else {
|
|
@@ -613,21 +631,21 @@ export class AirConditioner {
|
|
|
613
631
|
this.coolerService.updateCharacteristic(this.platform.Characteristic.CoolingThresholdTemperature, e);
|
|
614
632
|
}
|
|
615
633
|
|
|
616
|
-
|
|
617
|
-
let FirmwareRevision: string;
|
|
634
|
+
setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): string {
|
|
618
635
|
this.debugLog(
|
|
619
636
|
`${this.device.remoteType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
620
637
|
);
|
|
621
638
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
622
639
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
623
640
|
if (accessory.context.FirmwareRevision) {
|
|
624
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
641
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
625
642
|
} else if (device.firmware) {
|
|
626
|
-
FirmwareRevision = device.firmware;
|
|
643
|
+
this.FirmwareRevision = device.firmware;
|
|
627
644
|
} else {
|
|
628
|
-
FirmwareRevision = this.platform.version
|
|
645
|
+
this.FirmwareRevision = this.platform.version!;
|
|
629
646
|
}
|
|
630
|
-
|
|
647
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
648
|
+
return JSON.stringify(this.FirmwareRevision);
|
|
631
649
|
}
|
|
632
650
|
|
|
633
651
|
async context(): Promise<void> {
|
|
@@ -674,7 +692,7 @@ export class AirConditioner {
|
|
|
674
692
|
}
|
|
675
693
|
}
|
|
676
694
|
|
|
677
|
-
async config(
|
|
695
|
+
async config(device: irdevice & irDevicesConfig): Promise<void> {
|
|
678
696
|
let config = {};
|
|
679
697
|
if (device.irair) {
|
|
680
698
|
config = device.irair;
|
|
@@ -711,7 +729,7 @@ export class AirConditioner {
|
|
|
711
729
|
}
|
|
712
730
|
}
|
|
713
731
|
|
|
714
|
-
async logs(
|
|
732
|
+
async logs(device: irdevice & irDevicesConfig): Promise<void> {
|
|
715
733
|
if (this.platform.debugMode) {
|
|
716
734
|
this.deviceLogging = this.accessory.context.logging = 'debugMode';
|
|
717
735
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Using Debug Mode Logging: ${this.deviceLogging}`);
|
|
@@ -18,6 +18,7 @@ export class AirPurifier {
|
|
|
18
18
|
CurrentAPTemp!: CharacteristicValue;
|
|
19
19
|
CurrentAPMode!: CharacteristicValue;
|
|
20
20
|
RotationSpeed!: CharacteristicValue;
|
|
21
|
+
FirmwareRevision!: CharacteristicValue;
|
|
21
22
|
CurrentAPFanSpeed!: CharacteristicValue;
|
|
22
23
|
CurrentTemperature!: CharacteristicValue;
|
|
23
24
|
CurrentAirPurifierState!: CharacteristicValue;
|
|
@@ -46,8 +47,8 @@ export class AirPurifier {
|
|
|
46
47
|
// default placeholders
|
|
47
48
|
this.logs(device);
|
|
48
49
|
this.context();
|
|
49
|
-
this.disablePushOnChanges(
|
|
50
|
-
this.disablePushOffChanges(
|
|
50
|
+
this.disablePushOnChanges(device);
|
|
51
|
+
this.disablePushOffChanges(device);
|
|
51
52
|
this.config(device);
|
|
52
53
|
|
|
53
54
|
// set accessory information
|
|
@@ -56,9 +57,9 @@ export class AirPurifier {
|
|
|
56
57
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
57
58
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
58
59
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
59
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
60
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
|
|
60
61
|
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
61
|
-
.updateValue(this.
|
|
62
|
+
.updateValue(this.setFirmwareRevision(accessory, device));
|
|
62
63
|
|
|
63
64
|
// get the Television service if it exists, otherwise create a new Television service
|
|
64
65
|
// you can create multiple services for each accessory
|
|
@@ -243,6 +244,7 @@ export class AirPurifier {
|
|
|
243
244
|
}
|
|
244
245
|
|
|
245
246
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
247
|
+
// Active
|
|
246
248
|
if (this.Active === undefined) {
|
|
247
249
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} Active: ${this.Active}`);
|
|
248
250
|
} else {
|
|
@@ -250,6 +252,7 @@ export class AirPurifier {
|
|
|
250
252
|
this.airPurifierService?.updateCharacteristic(this.platform.Characteristic.Active, this.Active);
|
|
251
253
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic Active: ${this.Active}`);
|
|
252
254
|
}
|
|
255
|
+
// CurrentAirPurifierState
|
|
253
256
|
if (this.CurrentAirPurifierState === undefined) {
|
|
254
257
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentAirPurifierState: ${this.CurrentAirPurifierState}`);
|
|
255
258
|
} else {
|
|
@@ -259,6 +262,7 @@ export class AirPurifier {
|
|
|
259
262
|
`${this.device.remoteType}: ${this.accessory.displayName}` + ` updateCharacteristic CurrentAirPurifierState: ${this.CurrentAirPurifierState}`,
|
|
260
263
|
);
|
|
261
264
|
}
|
|
265
|
+
// CurrentHeaterCoolerState
|
|
262
266
|
if (this.CurrentHeaterCoolerState === undefined) {
|
|
263
267
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`);
|
|
264
268
|
} else {
|
|
@@ -269,9 +273,19 @@ export class AirPurifier {
|
|
|
269
273
|
` updateCharacteristic CurrentHeaterCoolerState: ${this.CurrentHeaterCoolerState}`,
|
|
270
274
|
);
|
|
271
275
|
}
|
|
276
|
+
// FirmwareRevision
|
|
277
|
+
if (this.FirmwareRevision === undefined) {
|
|
278
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
279
|
+
} else {
|
|
280
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
281
|
+
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
282
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
283
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
284
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
285
|
+
}
|
|
272
286
|
}
|
|
273
287
|
|
|
274
|
-
async disablePushOnChanges(
|
|
288
|
+
async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
275
289
|
if (device.disablePushOn === undefined) {
|
|
276
290
|
this.disablePushOn = false;
|
|
277
291
|
} else {
|
|
@@ -279,7 +293,7 @@ export class AirPurifier {
|
|
|
279
293
|
}
|
|
280
294
|
}
|
|
281
295
|
|
|
282
|
-
async disablePushOffChanges(
|
|
296
|
+
async disablePushOffChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
283
297
|
if (device.disablePushOff === undefined) {
|
|
284
298
|
this.disablePushOff = false;
|
|
285
299
|
} else {
|
|
@@ -364,21 +378,21 @@ export class AirPurifier {
|
|
|
364
378
|
this.airPurifierService.updateCharacteristic(this.platform.Characteristic.Active, e);
|
|
365
379
|
}
|
|
366
380
|
|
|
367
|
-
|
|
368
|
-
let FirmwareRevision: string;
|
|
381
|
+
setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): string {
|
|
369
382
|
this.debugLog(
|
|
370
383
|
`${this.device.remoteType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
371
384
|
);
|
|
372
385
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
373
386
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
374
387
|
if (accessory.context.FirmwareRevision) {
|
|
375
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
388
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
376
389
|
} else if (device.firmware) {
|
|
377
|
-
FirmwareRevision = device.firmware;
|
|
390
|
+
this.FirmwareRevision = device.firmware;
|
|
378
391
|
} else {
|
|
379
|
-
FirmwareRevision = this.platform.version
|
|
392
|
+
this.FirmwareRevision = this.platform.version!;
|
|
380
393
|
}
|
|
381
|
-
|
|
394
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
395
|
+
return JSON.stringify(this.FirmwareRevision);
|
|
382
396
|
}
|
|
383
397
|
|
|
384
398
|
private context() {
|
package/src/irdevice/camera.ts
CHANGED
|
@@ -14,6 +14,7 @@ export class Camera {
|
|
|
14
14
|
|
|
15
15
|
// Characteristic Values
|
|
16
16
|
On!: CharacteristicValue;
|
|
17
|
+
FirmwareRevision!: CharacteristicValue;
|
|
17
18
|
|
|
18
19
|
// Config
|
|
19
20
|
deviceLogging!: string;
|
|
@@ -28,8 +29,8 @@ export class Camera {
|
|
|
28
29
|
// default placeholders
|
|
29
30
|
this.logs(device);
|
|
30
31
|
this.context();
|
|
31
|
-
this.disablePushOnChanges(
|
|
32
|
-
this.disablePushOffChanges(
|
|
32
|
+
this.disablePushOnChanges(device);
|
|
33
|
+
this.disablePushOffChanges(device);
|
|
33
34
|
this.config(device);
|
|
34
35
|
|
|
35
36
|
// set accessory information
|
|
@@ -38,9 +39,9 @@ export class Camera {
|
|
|
38
39
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
39
40
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
40
41
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
41
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
42
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
|
|
42
43
|
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
43
|
-
.updateValue(this.
|
|
44
|
+
.updateValue(this.setFirmwareRevision(accessory, device));
|
|
44
45
|
|
|
45
46
|
// get the Television service if it exists, otherwise create a new Television service
|
|
46
47
|
// you can create multiple services for each accessory
|
|
@@ -148,6 +149,7 @@ export class Camera {
|
|
|
148
149
|
}
|
|
149
150
|
|
|
150
151
|
async updateHomeKitCharacteristics(): Promise<void> {
|
|
152
|
+
// On
|
|
151
153
|
if (this.On === undefined) {
|
|
152
154
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} On: ${this.On}`);
|
|
153
155
|
} else {
|
|
@@ -155,9 +157,19 @@ export class Camera {
|
|
|
155
157
|
this.switchService?.updateCharacteristic(this.platform.Characteristic.On, this.On);
|
|
156
158
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic On: ${this.On}`);
|
|
157
159
|
}
|
|
160
|
+
// FirmwareRevision
|
|
161
|
+
if (this.FirmwareRevision === undefined) {
|
|
162
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
163
|
+
} else {
|
|
164
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
165
|
+
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
166
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
167
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
168
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
169
|
+
}
|
|
158
170
|
}
|
|
159
171
|
|
|
160
|
-
async disablePushOnChanges(
|
|
172
|
+
async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
161
173
|
if (device.disablePushOn === undefined) {
|
|
162
174
|
this.disablePushOn = false;
|
|
163
175
|
} else {
|
|
@@ -165,7 +177,7 @@ export class Camera {
|
|
|
165
177
|
}
|
|
166
178
|
}
|
|
167
179
|
|
|
168
|
-
async disablePushOffChanges(
|
|
180
|
+
async disablePushOffChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
169
181
|
if (device.disablePushOff === undefined) {
|
|
170
182
|
this.disablePushOff = false;
|
|
171
183
|
} else {
|
|
@@ -247,21 +259,21 @@ export class Camera {
|
|
|
247
259
|
this.switchService.updateCharacteristic(this.platform.Characteristic.On, e);
|
|
248
260
|
}
|
|
249
261
|
|
|
250
|
-
|
|
251
|
-
let FirmwareRevision: string;
|
|
262
|
+
setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): string {
|
|
252
263
|
this.debugLog(
|
|
253
264
|
`${this.device.remoteType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
254
265
|
);
|
|
255
266
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
256
267
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
257
268
|
if (accessory.context.FirmwareRevision) {
|
|
258
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
269
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
259
270
|
} else if (device.firmware) {
|
|
260
|
-
FirmwareRevision = device.firmware;
|
|
271
|
+
this.FirmwareRevision = device.firmware;
|
|
261
272
|
} else {
|
|
262
|
-
FirmwareRevision = this.platform.version
|
|
273
|
+
this.FirmwareRevision = this.platform.version!;
|
|
263
274
|
}
|
|
264
|
-
|
|
275
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
276
|
+
return JSON.stringify(this.FirmwareRevision);
|
|
265
277
|
}
|
|
266
278
|
|
|
267
279
|
async context() {
|
package/src/irdevice/fan.ts
CHANGED
|
@@ -16,6 +16,7 @@ export class Fan {
|
|
|
16
16
|
Active!: CharacteristicValue;
|
|
17
17
|
SwingMode!: CharacteristicValue;
|
|
18
18
|
RotationSpeed!: CharacteristicValue;
|
|
19
|
+
FirmwareRevision!: CharacteristicValue;
|
|
19
20
|
ActiveIdentifier!: CharacteristicValue;
|
|
20
21
|
RotationDirection!: CharacteristicValue;
|
|
21
22
|
|
|
@@ -35,8 +36,8 @@ export class Fan {
|
|
|
35
36
|
// default placeholders
|
|
36
37
|
this.logs(device);
|
|
37
38
|
this.context();
|
|
38
|
-
this.disablePushOnChanges(
|
|
39
|
-
this.disablePushOffChanges(
|
|
39
|
+
this.disablePushOnChanges(device);
|
|
40
|
+
this.disablePushOffChanges(device);
|
|
40
41
|
this.config(device);
|
|
41
42
|
|
|
42
43
|
// set accessory information
|
|
@@ -45,9 +46,9 @@ export class Fan {
|
|
|
45
46
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
46
47
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
47
48
|
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
48
|
-
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.
|
|
49
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, this.setFirmwareRevision(accessory, device))
|
|
49
50
|
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
50
|
-
.updateValue(this.
|
|
51
|
+
.updateValue(this.setFirmwareRevision(accessory, device));
|
|
51
52
|
|
|
52
53
|
// get the Television service if it exists, otherwise create a new Television service
|
|
53
54
|
// you can create multiple services for each accessory
|
|
@@ -286,9 +287,19 @@ export class Fan {
|
|
|
286
287
|
this.fanService?.updateCharacteristic(this.platform.Characteristic.RotationSpeed, this.RotationSpeed);
|
|
287
288
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} updateCharacteristic RotationSpeed: ${this.RotationSpeed}`);
|
|
288
289
|
}
|
|
290
|
+
// FirmwareRevision
|
|
291
|
+
if (this.FirmwareRevision === undefined) {
|
|
292
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
293
|
+
} else {
|
|
294
|
+
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
295
|
+
this.accessory.getService(this.platform.Service.AccessoryInformation)!
|
|
296
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
297
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} `
|
|
298
|
+
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
299
|
+
}
|
|
289
300
|
}
|
|
290
301
|
|
|
291
|
-
async disablePushOnChanges(
|
|
302
|
+
async disablePushOnChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
292
303
|
if (device.disablePushOn === undefined) {
|
|
293
304
|
this.disablePushOn = false;
|
|
294
305
|
} else {
|
|
@@ -296,7 +307,7 @@ export class Fan {
|
|
|
296
307
|
}
|
|
297
308
|
}
|
|
298
309
|
|
|
299
|
-
async disablePushOffChanges(
|
|
310
|
+
async disablePushOffChanges(device: irdevice & irDevicesConfig): Promise<void> {
|
|
300
311
|
if (device.disablePushOff === undefined) {
|
|
301
312
|
this.disablePushOff = false;
|
|
302
313
|
} else {
|
|
@@ -380,21 +391,21 @@ export class Fan {
|
|
|
380
391
|
this.fanService.updateCharacteristic(this.platform.Characteristic.SwingMode, e);
|
|
381
392
|
}
|
|
382
393
|
|
|
383
|
-
|
|
384
|
-
let FirmwareRevision: string;
|
|
394
|
+
setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig): string {
|
|
385
395
|
this.debugLog(
|
|
386
396
|
`${this.device.remoteType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
387
397
|
);
|
|
388
398
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
389
399
|
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
390
400
|
if (accessory.context.FirmwareRevision) {
|
|
391
|
-
FirmwareRevision = accessory.context.FirmwareRevision;
|
|
401
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
392
402
|
} else if (device.firmware) {
|
|
393
|
-
FirmwareRevision = device.firmware;
|
|
403
|
+
this.FirmwareRevision = device.firmware;
|
|
394
404
|
} else {
|
|
395
|
-
FirmwareRevision = this.platform.version
|
|
405
|
+
this.FirmwareRevision = this.platform.version!;
|
|
396
406
|
}
|
|
397
|
-
|
|
407
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
408
|
+
return JSON.stringify(this.FirmwareRevision);
|
|
398
409
|
}
|
|
399
410
|
|
|
400
411
|
async context() {
|