@switchbot/homebridge-switchbot 3.5.1-beta.17 → 3.5.1-beta.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/device/blindtilt.js +8 -8
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.js +2 -2
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.js +2 -2
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.js +2 -2
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.js +2 -2
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.js +2 -2
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/device.d.ts.map +1 -1
- package/dist/device/device.js +6 -28
- package/dist/device/device.js.map +1 -1
- package/dist/device/fan.js +6 -6
- package/dist/device/fan.js.map +1 -1
- package/dist/device/hub.js +2 -2
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.js +2 -2
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.js +2 -2
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.js +2 -2
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.js +2 -2
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.js +2 -2
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.js +2 -2
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.js +2 -2
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.js +2 -2
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.js +2 -2
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/device/waterdetector.js +2 -2
- package/dist/device/waterdetector.js.map +1 -1
- package/dist/homebridge-ui/public/index.html +2 -2
- package/dist/irdevice/airconditioner.js +2 -2
- package/dist/irdevice/irdevice.d.ts.map +1 -1
- package/dist/irdevice/irdevice.js +5 -33
- package/dist/irdevice/irdevice.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +396 -498
- package/dist/platform.js.map +1 -1
- package/package.json +1 -1
- package/src/device/blindtilt.ts +8 -8
- package/src/device/bot.ts +2 -2
- package/src/device/ceilinglight.ts +2 -2
- package/src/device/colorbulb.ts +2 -2
- package/src/device/contact.ts +2 -2
- package/src/device/curtain.ts +2 -2
- package/src/device/device.ts +6 -24
- package/src/device/fan.ts +6 -6
- package/src/device/hub.ts +2 -2
- package/src/device/humidifier.ts +2 -2
- package/src/device/iosensor.ts +2 -2
- package/src/device/lightstrip.ts +2 -2
- package/src/device/lock.ts +2 -2
- package/src/device/meter.ts +2 -2
- package/src/device/meterplus.ts +2 -2
- package/src/device/motion.ts +2 -2
- package/src/device/plug.ts +2 -2
- package/src/device/robotvacuumcleaner.ts +2 -2
- package/src/device/waterdetector.ts +2 -2
- package/src/homebridge-ui/public/index.html +2 -2
- package/src/irdevice/airconditioner.ts +2 -2
- package/src/irdevice/irdevice.ts +5 -28
- package/src/platform.ts +397 -528
package/src/device/bot.ts
CHANGED
|
@@ -613,8 +613,8 @@ export class Bot extends deviceBase {
|
|
|
613
613
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, deviceVersion)
|
|
614
614
|
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
|
|
615
615
|
.updateValue(deviceVersion);
|
|
616
|
-
this.accessory.context.
|
|
617
|
-
await this.debugLog(`
|
|
616
|
+
this.accessory.context.version = deviceVersion;
|
|
617
|
+
await this.debugLog(`version: ${this.accessory.context.version}`);
|
|
618
618
|
}
|
|
619
619
|
}
|
|
620
620
|
|
|
@@ -246,8 +246,8 @@ export class CeilingLight extends deviceBase {
|
|
|
246
246
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, deviceVersion)
|
|
247
247
|
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
|
|
248
248
|
.updateValue(deviceVersion);
|
|
249
|
-
this.accessory.context.
|
|
250
|
-
await this.debugSuccessLog(`
|
|
249
|
+
this.accessory.context.version = deviceVersion;
|
|
250
|
+
await this.debugSuccessLog(`version: ${this.accessory.context.version}`);
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
|
package/src/device/colorbulb.ts
CHANGED
|
@@ -257,8 +257,8 @@ export class ColorBulb extends deviceBase {
|
|
|
257
257
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, deviceVersion)
|
|
258
258
|
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
|
|
259
259
|
.updateValue(deviceVersion);
|
|
260
|
-
this.accessory.context.
|
|
261
|
-
await this.debugSuccessLog(`
|
|
260
|
+
this.accessory.context.version = deviceVersion;
|
|
261
|
+
await this.debugSuccessLog(`version: ${this.accessory.context.version}`);
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
|
package/src/device/contact.ts
CHANGED
|
@@ -254,8 +254,8 @@ export class Contact extends deviceBase {
|
|
|
254
254
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, deviceVersion)
|
|
255
255
|
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
|
|
256
256
|
.updateValue(deviceVersion);
|
|
257
|
-
this.accessory.context.
|
|
258
|
-
await this.debugLog(`
|
|
257
|
+
this.accessory.context.version = deviceVersion;
|
|
258
|
+
await this.debugLog(`version: ${this.accessory.context.version}`);
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
|
package/src/device/curtain.ts
CHANGED
|
@@ -396,8 +396,8 @@ export class Curtain extends deviceBase {
|
|
|
396
396
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, deviceVersion)
|
|
397
397
|
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
|
|
398
398
|
.updateValue(deviceVersion);
|
|
399
|
-
this.accessory.context.
|
|
400
|
-
await this.debugSuccessLog(`
|
|
399
|
+
this.accessory.context.version = deviceVersion;
|
|
400
|
+
await this.debugSuccessLog(`version: ${this.accessory.context.version}`);
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
403
|
|
package/src/device/device.ts
CHANGED
|
@@ -79,8 +79,8 @@ export abstract class deviceBase {
|
|
|
79
79
|
.getService(this.hap.Service.AccessoryInformation)!
|
|
80
80
|
.setCharacteristic(this.hap.Characteristic.Manufacturer, 'SwitchBot')
|
|
81
81
|
.setCharacteristic(this.hap.Characteristic.AppMatchingIdentifier, 'id1087374760')
|
|
82
|
-
.setCharacteristic(this.hap.Characteristic.Name, device.deviceName ?? accessory.displayName)
|
|
83
|
-
.setCharacteristic(this.hap.Characteristic.ConfiguredName, device.
|
|
82
|
+
.setCharacteristic(this.hap.Characteristic.Name, device.configDeviceName ?? device.deviceName ?? accessory.displayName)
|
|
83
|
+
.setCharacteristic(this.hap.Characteristic.ConfiguredName, device.configDeviceName ?? device.deviceName ?? accessory.displayName)
|
|
84
84
|
.setCharacteristic(this.hap.Characteristic.Model, device.model ?? accessory.context.model)
|
|
85
85
|
.setCharacteristic(this.hap.Characteristic.ProductData, device.deviceId ?? accessory.context.deviceId)
|
|
86
86
|
.setCharacteristic(this.hap.Characteristic.SerialNumber, device.deviceId);
|
|
@@ -659,32 +659,14 @@ export abstract class deviceBase {
|
|
|
659
659
|
device.bleModelName = SwitchBotBLEModelName.Unknown;
|
|
660
660
|
device.bleModelFriednlyName = SwitchBotBLEModelFriendlyName.Unknown;
|
|
661
661
|
}
|
|
662
|
-
this.debugLog(`Model: ${device.model}, BLE Model: ${device.bleModel}, BLE Model Name: ${device.bleModelName}, `
|
|
662
|
+
await this.debugLog(`Model: ${device.model}, BLE Model: ${device.bleModel}, BLE Model Name: ${device.bleModelName}, `
|
|
663
663
|
+ `BLE Model Friendly Name: ${device.bleModelFriednlyName}`);
|
|
664
664
|
accessory.context.model = device.model;
|
|
665
665
|
accessory.context.bleModel = device.bleModel;
|
|
666
666
|
accessory.context.bleModelName = device.bleModelName;
|
|
667
667
|
accessory.context.bleModelFriednlyName = device.bleModelFriednlyName;
|
|
668
668
|
|
|
669
|
-
|
|
670
|
-
let deviceFirmwareVersion: string;
|
|
671
|
-
if (device.firmware) {
|
|
672
|
-
deviceFirmwareVersion = device.firmware;
|
|
673
|
-
this.debugSuccessLog(`1 FirmwareRevision: ${device.firmware}`);
|
|
674
|
-
} else if (device.version) {
|
|
675
|
-
deviceFirmwareVersion = JSON.stringify(device.version);
|
|
676
|
-
this.debugSuccessLog(`2 FirmwareRevision: ${device.version}`);
|
|
677
|
-
} else if (accessory.context.deviceVersion) {
|
|
678
|
-
deviceFirmwareVersion = accessory.context.deviceVersion;
|
|
679
|
-
this.debugSuccessLog(`3 FirmwareRevision: ${accessory.context.deviceVersion}`);
|
|
680
|
-
} else {
|
|
681
|
-
deviceFirmwareVersion = this.platform.version ?? '0.0.0';
|
|
682
|
-
if (this.platform.version) {
|
|
683
|
-
this.debugSuccessLog(`4 FirmwareRevision: ${this.platform.version}`);
|
|
684
|
-
} else {
|
|
685
|
-
this.debugSuccessLog(`5 FirmwareRevision: ${deviceFirmwareVersion}`);
|
|
686
|
-
}
|
|
687
|
-
}
|
|
669
|
+
const deviceFirmwareVersion = device.firmware ?? device.version ?? accessory.context.version ?? this.platform.version ?? '0.0.0';
|
|
688
670
|
const version = deviceFirmwareVersion.toString();
|
|
689
671
|
this.debugLog(`Firmware Version: ${version.replace(/^V|-.*$/g, '')}`);
|
|
690
672
|
let deviceVersion: string;
|
|
@@ -703,8 +685,8 @@ export abstract class deviceBase {
|
|
|
703
685
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, deviceVersion)
|
|
704
686
|
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
|
|
705
687
|
.updateValue(deviceVersion);
|
|
706
|
-
accessory.context.
|
|
707
|
-
this.debugSuccessLog(`
|
|
688
|
+
accessory.context.version = deviceVersion;
|
|
689
|
+
this.debugSuccessLog(`version: ${accessory.context.version}`);
|
|
708
690
|
}
|
|
709
691
|
|
|
710
692
|
async statusCode(statusCode: number): Promise<void> {
|
package/src/device/fan.ts
CHANGED
|
@@ -215,7 +215,7 @@ export class Fan extends deviceBase {
|
|
|
215
215
|
await this.debugLog('openAPIparseStatus');
|
|
216
216
|
await this.debugLog(`(version, battery, powerState, oscillation, chargingStatus, fanSpeed) = OpenAPI:(${this.deviceStatus.version},`
|
|
217
217
|
+ ` ${this.deviceStatus.battery}, ${this.deviceStatus.power}, ${this.deviceStatus.oscillation}, ${this.deviceStatus.chargingStatus},`
|
|
218
|
-
+ ` ${this.deviceStatus.fanSpeed}), current:(${this.accessory.context.
|
|
218
|
+
+ ` ${this.deviceStatus.fanSpeed}), current:(${this.accessory.context.version}, ${this.Battery.BatteryLevel}, ${this.Fan.Active},`
|
|
219
219
|
+ ` ${this.Fan.SwingMode}, ${this.Battery.ChargingState}, ${this.Fan.RotationSpeed})`);
|
|
220
220
|
|
|
221
221
|
// Active
|
|
@@ -255,8 +255,8 @@ export class Fan extends deviceBase {
|
|
|
255
255
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, deviceVersion)
|
|
256
256
|
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
|
|
257
257
|
.updateValue(deviceVersion);
|
|
258
|
-
this.accessory.context.
|
|
259
|
-
await this.debugSuccessLog(`
|
|
258
|
+
this.accessory.context.version = deviceVersion;
|
|
259
|
+
await this.debugSuccessLog(`version: ${this.accessory.context.version}`);
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
|
|
@@ -264,7 +264,7 @@ export class Fan extends deviceBase {
|
|
|
264
264
|
await this.debugLog('parseStatusWebhook');
|
|
265
265
|
await this.debugLog(`(version, battery, powerState, oscillation, chargingStatus, fanSpeed) = Webhook:(${this.webhookContext.version},`
|
|
266
266
|
+ ` ${this.webhookContext.battery}, ${this.webhookContext.powerState}, ${this.webhookContext.oscillation},`
|
|
267
|
-
+ ` ${this.webhookContext.chargingStatus}, ${this.webhookContext.fanSpeed}), current:(${this.accessory.context.
|
|
267
|
+
+ ` ${this.webhookContext.chargingStatus}, ${this.webhookContext.fanSpeed}), current:(${this.accessory.context.version},`
|
|
268
268
|
+ ` ${this.Battery.BatteryLevel}, ${this.Fan.Active}, ${this.Fan.SwingMode}, ${this.Battery.ChargingState}, ${this.Fan.RotationSpeed})`);
|
|
269
269
|
|
|
270
270
|
// Active
|
|
@@ -303,8 +303,8 @@ export class Fan extends deviceBase {
|
|
|
303
303
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, deviceVersion)
|
|
304
304
|
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
|
|
305
305
|
.updateValue(deviceVersion);
|
|
306
|
-
this.accessory.context.
|
|
307
|
-
await this.debugSuccessLog(`
|
|
306
|
+
this.accessory.context.version = deviceVersion;
|
|
307
|
+
await this.debugSuccessLog(`version: ${this.accessory.context.version}`);
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
|
package/src/device/hub.ts
CHANGED
|
@@ -233,8 +233,8 @@ export class Hub extends deviceBase {
|
|
|
233
233
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, deviceVersion)
|
|
234
234
|
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
|
|
235
235
|
.updateValue(deviceVersion);
|
|
236
|
-
this.accessory.context.
|
|
237
|
-
await this.debugSuccessLog(`
|
|
236
|
+
this.accessory.context.version = deviceVersion;
|
|
237
|
+
await this.debugSuccessLog(`version: ${this.accessory.context.version}`);
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
|
package/src/device/humidifier.ts
CHANGED
|
@@ -289,8 +289,8 @@ export class Humidifier extends deviceBase {
|
|
|
289
289
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, deviceVersion)
|
|
290
290
|
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
|
|
291
291
|
.updateValue(deviceVersion);
|
|
292
|
-
this.accessory.context.
|
|
293
|
-
await this.debugSuccessLog(`
|
|
292
|
+
this.accessory.context.version = deviceVersion;
|
|
293
|
+
await this.debugSuccessLog(`version: ${this.accessory.context.version}`);
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
|
package/src/device/iosensor.ts
CHANGED
|
@@ -237,8 +237,8 @@ export class IOSensor extends deviceBase {
|
|
|
237
237
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, deviceVersion)
|
|
238
238
|
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
|
|
239
239
|
.updateValue(deviceVersion);
|
|
240
|
-
this.accessory.context.
|
|
241
|
-
await this.debugSuccessLog(`
|
|
240
|
+
this.accessory.context.version = deviceVersion;
|
|
241
|
+
await this.debugSuccessLog(`version: ${this.accessory.context.version}`);
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
|
package/src/device/lightstrip.ts
CHANGED
|
@@ -260,8 +260,8 @@ export class StripLight extends deviceBase {
|
|
|
260
260
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, deviceVersion)
|
|
261
261
|
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
|
|
262
262
|
.updateValue(deviceVersion);
|
|
263
|
-
this.accessory.context.
|
|
264
|
-
await this.debugSuccessLog(`
|
|
263
|
+
this.accessory.context.version = deviceVersion;
|
|
264
|
+
await this.debugSuccessLog(`version: ${this.accessory.context.version}`);
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
267
|
|
package/src/device/lock.ts
CHANGED
|
@@ -271,8 +271,8 @@ export class Lock extends deviceBase {
|
|
|
271
271
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, deviceVersion)
|
|
272
272
|
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
|
|
273
273
|
.updateValue(deviceVersion);
|
|
274
|
-
this.accessory.context.
|
|
275
|
-
await this.debugSuccessLog(`
|
|
274
|
+
this.accessory.context.version = deviceVersion;
|
|
275
|
+
await this.debugSuccessLog(`version: ${this.accessory.context.version}`);
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
|
package/src/device/meter.ts
CHANGED
|
@@ -229,8 +229,8 @@ export class Meter extends deviceBase {
|
|
|
229
229
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, deviceVersion)
|
|
230
230
|
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
|
|
231
231
|
.updateValue(deviceVersion);
|
|
232
|
-
this.accessory.context.
|
|
233
|
-
await this.debugSuccessLog(`
|
|
232
|
+
this.accessory.context.version = deviceVersion;
|
|
233
|
+
await this.debugSuccessLog(`version: ${this.accessory.context.version}`);
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
|
package/src/device/meterplus.ts
CHANGED
|
@@ -230,8 +230,8 @@ export class MeterPlus extends deviceBase {
|
|
|
230
230
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, deviceVersion)
|
|
231
231
|
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
|
|
232
232
|
.updateValue(deviceVersion);
|
|
233
|
-
this.accessory.context.
|
|
234
|
-
this.debugSuccessLog(`
|
|
233
|
+
this.accessory.context.version = deviceVersion;
|
|
234
|
+
this.debugSuccessLog(`v: ${this.accessory.context.version}`);
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
|
package/src/device/motion.ts
CHANGED
|
@@ -217,8 +217,8 @@ export class Motion extends deviceBase {
|
|
|
217
217
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, deviceVersion)
|
|
218
218
|
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
|
|
219
219
|
.updateValue(deviceVersion);
|
|
220
|
-
this.accessory.context.
|
|
221
|
-
await this.debugLog(`
|
|
220
|
+
this.accessory.context.version = deviceVersion;
|
|
221
|
+
await this.debugLog(`version: ${this.accessory.context.version}`);
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
|
package/src/device/plug.ts
CHANGED
|
@@ -128,8 +128,8 @@ export class Plug extends deviceBase {
|
|
|
128
128
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, deviceVersion)
|
|
129
129
|
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
|
|
130
130
|
.updateValue(deviceVersion);
|
|
131
|
-
this.accessory.context.
|
|
132
|
-
await this.debugSuccessLog(`
|
|
131
|
+
this.accessory.context.version = deviceVersion;
|
|
132
|
+
await this.debugSuccessLog(`version: ${this.accessory.context.version}`);
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
|
|
@@ -214,8 +214,8 @@ export class RobotVacuumCleaner extends deviceBase {
|
|
|
214
214
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, deviceVersion)
|
|
215
215
|
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
|
|
216
216
|
.updateValue(deviceVersion);
|
|
217
|
-
this.accessory.context.
|
|
218
|
-
await this.debugSuccessLog(`
|
|
217
|
+
this.accessory.context.version = deviceVersion;
|
|
218
|
+
await this.debugSuccessLog(`version: ${this.accessory.context.version}`);
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
|
|
@@ -196,8 +196,8 @@ export class WaterDetector extends deviceBase {
|
|
|
196
196
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, deviceVersion)
|
|
197
197
|
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
|
|
198
198
|
.updateValue(deviceVersion);
|
|
199
|
-
this.accessory.context.
|
|
200
|
-
await this.debugSuccessLog(`
|
|
199
|
+
this.accessory.context.version = deviceVersion;
|
|
200
|
+
await this.debugSuccessLog(`version: ${this.accessory.context.version}`);
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
<tbody>
|
|
52
52
|
<tr>
|
|
53
53
|
<th scope="row">Device ID</th>
|
|
54
|
-
<td id="
|
|
54
|
+
<td id="deviceId"></td>
|
|
55
55
|
</tr>
|
|
56
56
|
<tr>
|
|
57
57
|
<th scope="row">Model</th>
|
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
const thisAcc = cachedAccessories.find((x) => x.UUID === UUID);
|
|
167
167
|
const context = thisAcc.context;
|
|
168
168
|
document.getElementById('displayName').innerHTML = thisAcc.displayName;
|
|
169
|
-
document.getElementById('
|
|
169
|
+
document.getElementById('deviceId').innerHTML = context.deviceId;
|
|
170
170
|
document.getElementById('model').innerHTML = context.model;
|
|
171
171
|
document.getElementById('version').innerHTML = context.version;
|
|
172
172
|
document.getElementById('deviceType').innerHTML = context.deviceType;
|
|
@@ -375,7 +375,7 @@ export class AirConditioner extends irdeviceBase {
|
|
|
375
375
|
if (this.meter?.context?.CurrentTemperature) {
|
|
376
376
|
this.accessory.context.CurrentTemperature = this.meter.context.CurrentTemperature;
|
|
377
377
|
await this.debugLog(''
|
|
378
|
-
+ `Using CurrentTemperature from ${this.meter.context.deviceType} (${this.meter.context.
|
|
378
|
+
+ `Using CurrentTemperature from ${this.meter.context.deviceType} (${this.meter.context.deviceId})`);
|
|
379
379
|
}
|
|
380
380
|
|
|
381
381
|
this.HeaterCooler.CurrentTemperature = this.accessory.context.CurrentTemperature || 24;
|
|
@@ -387,7 +387,7 @@ export class AirConditioner extends irdeviceBase {
|
|
|
387
387
|
if (this.meter?.context?.CurrentRelativeHumidity) {
|
|
388
388
|
this.accessory.context.CurrentRelativeHumidity = this.meter.context.CurrentRelativeHumidity;
|
|
389
389
|
await this.debugLog(''
|
|
390
|
-
+ `Using CurrentRelativeHumidity from ${this.meter.context.deviceType} (${this.meter.context.
|
|
390
|
+
+ `Using CurrentRelativeHumidity from ${this.meter.context.deviceType} (${this.meter.context.deviceId})`);
|
|
391
391
|
}
|
|
392
392
|
|
|
393
393
|
this.HumiditySensor!.CurrentRelativeHumidity = this.accessory.context.CurrentRelativeHumidity || 0;
|
package/src/irdevice/irdevice.ts
CHANGED
|
@@ -43,8 +43,8 @@ export abstract class irdeviceBase {
|
|
|
43
43
|
.getService(this.hap.Service.AccessoryInformation)!
|
|
44
44
|
.setCharacteristic(this.hap.Characteristic.Manufacturer, 'SwitchBot')
|
|
45
45
|
.setCharacteristic(this.hap.Characteristic.AppMatchingIdentifier, 'id1087374760')
|
|
46
|
-
.setCharacteristic(this.hap.Characteristic.Name,
|
|
47
|
-
.setCharacteristic(this.hap.Characteristic.ConfiguredName, device.
|
|
46
|
+
.setCharacteristic(this.hap.Characteristic.Name, device.configDeviceName ?? device.deviceName ?? accessory.displayName)
|
|
47
|
+
.setCharacteristic(this.hap.Characteristic.ConfiguredName, device.configDeviceName ?? device.deviceName ?? accessory.displayName)
|
|
48
48
|
.setCharacteristic(this.hap.Characteristic.Model, accessory.context.model ?? 'Unknown')
|
|
49
49
|
.setCharacteristic(this.hap.Characteristic.ProductData, accessory.context.deviceId)
|
|
50
50
|
.setCharacteristic(this.hap.Characteristic.SerialNumber, accessory.context.deviceId);
|
|
@@ -146,31 +146,8 @@ export abstract class irdeviceBase {
|
|
|
146
146
|
accessory.context.model = device.remoteType;
|
|
147
147
|
accessory.context.deviceId = device.deviceId;
|
|
148
148
|
accessory.context.remoteType = device.remoteType;
|
|
149
|
-
if (device.firmware) {
|
|
150
|
-
accessory.context.firmware = device.firmware;
|
|
151
|
-
} else if (device.firmware === undefined || accessory.context.firmware === undefined) {
|
|
152
|
-
device.firmware = this.platform.version;
|
|
153
|
-
accessory.context.firmware = device.firmware;
|
|
154
|
-
} else {
|
|
155
|
-
accessory.context.firmware = 'Unknown';
|
|
156
|
-
}
|
|
157
149
|
|
|
158
|
-
|
|
159
|
-
let deviceFirmwareVersion: string;
|
|
160
|
-
if (device.firmware) {
|
|
161
|
-
deviceFirmwareVersion = device.firmware;
|
|
162
|
-
this.debugSuccessLog(`${device.remoteType}: ${accessory.displayName} 1 FirmwareRevision: ${device.firmware}`);
|
|
163
|
-
} else if (accessory.context.deviceVersion) {
|
|
164
|
-
deviceFirmwareVersion = accessory.context.deviceVersion;
|
|
165
|
-
this.debugSuccessLog(`${device.remoteType}: ${accessory.displayName} 2 FirmwareRevision: ${accessory.context.deviceVersion}`);
|
|
166
|
-
} else {
|
|
167
|
-
deviceFirmwareVersion = this.platform.version ?? '0.0.0';
|
|
168
|
-
if (this.platform.version) {
|
|
169
|
-
this.debugSuccessLog(`${device.remoteType}: ${accessory.displayName} 3 FirmwareRevision: ${this.platform.version}`);
|
|
170
|
-
} else {
|
|
171
|
-
this.debugSuccessLog(`${device.remoteType}: ${accessory.displayName} 4 FirmwareRevision: ${deviceFirmwareVersion}`);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
150
|
+
const deviceFirmwareVersion = device.firmware ?? accessory.context.version ?? this.platform.version ?? '0.0.0';
|
|
174
151
|
const version = deviceFirmwareVersion.toString();
|
|
175
152
|
await this.debugLog(`${this.device.remoteType}: ${accessory.displayName} Firmware Version: ${version?.replace(/^V|-.*$/g, '')}`);
|
|
176
153
|
let deviceVersion: string;
|
|
@@ -189,8 +166,8 @@ export abstract class irdeviceBase {
|
|
|
189
166
|
.setCharacteristic(this.hap.Characteristic.FirmwareRevision, deviceVersion)
|
|
190
167
|
.getCharacteristic(this.hap.Characteristic.FirmwareRevision)
|
|
191
168
|
.updateValue(deviceVersion);
|
|
192
|
-
accessory.context.
|
|
193
|
-
this.debugSuccessLog(
|
|
169
|
+
accessory.context.version = deviceVersion;
|
|
170
|
+
this.debugSuccessLog(`version: ${accessory.context.version}`);
|
|
194
171
|
}
|
|
195
172
|
|
|
196
173
|
async pushChangeRequest(bodyChange: string): Promise<{ body: any; statusCode: any; }> {
|