@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
package/src/device/meterplus.ts
CHANGED
|
@@ -2,8 +2,7 @@ import { connectAsync } from 'async-mqtt';
|
|
|
2
2
|
import { CharacteristicValue, PlatformAccessory, Service, Units } from 'homebridge';
|
|
3
3
|
import { MqttClient } from 'mqtt';
|
|
4
4
|
import { hostname } from 'os';
|
|
5
|
-
import {
|
|
6
|
-
import { skipWhile } from 'rxjs/operators';
|
|
5
|
+
import { interval } from 'rxjs';
|
|
7
6
|
import { request } from 'undici';
|
|
8
7
|
import { Context } from 'vm';
|
|
9
8
|
import { SwitchBotPlatform } from '../platform';
|
|
@@ -18,8 +17,8 @@ import { sleep } from '../utils';
|
|
|
18
17
|
export class MeterPlus {
|
|
19
18
|
// Services
|
|
20
19
|
batteryService: Service;
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
humidityService?: Service;
|
|
21
|
+
temperatureService?: Service;
|
|
23
22
|
|
|
24
23
|
// Characteristic Values
|
|
25
24
|
BatteryLevel!: CharacteristicValue;
|
|
@@ -55,10 +54,6 @@ export class MeterPlus {
|
|
|
55
54
|
deviceLogging!: string;
|
|
56
55
|
deviceRefreshRate!: number;
|
|
57
56
|
|
|
58
|
-
// Updates
|
|
59
|
-
meterUpdateInProgress!: boolean;
|
|
60
|
-
doMeterUpdate: Subject<void>;
|
|
61
|
-
|
|
62
57
|
// Connection
|
|
63
58
|
private readonly BLE = this.device.connectionType === 'BLE' || this.device.connectionType === 'BLE/OpenAPI';
|
|
64
59
|
private readonly OpenAPI = this.device.connectionType === 'OpenAPI' || this.device.connectionType === 'BLE/OpenAPI';
|
|
@@ -72,15 +67,11 @@ export class MeterPlus {
|
|
|
72
67
|
this.logs(device);
|
|
73
68
|
this.scan(device);
|
|
74
69
|
this.refreshRate(device);
|
|
75
|
-
this.context();
|
|
70
|
+
this.context(accessory, device);
|
|
76
71
|
this.setupHistoryService(device);
|
|
77
72
|
this.setupMqtt(device);
|
|
78
73
|
this.config(device);
|
|
79
74
|
|
|
80
|
-
// this is subject we use to track when we need to POST changes to the SwitchBot API
|
|
81
|
-
this.doMeterUpdate = new Subject();
|
|
82
|
-
this.meterUpdateInProgress = false;
|
|
83
|
-
|
|
84
75
|
// Retrieve initial values and updateHomekit
|
|
85
76
|
this.refreshStatus();
|
|
86
77
|
|
|
@@ -89,27 +80,37 @@ export class MeterPlus {
|
|
|
89
80
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
90
81
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
91
82
|
.setCharacteristic(this.platform.Characteristic.Model, this.model(device))
|
|
92
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
.
|
|
83
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
84
|
+
|
|
85
|
+
if (accessory.context.FirmwareRevision) {
|
|
86
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
|
|
87
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
88
|
+
accessory
|
|
89
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
90
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
91
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
92
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
93
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
94
|
+
} else {
|
|
95
|
+
this.setFirmwareRevision(accessory, device);
|
|
96
|
+
}
|
|
96
97
|
|
|
97
98
|
// Temperature Sensor Service
|
|
98
99
|
if (device.meter?.hide_temperature) {
|
|
99
100
|
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Temperature Sensor Service`);
|
|
100
|
-
this.
|
|
101
|
-
accessory.removeService(this.
|
|
102
|
-
} else if (!this.
|
|
101
|
+
this.temperatureService = this.accessory.getService(this.platform.Service.TemperatureSensor);
|
|
102
|
+
accessory.removeService(this.temperatureService!);
|
|
103
|
+
} else if (!this.temperatureService) {
|
|
103
104
|
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Temperature Sensor Service`);
|
|
104
|
-
(this.
|
|
105
|
+
(this.temperatureService =
|
|
105
106
|
this.accessory.getService(this.platform.Service.TemperatureSensor) || this.accessory.addService(this.platform.Service.TemperatureSensor)),
|
|
106
107
|
`${accessory.displayName} Temperature Sensor`;
|
|
107
108
|
|
|
108
|
-
this.
|
|
109
|
-
if (!this.
|
|
110
|
-
this.
|
|
109
|
+
this.temperatureService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Temperature Sensor`);
|
|
110
|
+
if (!this.temperatureService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
111
|
+
this.temperatureService.addCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Temperature Sensor`);
|
|
111
112
|
}
|
|
112
|
-
this.
|
|
113
|
+
this.temperatureService
|
|
113
114
|
.getCharacteristic(this.platform.Characteristic.CurrentTemperature)
|
|
114
115
|
.setProps({
|
|
115
116
|
unit: Units['CELSIUS'],
|
|
@@ -128,19 +129,19 @@ export class MeterPlus {
|
|
|
128
129
|
// Humidity Sensor Service
|
|
129
130
|
if (device.meter?.hide_humidity) {
|
|
130
131
|
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Removing Humidity Sensor Service`);
|
|
131
|
-
this.
|
|
132
|
-
accessory.removeService(this.
|
|
133
|
-
} else if (!this.
|
|
132
|
+
this.humidityService = this.accessory.getService(this.platform.Service.HumiditySensor);
|
|
133
|
+
accessory.removeService(this.humidityService!);
|
|
134
|
+
} else if (!this.humidityService) {
|
|
134
135
|
this.debugLog(`${this.device.deviceType}: ${accessory.displayName} Add Humidity Sensor Service`);
|
|
135
|
-
(this.
|
|
136
|
+
(this.humidityService =
|
|
136
137
|
this.accessory.getService(this.platform.Service.HumiditySensor) || this.accessory.addService(this.platform.Service.HumiditySensor)),
|
|
137
138
|
`${accessory.displayName} Humidity Sensor`;
|
|
138
139
|
|
|
139
|
-
this.
|
|
140
|
-
if (!this.
|
|
141
|
-
this.
|
|
140
|
+
this.humidityService.setCharacteristic(this.platform.Characteristic.Name, `${accessory.displayName} Humidity Sensor`);
|
|
141
|
+
if (!this.humidityService.testCharacteristic(this.platform.Characteristic.ConfiguredName)) {
|
|
142
|
+
this.humidityService.addCharacteristic(this.platform.Characteristic.ConfiguredName, `${accessory.displayName} Humidity Sensor`);
|
|
142
143
|
}
|
|
143
|
-
this.
|
|
144
|
+
this.humidityService
|
|
144
145
|
.getCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity)
|
|
145
146
|
.setProps({
|
|
146
147
|
minStep: 0.1,
|
|
@@ -167,7 +168,6 @@ export class MeterPlus {
|
|
|
167
168
|
|
|
168
169
|
// Start an update interval
|
|
169
170
|
interval(this.deviceRefreshRate * 1000)
|
|
170
|
-
.pipe(skipWhile(() => this.meterUpdateInProgress))
|
|
171
171
|
.subscribe(async () => {
|
|
172
172
|
await this.refreshStatus();
|
|
173
173
|
});
|
|
@@ -255,7 +255,7 @@ export class MeterPlus {
|
|
|
255
255
|
+ ` StatusLowBattery: ${this.StatusLowBattery}`);
|
|
256
256
|
|
|
257
257
|
// FirmwareRevision
|
|
258
|
-
this.FirmwareRevision =
|
|
258
|
+
this.FirmwareRevision = this.OpenAPI_FirmwareRevision!;
|
|
259
259
|
}
|
|
260
260
|
|
|
261
261
|
/**
|
|
@@ -392,18 +392,18 @@ export class MeterPlus {
|
|
|
392
392
|
if (this.CurrentRelativeHumidity === undefined) {
|
|
393
393
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`);
|
|
394
394
|
} else {
|
|
395
|
-
this.accessory.context.CurrentRelativeHumidity = this.CurrentRelativeHumidity;
|
|
396
|
-
this.humidityservice?.updateCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity, this.CurrentRelativeHumidity);
|
|
397
|
-
this.debugLog(
|
|
398
|
-
`${this.device.deviceType}: ${this.accessory.displayName}` +
|
|
399
|
-
` updateCharacteristic CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`,
|
|
400
|
-
);
|
|
401
395
|
if (this.device.mqttURL) {
|
|
402
396
|
mqttmessage.push(`"humidity": ${this.CurrentRelativeHumidity}`);
|
|
403
397
|
}
|
|
404
398
|
if (this.device.history) {
|
|
405
399
|
entry['humidity'] = this.CurrentRelativeHumidity;
|
|
406
400
|
}
|
|
401
|
+
this.accessory.context.CurrentRelativeHumidity = this.CurrentRelativeHumidity;
|
|
402
|
+
this.humidityService?.updateCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity, this.CurrentRelativeHumidity);
|
|
403
|
+
this.debugLog(
|
|
404
|
+
`${this.device.deviceType}: ${this.accessory.displayName}` +
|
|
405
|
+
` updateCharacteristic CurrentRelativeHumidity: ${this.CurrentRelativeHumidity}`,
|
|
406
|
+
);
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
409
|
// CurrentTemperature
|
|
@@ -418,7 +418,7 @@ export class MeterPlus {
|
|
|
418
418
|
entry['temp'] = this.CurrentTemperature;
|
|
419
419
|
}
|
|
420
420
|
this.accessory.context.CurrentTemperature = this.CurrentTemperature;
|
|
421
|
-
this.
|
|
421
|
+
this.temperatureService?.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, this.CurrentTemperature);
|
|
422
422
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} updateCharacteristic CurrentTemperature: ${this.CurrentTemperature}`);
|
|
423
423
|
}
|
|
424
424
|
}
|
|
@@ -452,8 +452,14 @@ export class MeterPlus {
|
|
|
452
452
|
mqttmessage.push(`"FirmwareRevision": ${this.FirmwareRevision}`);
|
|
453
453
|
}
|
|
454
454
|
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
455
|
-
|
|
456
|
-
|
|
455
|
+
|
|
456
|
+
this.batteryService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
457
|
+
if (!this.device.meter?.hide_humidity) {
|
|
458
|
+
this.humidityService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
459
|
+
}
|
|
460
|
+
if (!this.device.meter?.hide_temperature) {
|
|
461
|
+
this.temperatureService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
462
|
+
}
|
|
457
463
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
458
464
|
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
459
465
|
}
|
|
@@ -623,42 +629,44 @@ export class MeterPlus {
|
|
|
623
629
|
|
|
624
630
|
async offlineOff(): Promise<void> {
|
|
625
631
|
if (this.device.offline) {
|
|
626
|
-
await this.context();
|
|
632
|
+
await this.context(this.accessory, this.device);
|
|
627
633
|
await this.updateHomeKitCharacteristics();
|
|
628
634
|
}
|
|
629
635
|
}
|
|
630
636
|
|
|
631
637
|
async apiError(e: any): Promise<void> {
|
|
632
638
|
if (!this.device.meter?.hide_humidity) {
|
|
633
|
-
this.
|
|
639
|
+
this.humidityService?.updateCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity, e);
|
|
634
640
|
}
|
|
635
641
|
if (!this.device.meter?.hide_temperature) {
|
|
636
|
-
this.
|
|
642
|
+
this.temperatureService?.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, e);
|
|
637
643
|
}
|
|
638
644
|
this.batteryService?.updateCharacteristic(this.platform.Characteristic.BatteryLevel, e);
|
|
639
645
|
this.batteryService?.updateCharacteristic(this.platform.Characteristic.StatusLowBattery, e);
|
|
640
646
|
}
|
|
641
647
|
|
|
642
|
-
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig)
|
|
643
|
-
this.
|
|
644
|
-
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
645
|
-
);
|
|
646
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
647
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
648
|
+
async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
|
|
649
|
+
await this.refreshStatus();
|
|
648
650
|
if (device.firmware) {
|
|
649
|
-
this.
|
|
650
|
-
|
|
651
|
-
this.FirmwareRevision = JSON.stringify(device.version);
|
|
652
|
-
} else if (accessory.context.FirmwareRevision) {
|
|
651
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
652
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
653
653
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
654
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
654
655
|
} else {
|
|
655
|
-
this.
|
|
656
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
|
|
657
|
+
accessory.context.FirmwareRevision = device.version;
|
|
658
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
659
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
656
660
|
}
|
|
657
|
-
this.
|
|
658
|
-
|
|
661
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
662
|
+
accessory
|
|
663
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
664
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
665
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
666
|
+
.updateValue(this.FirmwareRevision);
|
|
659
667
|
}
|
|
660
668
|
|
|
661
|
-
async context() {
|
|
669
|
+
async context(accessory, device) {
|
|
662
670
|
if (this.CurrentRelativeHumidity === undefined) {
|
|
663
671
|
this.CurrentRelativeHumidity = 0;
|
|
664
672
|
} else {
|
|
@@ -680,6 +688,12 @@ export class MeterPlus {
|
|
|
680
688
|
} else {
|
|
681
689
|
this.StatusLowBattery = this.accessory.context.StatusLowBattery;
|
|
682
690
|
}
|
|
691
|
+
if (this.FirmwareRevision === undefined) {
|
|
692
|
+
this.FirmwareRevision = this.platform.version;
|
|
693
|
+
} else {
|
|
694
|
+
this.setFirmwareRevision(accessory, device);
|
|
695
|
+
this.FirmwareRevision = this.accessory.context.FirmwareRevision;
|
|
696
|
+
}
|
|
683
697
|
}
|
|
684
698
|
|
|
685
699
|
async refreshRate(device: device & devicesConfig): Promise<void> {
|
package/src/device/motion.ts
CHANGED
|
@@ -79,10 +79,20 @@ export class Motion {
|
|
|
79
79
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
80
80
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
81
81
|
.setCharacteristic(this.platform.Characteristic.Model, 'W1101500')
|
|
82
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
.
|
|
82
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
83
|
+
|
|
84
|
+
if (accessory.context.FirmwareRevision) {
|
|
85
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
|
|
86
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
87
|
+
accessory
|
|
88
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
89
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
90
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
91
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
92
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
93
|
+
} else {
|
|
94
|
+
this.setFirmwareRevision(accessory, device);
|
|
95
|
+
}
|
|
86
96
|
|
|
87
97
|
// get the Battery service if it exists, otherwise create a new Motion service
|
|
88
98
|
// you can create multiple services for each accessory
|
|
@@ -229,7 +239,7 @@ export class Motion {
|
|
|
229
239
|
+ ` StatusLowBattery: ${this.StatusLowBattery}`);
|
|
230
240
|
|
|
231
241
|
// FirmwareRevision
|
|
232
|
-
this.FirmwareRevision =
|
|
242
|
+
this.FirmwareRevision = this.OpenAPI_FirmwareRevision!;
|
|
233
243
|
}
|
|
234
244
|
|
|
235
245
|
/**
|
|
@@ -402,14 +412,16 @@ export class Motion {
|
|
|
402
412
|
);
|
|
403
413
|
}
|
|
404
414
|
}
|
|
405
|
-
|
|
406
415
|
// FirmwareRevision
|
|
407
416
|
if (this.FirmwareRevision === undefined) {
|
|
408
417
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
409
418
|
} else {
|
|
410
419
|
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
411
|
-
this.
|
|
412
|
-
|
|
420
|
+
this.motionSensorService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
421
|
+
this.batteryService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
422
|
+
if (!this.device.motion?.hide_lightsensor) {
|
|
423
|
+
this.lightSensorService!.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
424
|
+
}
|
|
413
425
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
414
426
|
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
415
427
|
}
|
|
@@ -561,24 +573,30 @@ export class Motion {
|
|
|
561
573
|
}
|
|
562
574
|
}
|
|
563
575
|
|
|
564
|
-
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig)
|
|
565
|
-
|
|
566
|
-
this.debugLog(
|
|
567
|
-
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
568
|
-
);
|
|
569
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
570
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
576
|
+
async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
|
|
577
|
+
await this.refreshStatus();
|
|
571
578
|
if (device.firmware) {
|
|
572
|
-
this.
|
|
579
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
580
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
581
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
582
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
573
583
|
} else if (device.version) {
|
|
574
|
-
this.
|
|
575
|
-
|
|
584
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
|
|
585
|
+
accessory.context.FirmwareRevision = device.version;
|
|
576
586
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
587
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
577
588
|
} else {
|
|
578
|
-
this.
|
|
589
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
590
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
591
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
592
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
579
593
|
}
|
|
580
|
-
this.
|
|
581
|
-
|
|
594
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
595
|
+
accessory
|
|
596
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
597
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
598
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
599
|
+
.updateValue(this.FirmwareRevision);
|
|
582
600
|
}
|
|
583
601
|
|
|
584
602
|
async context() {
|
package/src/device/plug.ts
CHANGED
|
@@ -60,10 +60,20 @@ export class Plug {
|
|
|
60
60
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
61
61
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
62
62
|
.setCharacteristic(this.platform.Characteristic.Model, this.model(device))
|
|
63
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
.
|
|
63
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
64
|
+
|
|
65
|
+
if (accessory.context.FirmwareRevision) {
|
|
66
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
|
|
67
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
68
|
+
accessory
|
|
69
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
70
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
71
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
72
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
73
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
74
|
+
} else {
|
|
75
|
+
this.setFirmwareRevision(accessory, device);
|
|
76
|
+
}
|
|
67
77
|
|
|
68
78
|
// get the Outlet service if it exists, otherwise create a new Outlet service
|
|
69
79
|
// you can create multiple services for each accessory
|
|
@@ -156,7 +166,7 @@ export class Plug {
|
|
|
156
166
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} On: ${this.On}`);
|
|
157
167
|
|
|
158
168
|
// FirmwareRevision
|
|
159
|
-
this.FirmwareRevision =
|
|
169
|
+
this.FirmwareRevision = this.OpenAPI_FirmwareRevision!;
|
|
160
170
|
}
|
|
161
171
|
|
|
162
172
|
/**
|
|
@@ -430,8 +440,7 @@ export class Plug {
|
|
|
430
440
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
431
441
|
} else {
|
|
432
442
|
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
433
|
-
this.
|
|
434
|
-
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
443
|
+
this.outletService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
435
444
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
436
445
|
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
437
446
|
}
|
|
@@ -512,6 +521,7 @@ export class Plug {
|
|
|
512
521
|
let model: string;
|
|
513
522
|
if (device.deviceType === 'Plug Mini (US)') {
|
|
514
523
|
model = 'W1901400';
|
|
524
|
+
model = 'W1901401';
|
|
515
525
|
} else if (device.deviceType === 'Plug Mini (JP)') {
|
|
516
526
|
model = 'W2001400';
|
|
517
527
|
} else {
|
|
@@ -587,24 +597,30 @@ export class Plug {
|
|
|
587
597
|
this.outletService.updateCharacteristic(this.platform.Characteristic.On, e);
|
|
588
598
|
}
|
|
589
599
|
|
|
590
|
-
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig)
|
|
591
|
-
|
|
592
|
-
this.debugLog(
|
|
593
|
-
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
594
|
-
);
|
|
595
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
596
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
600
|
+
async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
|
|
601
|
+
await this.refreshStatus();
|
|
597
602
|
if (device.firmware) {
|
|
598
|
-
this.
|
|
603
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
604
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
605
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
606
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
599
607
|
} else if (device.version) {
|
|
600
|
-
this.
|
|
601
|
-
|
|
608
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
|
|
609
|
+
accessory.context.FirmwareRevision = device.version;
|
|
602
610
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
611
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
603
612
|
} else {
|
|
604
|
-
this.
|
|
613
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
614
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
615
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
616
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
605
617
|
}
|
|
606
|
-
this.
|
|
607
|
-
|
|
618
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
619
|
+
accessory
|
|
620
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
621
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
622
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
623
|
+
.updateValue(this.FirmwareRevision);
|
|
608
624
|
}
|
|
609
625
|
|
|
610
626
|
async context() {
|
|
@@ -68,10 +68,20 @@ export class RobotVacuumCleaner {
|
|
|
68
68
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
69
69
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
70
70
|
.setCharacteristic(this.platform.Characteristic.Model, this.model(device))
|
|
71
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
.
|
|
71
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
72
|
+
|
|
73
|
+
if (accessory.context.FirmwareRevision) {
|
|
74
|
+
this.debugWarnLog(`${this.device.deviceType}: ${this.accessory.displayName}`
|
|
75
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
76
|
+
accessory
|
|
77
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
78
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
79
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
80
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
81
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
82
|
+
} else {
|
|
83
|
+
this.setFirmwareRevision(accessory, device);
|
|
84
|
+
}
|
|
75
85
|
|
|
76
86
|
// get the Lightbulb service if it exists, otherwise create a new Lightbulb service
|
|
77
87
|
// you can create multiple services for each accessory
|
|
@@ -202,7 +212,7 @@ export class RobotVacuumCleaner {
|
|
|
202
212
|
this.debugLog(`${this.accessory.displayName} BatteryLevel: ${this.BatteryLevel}, StatusLowBattery: ${this.StatusLowBattery}`);
|
|
203
213
|
|
|
204
214
|
// FirmwareRevision
|
|
205
|
-
this.FirmwareRevision =
|
|
215
|
+
this.FirmwareRevision = this.OpenAPI_FirmwareRevision!;
|
|
206
216
|
}
|
|
207
217
|
|
|
208
218
|
/**
|
|
@@ -594,8 +604,8 @@ export class RobotVacuumCleaner {
|
|
|
594
604
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} FirmwareRevision: ${this.FirmwareRevision}`);
|
|
595
605
|
} else {
|
|
596
606
|
this.accessory.context.FirmwareRevision = this.FirmwareRevision;
|
|
597
|
-
this.
|
|
598
|
-
|
|
607
|
+
this.batteryService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
608
|
+
this.robotVacuumCleanerService.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, this.FirmwareRevision);
|
|
599
609
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} `
|
|
600
610
|
+ `updateCharacteristic FirmwareRevision: ${this.FirmwareRevision}`);
|
|
601
611
|
}
|
|
@@ -751,21 +761,30 @@ export class RobotVacuumCleaner {
|
|
|
751
761
|
this.robotVacuumCleanerService.updateCharacteristic(this.platform.Characteristic.On, e);
|
|
752
762
|
}
|
|
753
763
|
|
|
754
|
-
setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig)
|
|
755
|
-
this.
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
760
|
-
if (accessory.context.FirmwareRevision) {
|
|
764
|
+
async setFirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig) {
|
|
765
|
+
await this.refreshStatus();
|
|
766
|
+
if (device.firmware) {
|
|
767
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
768
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
761
769
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
762
|
-
|
|
763
|
-
|
|
770
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
771
|
+
} else if (device.version) {
|
|
772
|
+
this.warnLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version: ${device.version}`);
|
|
773
|
+
accessory.context.FirmwareRevision = device.version;
|
|
774
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
775
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} device.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
764
776
|
} else {
|
|
765
|
-
this.
|
|
777
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
778
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
779
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
780
|
+
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
766
781
|
}
|
|
767
|
-
this.
|
|
768
|
-
|
|
782
|
+
this.infoLog(`${this.device.deviceType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
783
|
+
accessory
|
|
784
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
785
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
786
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
787
|
+
.updateValue(this.FirmwareRevision);
|
|
769
788
|
}
|
|
770
789
|
|
|
771
790
|
async context() {
|
|
@@ -62,10 +62,20 @@ export class AirConditioner {
|
|
|
62
62
|
.getService(this.platform.Service.AccessoryInformation)!
|
|
63
63
|
.setCharacteristic(this.platform.Characteristic.Manufacturer, 'SwitchBot')
|
|
64
64
|
.setCharacteristic(this.platform.Characteristic.Model, device.remoteType)
|
|
65
|
-
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
.
|
|
65
|
+
.setCharacteristic(this.platform.Characteristic.SerialNumber, device.deviceId!);
|
|
66
|
+
|
|
67
|
+
if (accessory.context.FirmwareRevision) {
|
|
68
|
+
this.debugWarnLog(`${this.device.remoteType}: ${this.accessory.displayName}`
|
|
69
|
+
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`);
|
|
70
|
+
accessory
|
|
71
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
72
|
+
.setCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
73
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
74
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
75
|
+
.updateValue(accessory.context.FirmwareRevision);
|
|
76
|
+
} else {
|
|
77
|
+
this.setFirmwareRevision(accessory, device);
|
|
78
|
+
}
|
|
69
79
|
|
|
70
80
|
// get the Television service if it exists, otherwise create a new Television service
|
|
71
81
|
// you can create multiple services for each accessory
|
|
@@ -631,21 +641,24 @@ export class AirConditioner {
|
|
|
631
641
|
this.coolerService.updateCharacteristic(this.platform.Characteristic.CoolingThresholdTemperature, e);
|
|
632
642
|
}
|
|
633
643
|
|
|
634
|
-
setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig)
|
|
635
|
-
|
|
636
|
-
`${this.device.remoteType}: ${this.accessory.displayName}
|
|
637
|
-
|
|
638
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
639
|
-
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
640
|
-
if (accessory.context.FirmwareRevision) {
|
|
644
|
+
async setFirmwareRevision(accessory: PlatformAccessory, device: irdevice & irDevicesConfig) {
|
|
645
|
+
if (device.firmware) {
|
|
646
|
+
this.warnLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
647
|
+
accessory.context.FirmwareRevision = device.firmware;
|
|
641
648
|
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
642
|
-
|
|
643
|
-
this.FirmwareRevision = device.firmware;
|
|
649
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} device.firmware, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
644
650
|
} else {
|
|
645
|
-
this.
|
|
651
|
+
this.debugLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
652
|
+
accessory.context.FirmwareRevision = this.platform.version;
|
|
653
|
+
this.FirmwareRevision = accessory.context.FirmwareRevision;
|
|
654
|
+
this.errorLog(`${this.device.remoteType}: ${this.accessory.displayName} this.platform.version, FirmwareRevision: ${this.FirmwareRevision}`);
|
|
646
655
|
}
|
|
647
|
-
this.
|
|
648
|
-
|
|
656
|
+
this.infoLog(`${this.device.remoteType}: ${this.accessory.displayName} setFirmwareRevision: ${this.FirmwareRevision}`);
|
|
657
|
+
accessory
|
|
658
|
+
.getService(this.platform.Service.AccessoryInformation)!
|
|
659
|
+
.updateCharacteristic(this.platform.Characteristic.FirmwareRevision, accessory.context.FirmwareRevision)
|
|
660
|
+
.getCharacteristic(this.platform.Characteristic.FirmwareRevision)
|
|
661
|
+
.updateValue(this.FirmwareRevision);
|
|
649
662
|
}
|
|
650
663
|
|
|
651
664
|
async context(): Promise<void> {
|