@switchbot/homebridge-switchbot 2.8.0-beta.0 → 2.8.0-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/.prettierrc +1 -1
- package/.vscode/settings.json +1 -1
- package/CHANGELOG.md +10 -0
- package/config.schema.json +8 -0
- package/dist/device/blindtilt.d.ts.map +1 -1
- package/dist/device/blindtilt.js +49 -59
- package/dist/device/blindtilt.js.map +1 -1
- package/dist/device/bot.d.ts.map +1 -1
- package/dist/device/bot.js +44 -50
- package/dist/device/bot.js.map +1 -1
- package/dist/device/ceilinglight.d.ts.map +1 -1
- package/dist/device/ceilinglight.js +60 -63
- package/dist/device/ceilinglight.js.map +1 -1
- package/dist/device/colorbulb.d.ts.map +1 -1
- package/dist/device/colorbulb.js +68 -70
- package/dist/device/colorbulb.js.map +1 -1
- package/dist/device/contact.d.ts.map +1 -1
- package/dist/device/contact.js +22 -25
- package/dist/device/contact.js.map +1 -1
- package/dist/device/curtain.d.ts.map +1 -1
- package/dist/device/curtain.js +50 -58
- package/dist/device/curtain.js.map +1 -1
- package/dist/device/hub.d.ts +6 -0
- package/dist/device/hub.d.ts.map +1 -1
- package/dist/device/hub.js +168 -26
- package/dist/device/hub.js.map +1 -1
- package/dist/device/humidifier.d.ts.map +1 -1
- package/dist/device/humidifier.js +49 -56
- package/dist/device/humidifier.js.map +1 -1
- package/dist/device/iosensor.d.ts.map +1 -1
- package/dist/device/iosensor.js +18 -20
- package/dist/device/iosensor.js.map +1 -1
- package/dist/device/lightstrip.d.ts.map +1 -1
- package/dist/device/lightstrip.js +59 -61
- package/dist/device/lightstrip.js.map +1 -1
- package/dist/device/lock.d.ts.map +1 -1
- package/dist/device/lock.js +40 -41
- package/dist/device/lock.js.map +1 -1
- package/dist/device/meter.d.ts +3 -3
- package/dist/device/meter.d.ts.map +1 -1
- package/dist/device/meter.js +65 -68
- package/dist/device/meter.js.map +1 -1
- package/dist/device/meterplus.d.ts.map +1 -1
- package/dist/device/meterplus.js +18 -20
- package/dist/device/meterplus.js.map +1 -1
- package/dist/device/motion.d.ts.map +1 -1
- package/dist/device/motion.js +20 -23
- package/dist/device/motion.js.map +1 -1
- package/dist/device/plug.d.ts.map +1 -1
- package/dist/device/plug.js +30 -33
- package/dist/device/plug.js.map +1 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +1 -1
- package/dist/device/robotvacuumcleaner.js +48 -51
- package/dist/device/robotvacuumcleaner.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js +58 -62
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js +29 -31
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js +17 -20
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js +27 -29
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js +23 -26
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js +19 -20
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js +44 -47
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js +17 -20
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js +19 -20
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +44 -43
- 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/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/device/blindtilt.ts +106 -72
- package/src/device/bot.ts +94 -58
- package/src/device/ceilinglight.ts +102 -68
- package/src/device/colorbulb.ts +134 -82
- package/src/device/contact.ts +54 -33
- package/src/device/curtain.ts +130 -101
- package/src/device/hub.ts +198 -35
- package/src/device/humidifier.ts +128 -80
- package/src/device/iosensor.ts +43 -27
- package/src/device/lightstrip.ts +108 -67
- package/src/device/lock.ts +73 -45
- package/src/device/meter.ts +94 -75
- package/src/device/meterplus.ts +43 -27
- package/src/device/motion.ts +50 -32
- package/src/device/plug.ts +62 -39
- package/src/device/robotvacuumcleaner.ts +78 -54
- package/src/irdevice/airconditioner.ts +112 -84
- package/src/irdevice/airpurifier.ts +55 -34
- package/src/irdevice/camera.ts +35 -23
- package/src/irdevice/fan.ts +47 -33
- package/src/irdevice/light.ts +43 -29
- package/src/irdevice/other.ts +39 -23
- package/src/irdevice/tv.ts +65 -51
- package/src/irdevice/vacuumcleaner.ts +35 -23
- package/src/irdevice/waterheater.ts +43 -27
- package/src/platform.ts +85 -55
- package/src/settings.ts +41 -40
- package/src/utils.ts +1 -1
|
@@ -59,10 +59,14 @@ export class CeilingLight {
|
|
|
59
59
|
doCeilingLightUpdate!: Subject<void>;
|
|
60
60
|
|
|
61
61
|
// Connection
|
|
62
|
-
private readonly BLE =
|
|
63
|
-
private readonly OpenAPI =
|
|
64
|
-
|
|
65
|
-
constructor(
|
|
62
|
+
private readonly BLE = this.device.connectionType === 'BLE' || this.device.connectionType === 'BLE/OpenAPI';
|
|
63
|
+
private readonly OpenAPI = this.device.connectionType === 'OpenAPI' || this.device.connectionType === 'BLE/OpenAPI';
|
|
64
|
+
|
|
65
|
+
constructor(
|
|
66
|
+
private readonly platform: SwitchBotPlatform,
|
|
67
|
+
private accessory: PlatformAccessory,
|
|
68
|
+
public device: device & devicesConfig,
|
|
69
|
+
) {
|
|
66
70
|
// default placeholders
|
|
67
71
|
this.logs(device);
|
|
68
72
|
this.scan(device);
|
|
@@ -202,8 +206,10 @@ export class CeilingLight {
|
|
|
202
206
|
await this.pushChanges();
|
|
203
207
|
} catch (e: any) {
|
|
204
208
|
this.apiError(e);
|
|
205
|
-
this.errorLog(
|
|
206
|
-
|
|
209
|
+
this.errorLog(
|
|
210
|
+
`${this.device.deviceType}: ${this.accessory.displayName} failed pushChanges with ${this.device.connectionType} Connection,` +
|
|
211
|
+
` Error Message: ${JSON.stringify(e.message)}`,
|
|
212
|
+
);
|
|
207
213
|
}
|
|
208
214
|
this.ceilingLightUpdateInProgress = false;
|
|
209
215
|
});
|
|
@@ -227,14 +233,15 @@ export class CeilingLight {
|
|
|
227
233
|
async parseStatus(): Promise<void> {
|
|
228
234
|
if (!this.device.enableCloudService && this.OpenAPI) {
|
|
229
235
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} parseStatus enableCloudService: ${this.device.enableCloudService}`);
|
|
230
|
-
}
|
|
236
|
+
} /*if (this.BLE) {
|
|
231
237
|
await this.BLEparseStatus();
|
|
232
|
-
} else*/ if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
238
|
+
} else*/ else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
233
239
|
await this.openAPIparseStatus();
|
|
234
240
|
} else {
|
|
235
241
|
await this.offlineOff();
|
|
236
|
-
this.debugWarnLog(
|
|
237
|
-
|
|
242
|
+
this.debugWarnLog(
|
|
243
|
+
`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:` + ` ${this.device.connectionType}, parseStatus will not happen.`,
|
|
244
|
+
);
|
|
238
245
|
}
|
|
239
246
|
}
|
|
240
247
|
|
|
@@ -275,8 +282,9 @@ export class CeilingLight {
|
|
|
275
282
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} blue: ${JSON.stringify(blue)}`);
|
|
276
283
|
|
|
277
284
|
const [hue, saturation] = rgb2hs(Number(red), Number(green), Number(blue));
|
|
278
|
-
this.debugLog(
|
|
279
|
-
+ ` hs: ${JSON.stringify(rgb2hs(Number(red), Number(green), Number(blue)))}
|
|
285
|
+
this.debugLog(
|
|
286
|
+
`${this.device.deviceType}: ${this.accessory.displayName}` + ` hs: ${JSON.stringify(rgb2hs(Number(red), Number(green), Number(blue)))}`,
|
|
287
|
+
);
|
|
280
288
|
|
|
281
289
|
// Hue
|
|
282
290
|
this.Hue = hue;
|
|
@@ -305,14 +313,16 @@ export class CeilingLight {
|
|
|
305
313
|
async refreshStatus(): Promise<void> {
|
|
306
314
|
if (!this.device.enableCloudService && this.OpenAPI) {
|
|
307
315
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} refreshStatus enableCloudService: ${this.device.enableCloudService}`);
|
|
308
|
-
}
|
|
316
|
+
} /*if (this.BLE) {
|
|
309
317
|
await this.BLERefreshStatus();
|
|
310
|
-
} else*/ if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
318
|
+
} else*/ else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
311
319
|
await this.openAPIRefreshStatus();
|
|
312
320
|
} else {
|
|
313
321
|
await this.offlineOff();
|
|
314
|
-
this.debugWarnLog(
|
|
315
|
-
|
|
322
|
+
this.debugWarnLog(
|
|
323
|
+
`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:` +
|
|
324
|
+
` ${this.device.connectionType}, refreshStatus will not happen.`,
|
|
325
|
+
);
|
|
316
326
|
}
|
|
317
327
|
}
|
|
318
328
|
|
|
@@ -337,8 +347,10 @@ export class CeilingLight {
|
|
|
337
347
|
// Set an event hander
|
|
338
348
|
switchbot.onadvertisement = async (ad: any) => {
|
|
339
349
|
this.address = ad.address;
|
|
340
|
-
this.debugLog(
|
|
341
|
-
|
|
350
|
+
this.debugLog(
|
|
351
|
+
`${this.device.deviceType}: ${this.accessory.displayName} Config BLE Address: ${this.device.bleMac},` +
|
|
352
|
+
` BLE Address Found: ${this.address}`,
|
|
353
|
+
);
|
|
342
354
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} serviceData: ${JSON.stringify(ad.serviceData)}`);
|
|
343
355
|
this.serviceData = ad.serviceData;
|
|
344
356
|
//this.state = ad.serviceData.state;
|
|
@@ -373,8 +385,10 @@ export class CeilingLight {
|
|
|
373
385
|
})
|
|
374
386
|
.catch(async (e: any) => {
|
|
375
387
|
this.apiError(e);
|
|
376
|
-
this.errorLog(
|
|
377
|
-
|
|
388
|
+
this.errorLog(
|
|
389
|
+
`${this.device.deviceType}: ${this.accessory.displayName} failed BLERefreshStatus with ${this.device.connectionType}` +
|
|
390
|
+
` Connection, Error Message: ${JSON.stringify(e.message)}`,
|
|
391
|
+
);
|
|
378
392
|
await this.BLERefreshConnection(switchbot);
|
|
379
393
|
});
|
|
380
394
|
} else {
|
|
@@ -392,10 +406,7 @@ export class CeilingLight {
|
|
|
392
406
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Devices: ${JSON.stringify(deviceStatus.body)}`);
|
|
393
407
|
this.statusCode(statusCode);
|
|
394
408
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
|
|
395
|
-
this.debugLog(
|
|
396
|
-
`${this.device.deviceType}: ${this.accessory.displayName
|
|
397
|
-
} refreshStatus: ${JSON.stringify(deviceStatus)}`,
|
|
398
|
-
);
|
|
409
|
+
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} refreshStatus: ${JSON.stringify(deviceStatus)}`);
|
|
399
410
|
this.power = deviceStatus.body.power;
|
|
400
411
|
this.color = deviceStatus.body.color;
|
|
401
412
|
this.brightness = deviceStatus.body.brightness;
|
|
@@ -404,8 +415,10 @@ export class CeilingLight {
|
|
|
404
415
|
this.updateHomeKitCharacteristics();
|
|
405
416
|
} catch (e: any) {
|
|
406
417
|
this.apiError(e);
|
|
407
|
-
this.errorLog(
|
|
408
|
-
|
|
418
|
+
this.errorLog(
|
|
419
|
+
`${this.device.deviceType}: ${this.accessory.displayName} failed openAPIRefreshStatus with ${this.device.connectionType}` +
|
|
420
|
+
` Connection, Error Message: ${JSON.stringify(e.message)}`,
|
|
421
|
+
);
|
|
409
422
|
}
|
|
410
423
|
}
|
|
411
424
|
|
|
@@ -423,14 +436,15 @@ export class CeilingLight {
|
|
|
423
436
|
async pushChanges(): Promise<void> {
|
|
424
437
|
if (!this.device.enableCloudService && this.OpenAPI) {
|
|
425
438
|
this.errorLog(`${this.device.deviceType}: ${this.accessory.displayName} pushChanges enableCloudService: ${this.device.enableCloudService}`);
|
|
426
|
-
}
|
|
439
|
+
} /*if (this.BLE) {
|
|
427
440
|
await this.BLEpushChanges();
|
|
428
|
-
} else*/ if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
441
|
+
} else*/ else if (this.OpenAPI && this.platform.config.credentials?.token) {
|
|
429
442
|
await this.openAPIpushChanges();
|
|
430
443
|
} else {
|
|
431
444
|
await this.offlineOff();
|
|
432
|
-
this.debugWarnLog(
|
|
433
|
-
|
|
445
|
+
this.debugWarnLog(
|
|
446
|
+
`${this.device.deviceType}: ${this.accessory.displayName} Connection Type:` + ` ${this.device.connectionType}, pushChanges will not happen.`,
|
|
447
|
+
);
|
|
434
448
|
}
|
|
435
449
|
// Refresh the status from the API
|
|
436
450
|
interval(15000)
|
|
@@ -476,14 +490,15 @@ export class CeilingLight {
|
|
|
476
490
|
})
|
|
477
491
|
.catch(async (e: any) => {
|
|
478
492
|
this.apiError(e);
|
|
479
|
-
this.errorLog(
|
|
480
|
-
|
|
493
|
+
this.errorLog(
|
|
494
|
+
`${this.device.deviceType}: ${this.accessory.displayName} failed BLEpushChanges with ${this.device.connectionType}` +
|
|
495
|
+
` Connection, Error Message: ${JSON.stringify(e.message)}`,
|
|
496
|
+
);
|
|
481
497
|
await this.BLEPushConnection();
|
|
482
498
|
});
|
|
483
499
|
} else {
|
|
484
500
|
this.debugLog(
|
|
485
|
-
`${this.device.deviceType}: ${this.accessory.displayName} No BLEpushChanges.` + `On: ${this.On}, `
|
|
486
|
-
+ `OnCached: ${this.accessory.context.On}`,
|
|
501
|
+
`${this.device.deviceType}: ${this.accessory.displayName} No BLEpushChanges.` + `On: ${this.On}, ` + `OnCached: ${this.accessory.context.On}`,
|
|
487
502
|
);
|
|
488
503
|
}
|
|
489
504
|
}
|
|
@@ -498,9 +513,9 @@ export class CeilingLight {
|
|
|
498
513
|
command = 'turnOff';
|
|
499
514
|
}
|
|
500
515
|
const bodyChange = JSON.stringify({
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
516
|
+
command: `${command}`,
|
|
517
|
+
parameter: 'default',
|
|
518
|
+
commandType: 'command',
|
|
504
519
|
});
|
|
505
520
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
506
521
|
try {
|
|
@@ -515,13 +530,17 @@ export class CeilingLight {
|
|
|
515
530
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Headers: ${JSON.stringify(headers)}`);
|
|
516
531
|
} catch (e: any) {
|
|
517
532
|
this.apiError(e);
|
|
518
|
-
this.errorLog(
|
|
519
|
-
|
|
533
|
+
this.errorLog(
|
|
534
|
+
`${this.device.deviceType}: ${this.accessory.displayName} failed openAPIpushChanges with ${this.device.connectionType}` +
|
|
535
|
+
` Connection, Error Message: ${JSON.stringify(e.message)}`,
|
|
520
536
|
);
|
|
521
537
|
}
|
|
522
538
|
} else {
|
|
523
|
-
this.debugLog(
|
|
524
|
-
|
|
539
|
+
this.debugLog(
|
|
540
|
+
`${this.device.deviceType}: ${this.accessory.displayName} No openAPIpushChanges.` +
|
|
541
|
+
`On: ${this.On}, ` +
|
|
542
|
+
`OnCached: ${this.accessory.context.On}`,
|
|
543
|
+
);
|
|
525
544
|
}
|
|
526
545
|
// Push Hue & Saturation Update
|
|
527
546
|
if (this.On) {
|
|
@@ -545,9 +564,9 @@ export class CeilingLight {
|
|
|
545
564
|
const [red, green, blue] = hs2rgb(Number(this.Hue), Number(this.Saturation));
|
|
546
565
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} rgb: ${JSON.stringify([red, green, blue])}`);
|
|
547
566
|
const bodyChange = JSON.stringify({
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
567
|
+
command: 'setColor',
|
|
568
|
+
parameter: `${red}:${green}:${blue}`,
|
|
569
|
+
commandType: 'command',
|
|
551
570
|
});
|
|
552
571
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
553
572
|
try {
|
|
@@ -562,13 +581,16 @@ export class CeilingLight {
|
|
|
562
581
|
this.debugLog(`Headers: ${JSON.stringify(headers)}`);
|
|
563
582
|
} catch (e: any) {
|
|
564
583
|
this.apiError(e);
|
|
565
|
-
this.errorLog(
|
|
566
|
-
|
|
584
|
+
this.errorLog(
|
|
585
|
+
`${this.device.deviceType}: ${this.accessory.displayName} failed pushHueSaturationChanges with ${this.device.connectionType}` +
|
|
586
|
+
` Connection, Error Message: ${JSON.stringify(e.message)}`,
|
|
567
587
|
);
|
|
568
588
|
}
|
|
569
589
|
} else {
|
|
570
|
-
this.debugLog(
|
|
571
|
-
|
|
590
|
+
this.debugLog(
|
|
591
|
+
`${this.device.deviceType}: ${this.accessory.displayName} No pushHueSaturationChanges. Hue: ${this.Hue}, ` +
|
|
592
|
+
`HueCached: ${this.accessory.context.Hue}, Saturation: ${this.Saturation}, SaturationCached: ${this.accessory.context.Saturation}`,
|
|
593
|
+
);
|
|
572
594
|
}
|
|
573
595
|
}
|
|
574
596
|
|
|
@@ -578,9 +600,9 @@ export class CeilingLight {
|
|
|
578
600
|
const kelvin = Math.round(1000000 / Number(this.ColorTemperature));
|
|
579
601
|
this.cacheKelvin = kelvin;
|
|
580
602
|
const bodyChange = JSON.stringify({
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
603
|
+
command: 'setColorTemperature',
|
|
604
|
+
parameter: `${kelvin}`,
|
|
605
|
+
commandType: 'command',
|
|
584
606
|
});
|
|
585
607
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
586
608
|
try {
|
|
@@ -595,13 +617,16 @@ export class CeilingLight {
|
|
|
595
617
|
this.debugLog(`Headers: ${JSON.stringify(headers)}`);
|
|
596
618
|
} catch (e: any) {
|
|
597
619
|
this.apiError(e);
|
|
598
|
-
this.errorLog(
|
|
599
|
-
|
|
620
|
+
this.errorLog(
|
|
621
|
+
`${this.device.deviceType}: ${this.accessory.displayName} failed pushColorTemperatureChanges with ${this.device.connectionType}` +
|
|
622
|
+
` Connection, Error Message: ${JSON.stringify(e.message)}`,
|
|
600
623
|
);
|
|
601
624
|
}
|
|
602
625
|
} else {
|
|
603
|
-
this.debugLog(
|
|
604
|
-
|
|
626
|
+
this.debugLog(
|
|
627
|
+
`${this.device.deviceType}: ${this.accessory.displayName} No pushColorTemperatureChanges.` +
|
|
628
|
+
`ColorTemperature: ${this.ColorTemperature}, ColorTemperatureCached: ${this.accessory.context.ColorTemperature}`,
|
|
629
|
+
);
|
|
605
630
|
}
|
|
606
631
|
}
|
|
607
632
|
|
|
@@ -609,9 +634,9 @@ export class CeilingLight {
|
|
|
609
634
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} pushBrightnessChanges`);
|
|
610
635
|
if (this.Brightness !== this.accessory.context.Brightness) {
|
|
611
636
|
const bodyChange = JSON.stringify({
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
637
|
+
command: 'setBrightness',
|
|
638
|
+
parameter: `${this.Brightness}`,
|
|
639
|
+
commandType: 'command',
|
|
615
640
|
});
|
|
616
641
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Sending request to SwitchBot API, body: ${bodyChange},`);
|
|
617
642
|
try {
|
|
@@ -626,13 +651,17 @@ export class CeilingLight {
|
|
|
626
651
|
this.debugLog(`Headers: ${JSON.stringify(headers)}`);
|
|
627
652
|
} catch (e: any) {
|
|
628
653
|
this.apiError(e);
|
|
629
|
-
this.errorLog(
|
|
630
|
-
|
|
654
|
+
this.errorLog(
|
|
655
|
+
`${this.device.deviceType}: ${this.accessory.displayName} failed pushBrightnessChanges with ${this.device.connectionType}` +
|
|
656
|
+
` Connection, Error Message: ${JSON.stringify(e.message)}`,
|
|
631
657
|
);
|
|
632
658
|
}
|
|
633
659
|
} else {
|
|
634
|
-
this.debugLog(
|
|
635
|
-
|
|
660
|
+
this.debugLog(
|
|
661
|
+
`${this.device.deviceType}: ${this.accessory.displayName} No pushBrightnessChanges.` +
|
|
662
|
+
`Brightness: ${this.Brightness}, ` +
|
|
663
|
+
`BrightnessCached: ${this.accessory.context.Brightness}`,
|
|
664
|
+
);
|
|
636
665
|
}
|
|
637
666
|
}
|
|
638
667
|
|
|
@@ -884,8 +913,10 @@ export class CeilingLight {
|
|
|
884
913
|
this.offlineOff();
|
|
885
914
|
break;
|
|
886
915
|
case 171:
|
|
887
|
-
this.errorLog(
|
|
888
|
-
|
|
916
|
+
this.errorLog(
|
|
917
|
+
`${this.device.deviceType}: ${this.accessory.displayName} Hub Device is offline, statusCode: ${statusCode}. ` +
|
|
918
|
+
`Hub: ${this.device.hubDeviceId}`,
|
|
919
|
+
);
|
|
889
920
|
this.offlineOff();
|
|
890
921
|
break;
|
|
891
922
|
case 190:
|
|
@@ -901,8 +932,10 @@ export class CeilingLight {
|
|
|
901
932
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} Request successful, statusCode: ${statusCode}`);
|
|
902
933
|
break;
|
|
903
934
|
default:
|
|
904
|
-
this.infoLog(
|
|
905
|
-
|
|
935
|
+
this.infoLog(
|
|
936
|
+
`${this.device.deviceType}: ${this.accessory.displayName} Unknown statusCode: ` +
|
|
937
|
+
`${statusCode}, Submit Bugs Here: ' + 'https://tinyurl.com/SwitchBotBug`,
|
|
938
|
+
);
|
|
906
939
|
}
|
|
907
940
|
}
|
|
908
941
|
|
|
@@ -923,8 +956,9 @@ export class CeilingLight {
|
|
|
923
956
|
|
|
924
957
|
FirmwareRevision(accessory: PlatformAccessory<Context>, device: device & devicesConfig): CharacteristicValue {
|
|
925
958
|
let FirmwareRevision: string;
|
|
926
|
-
this.debugLog(
|
|
927
|
-
+ ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}
|
|
959
|
+
this.debugLog(
|
|
960
|
+
`${this.device.deviceType}: ${this.accessory.displayName}` + ` accessory.context.FirmwareRevision: ${accessory.context.FirmwareRevision}`,
|
|
961
|
+
);
|
|
928
962
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} device.firmware: ${device.firmware}`);
|
|
929
963
|
this.debugLog(`${this.device.deviceType}: ${this.accessory.displayName} this.platform.version: ${this.platform.version}`);
|
|
930
964
|
if (accessory.context.FirmwareRevision) {
|