@switchbot/homebridge-switchbot 0.1.2-beta.21 → 0.1.2-beta.25
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/README.md +2 -1
- package/dist/devices/contact.d.ts +2 -0
- package/dist/devices/contact.d.ts.map +1 -1
- package/dist/devices/contact.js +4 -1
- package/dist/devices/contact.js.map +1 -1
- package/dist/devices/motion.d.ts +1 -0
- package/dist/devices/motion.d.ts.map +1 -1
- package/dist/devices/motion.js +2 -1
- package/dist/devices/motion.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +57 -53
- package/dist/platform.js.map +1 -1
- package/package.json +5 -5
- package/src/devices/contact.ts +6 -1
- package/src/devices/motion.ts +3 -1
- package/src/platform.ts +57 -59
package/dist/platform.js
CHANGED
|
@@ -227,7 +227,9 @@ class SwitchBotPlatform {
|
|
|
227
227
|
this.debug(`Discovered ${device.deviceType}: ${device.deviceId} is Not Supported.`);
|
|
228
228
|
break;
|
|
229
229
|
default:
|
|
230
|
-
|
|
230
|
+
// eslint-disable-next-line max-len
|
|
231
|
+
this.log.info(`Device: ${device.deviceName} with Device Type: ${device.deviceType}, is currently not supported.`);
|
|
232
|
+
this.log.info('Submit Feature Requests Here: https://git.io/JL14Z');
|
|
231
233
|
}
|
|
232
234
|
}
|
|
233
235
|
for (const device of devices.body.infraredRemoteList) {
|
|
@@ -290,7 +292,9 @@ class SwitchBotPlatform {
|
|
|
290
292
|
this.createOthers(device);
|
|
291
293
|
break;
|
|
292
294
|
default:
|
|
293
|
-
|
|
295
|
+
// eslint-disable-next-line max-len
|
|
296
|
+
this.log.info(`Device: ${device.deviceName} with Device Type: ${device.remoteType}, is currently not supported.`);
|
|
297
|
+
this.log.info('Submit Feature Requests Here: https://git.io/JL14Z');
|
|
294
298
|
}
|
|
295
299
|
}
|
|
296
300
|
}
|
|
@@ -300,7 +304,7 @@ class SwitchBotPlatform {
|
|
|
300
304
|
}
|
|
301
305
|
}
|
|
302
306
|
async createHumidifier(device) {
|
|
303
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
307
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.deviceType}`);
|
|
304
308
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
305
309
|
// the cached devices we stored in the `configureAccessory` method above
|
|
306
310
|
const existingAccessory = this.accessories.find((accessory) => accessory.UUID === uuid);
|
|
@@ -318,7 +322,7 @@ class SwitchBotPlatform {
|
|
|
318
322
|
// create the accessory handler for the restored accessory
|
|
319
323
|
// this is imported from `platformAccessory.ts`
|
|
320
324
|
new humidifiers_1.Humidifier(this, existingAccessory, device);
|
|
321
|
-
this.debug(`${device.deviceType}
|
|
325
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
322
326
|
}
|
|
323
327
|
else {
|
|
324
328
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
@@ -339,7 +343,7 @@ class SwitchBotPlatform {
|
|
|
339
343
|
// create the accessory handler for the newly create accessory
|
|
340
344
|
// this is imported from `platformAccessory.ts`
|
|
341
345
|
new humidifiers_1.Humidifier(this, accessory, device);
|
|
342
|
-
this.debug(`${device.deviceType}
|
|
346
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
343
347
|
// link the accessory to your platform
|
|
344
348
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
345
349
|
this.accessories.push(accessory);
|
|
@@ -349,7 +353,7 @@ class SwitchBotPlatform {
|
|
|
349
353
|
}
|
|
350
354
|
}
|
|
351
355
|
async createBot(device) {
|
|
352
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
356
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.deviceType}`);
|
|
353
357
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
354
358
|
// the cached devices we stored in the `configureAccessory` method above
|
|
355
359
|
const existingAccessory = this.accessories.find((accessory) => accessory.UUID === uuid);
|
|
@@ -366,7 +370,7 @@ class SwitchBotPlatform {
|
|
|
366
370
|
// create the accessory handler for the restored accessory
|
|
367
371
|
// this is imported from `platformAccessory.ts`
|
|
368
372
|
new bots_1.Bot(this, existingAccessory, device);
|
|
369
|
-
this.debug(`${device.deviceType}
|
|
373
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
370
374
|
}
|
|
371
375
|
else {
|
|
372
376
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
@@ -391,7 +395,7 @@ class SwitchBotPlatform {
|
|
|
391
395
|
// create the accessory handler for the newly create accessory
|
|
392
396
|
// this is imported from `platformAccessory.ts`
|
|
393
397
|
new bots_1.Bot(this, accessory, device);
|
|
394
|
-
this.debug(`${device.deviceType}
|
|
398
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
395
399
|
// link the accessory to your platform
|
|
396
400
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
397
401
|
this.accessories.push(accessory);
|
|
@@ -401,7 +405,7 @@ class SwitchBotPlatform {
|
|
|
401
405
|
}
|
|
402
406
|
}
|
|
403
407
|
async createMeter(device) {
|
|
404
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
408
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.deviceType}`);
|
|
405
409
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
406
410
|
// the cached devices we stored in the `configureAccessory` method above
|
|
407
411
|
const existingAccessory = this.accessories.find((accessory) => accessory.UUID === uuid);
|
|
@@ -418,7 +422,7 @@ class SwitchBotPlatform {
|
|
|
418
422
|
// create the accessory handler for the restored accessory
|
|
419
423
|
// this is imported from `platformAccessory.ts`
|
|
420
424
|
new meters_1.Meter(this, existingAccessory, device);
|
|
421
|
-
this.debug(`${device.deviceType}
|
|
425
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
422
426
|
}
|
|
423
427
|
else {
|
|
424
428
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
@@ -439,7 +443,7 @@ class SwitchBotPlatform {
|
|
|
439
443
|
// create the accessory handler for the newly create accessory
|
|
440
444
|
// this is imported from `platformAccessory.ts`
|
|
441
445
|
new meters_1.Meter(this, accessory, device);
|
|
442
|
-
this.debug(`${device.deviceType}
|
|
446
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
443
447
|
// link the accessory to your platform
|
|
444
448
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
445
449
|
this.accessories.push(accessory);
|
|
@@ -449,7 +453,7 @@ class SwitchBotPlatform {
|
|
|
449
453
|
}
|
|
450
454
|
}
|
|
451
455
|
async createMotion(device) {
|
|
452
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
456
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.deviceType}`);
|
|
453
457
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
454
458
|
// the cached devices we stored in the `configureAccessory` method above
|
|
455
459
|
const existingAccessory = this.accessories.find((accessory) => accessory.UUID === uuid);
|
|
@@ -465,7 +469,7 @@ class SwitchBotPlatform {
|
|
|
465
469
|
// create the accessory handler for the restored accessory
|
|
466
470
|
// this is imported from `platformAccessory.ts`
|
|
467
471
|
new motion_1.Motion(this, existingAccessory, device);
|
|
468
|
-
this.debug(`${device.deviceType}
|
|
472
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
469
473
|
}
|
|
470
474
|
else {
|
|
471
475
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
@@ -485,7 +489,7 @@ class SwitchBotPlatform {
|
|
|
485
489
|
// create the accessory handler for the newly create accessory
|
|
486
490
|
// this is imported from `platformAccessory.ts`
|
|
487
491
|
new motion_1.Motion(this, accessory, device);
|
|
488
|
-
this.debug(`${device.deviceType}
|
|
492
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
489
493
|
// link the accessory to your platform
|
|
490
494
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
491
495
|
this.accessories.push(accessory);
|
|
@@ -495,7 +499,7 @@ class SwitchBotPlatform {
|
|
|
495
499
|
}
|
|
496
500
|
}
|
|
497
501
|
async createContact(device) {
|
|
498
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
502
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.deviceType}`);
|
|
499
503
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
500
504
|
// the cached devices we stored in the `configureAccessory` method above
|
|
501
505
|
const existingAccessory = this.accessories.find((accessory) => accessory.UUID === uuid);
|
|
@@ -511,7 +515,7 @@ class SwitchBotPlatform {
|
|
|
511
515
|
// create the accessory handler for the restored accessory
|
|
512
516
|
// this is imported from `platformAccessory.ts`
|
|
513
517
|
new contact_1.Contact(this, existingAccessory, device);
|
|
514
|
-
this.debug(`${device.deviceType}
|
|
518
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
515
519
|
}
|
|
516
520
|
else {
|
|
517
521
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
@@ -531,7 +535,7 @@ class SwitchBotPlatform {
|
|
|
531
535
|
// create the accessory handler for the newly create accessory
|
|
532
536
|
// this is imported from `platformAccessory.ts`
|
|
533
537
|
new contact_1.Contact(this, accessory, device);
|
|
534
|
-
this.debug(`${device.deviceType}
|
|
538
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
535
539
|
// link the accessory to your platform
|
|
536
540
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
537
541
|
this.accessories.push(accessory);
|
|
@@ -541,7 +545,7 @@ class SwitchBotPlatform {
|
|
|
541
545
|
}
|
|
542
546
|
}
|
|
543
547
|
async createCurtain(device) {
|
|
544
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
548
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.deviceType}`);
|
|
545
549
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
546
550
|
// the cached devices we stored in the `configureAccessory` method above
|
|
547
551
|
const existingAccessory = this.accessories.find((accessory) => accessory.UUID === uuid);
|
|
@@ -558,7 +562,7 @@ class SwitchBotPlatform {
|
|
|
558
562
|
// create the accessory handler for the restored accessory
|
|
559
563
|
// this is imported from `platformAccessory.ts`
|
|
560
564
|
new curtains_1.Curtain(this, existingAccessory, device);
|
|
561
|
-
this.debug(`${device.deviceType}
|
|
565
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
562
566
|
}
|
|
563
567
|
else {
|
|
564
568
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
@@ -591,7 +595,7 @@ class SwitchBotPlatform {
|
|
|
591
595
|
// create the accessory handler for the newly create accessory
|
|
592
596
|
// this is imported from `platformAccessory.ts`
|
|
593
597
|
new curtains_1.Curtain(this, accessory, device);
|
|
594
|
-
this.debug(`${device.deviceType}
|
|
598
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
595
599
|
// link the accessory to your platform
|
|
596
600
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
597
601
|
this.accessories.push(accessory);
|
|
@@ -609,7 +613,7 @@ class SwitchBotPlatform {
|
|
|
609
613
|
}
|
|
610
614
|
}
|
|
611
615
|
async createPlug(device) {
|
|
612
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
616
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.deviceType}`);
|
|
613
617
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
614
618
|
// the cached devices we stored in the `configureAccessory` method above
|
|
615
619
|
const existingAccessory = this.accessories.find((accessory) => accessory.UUID === uuid);
|
|
@@ -626,7 +630,7 @@ class SwitchBotPlatform {
|
|
|
626
630
|
// create the accessory handler for the restored accessory
|
|
627
631
|
// this is imported from `platformAccessory.ts`
|
|
628
632
|
new plugs_1.Plug(this, existingAccessory, device);
|
|
629
|
-
this.debug(`${device.deviceType}
|
|
633
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
630
634
|
}
|
|
631
635
|
else {
|
|
632
636
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
@@ -647,7 +651,7 @@ class SwitchBotPlatform {
|
|
|
647
651
|
// create the accessory handler for the newly create accessory
|
|
648
652
|
// this is imported from `platformAccessory.ts`
|
|
649
653
|
new plugs_1.Plug(this, accessory, device);
|
|
650
|
-
this.debug(`${device.deviceType}
|
|
654
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
651
655
|
// link the accessory to your platform
|
|
652
656
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
653
657
|
this.accessories.push(accessory);
|
|
@@ -657,7 +661,7 @@ class SwitchBotPlatform {
|
|
|
657
661
|
}
|
|
658
662
|
}
|
|
659
663
|
async createIndoorCam(device) {
|
|
660
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
664
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.deviceType}`);
|
|
661
665
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
662
666
|
// the cached devices we stored in the `configureAccessory` method above
|
|
663
667
|
const existingAccessory = this.accessories.find((accessory) => accessory.UUID === uuid);
|
|
@@ -674,7 +678,7 @@ class SwitchBotPlatform {
|
|
|
674
678
|
// create the accessory handler for the restored accessory
|
|
675
679
|
// this is imported from `platformAccessory.ts`
|
|
676
680
|
new indoorcam_1.IndoorCam(this, existingAccessory, device);
|
|
677
|
-
this.debug(`${device.deviceType}
|
|
681
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
678
682
|
}
|
|
679
683
|
else {
|
|
680
684
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
@@ -695,7 +699,7 @@ class SwitchBotPlatform {
|
|
|
695
699
|
// create the accessory handler for the newly create accessory
|
|
696
700
|
// this is imported from `platformAccessory.ts`
|
|
697
701
|
new indoorcam_1.IndoorCam(this, accessory, device);
|
|
698
|
-
this.debug(`${device.deviceType}
|
|
702
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
699
703
|
// link the accessory to your platform
|
|
700
704
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
701
705
|
this.accessories.push(accessory);
|
|
@@ -705,7 +709,7 @@ class SwitchBotPlatform {
|
|
|
705
709
|
}
|
|
706
710
|
}
|
|
707
711
|
async createTV(device) {
|
|
708
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
712
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.remoteType}`);
|
|
709
713
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
710
714
|
// the cached devices we stored in the `configureAccessory` method above
|
|
711
715
|
const existingAccessory = this.accessories.find((accessory) => accessory.UUID === uuid);
|
|
@@ -720,7 +724,7 @@ class SwitchBotPlatform {
|
|
|
720
724
|
// create the accessory handler for the restored accessory
|
|
721
725
|
// this is imported from `platformAccessory.ts`
|
|
722
726
|
new tvs_1.TV(this, existingAccessory, device);
|
|
723
|
-
this.debug(`${device.remoteType}
|
|
727
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
724
728
|
}
|
|
725
729
|
else if (!this.config.options?.hide_device.includes(device.deviceId)) {
|
|
726
730
|
// the accessory does not yet exist, so we need to create it
|
|
@@ -737,7 +741,7 @@ class SwitchBotPlatform {
|
|
|
737
741
|
// create the accessory handler for the newly create accessory
|
|
738
742
|
// this is imported from `platformAccessory.ts`
|
|
739
743
|
new tvs_1.TV(this, accessory, device);
|
|
740
|
-
this.debug(`${device.remoteType}
|
|
744
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
741
745
|
/**
|
|
742
746
|
* Publish as external accessory
|
|
743
747
|
* Only one TV can exist per bridge, to bypass this limitation, you should
|
|
@@ -751,7 +755,7 @@ class SwitchBotPlatform {
|
|
|
751
755
|
}
|
|
752
756
|
}
|
|
753
757
|
async createFan(device) {
|
|
754
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
758
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.remoteType}`);
|
|
755
759
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
756
760
|
// the cached devices we stored in the `configureAccessory` method above
|
|
757
761
|
const existingAccessory = this.accessories.find((accessory) => accessory.UUID === uuid);
|
|
@@ -768,7 +772,7 @@ class SwitchBotPlatform {
|
|
|
768
772
|
// create the accessory handler for the restored accessory
|
|
769
773
|
// this is imported from `platformAccessory.ts`
|
|
770
774
|
new fans_1.Fan(this, existingAccessory, device);
|
|
771
|
-
this.debug(`${device.remoteType}
|
|
775
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
772
776
|
}
|
|
773
777
|
else {
|
|
774
778
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
@@ -789,7 +793,7 @@ class SwitchBotPlatform {
|
|
|
789
793
|
// create the accessory handler for the newly create accessory
|
|
790
794
|
// this is imported from `platformAccessory.ts`
|
|
791
795
|
new fans_1.Fan(this, accessory, device);
|
|
792
|
-
this.debug(`${device.remoteType}
|
|
796
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
793
797
|
// link the accessory to your platform
|
|
794
798
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
795
799
|
this.accessories.push(accessory);
|
|
@@ -799,7 +803,7 @@ class SwitchBotPlatform {
|
|
|
799
803
|
}
|
|
800
804
|
}
|
|
801
805
|
async createLight(device) {
|
|
802
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
806
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.remoteType}`);
|
|
803
807
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
804
808
|
// the cached devices we stored in the `configureAccessory` method above
|
|
805
809
|
const existingAccessory = this.accessories.find((accessory) => accessory.UUID === uuid);
|
|
@@ -816,7 +820,7 @@ class SwitchBotPlatform {
|
|
|
816
820
|
// create the accessory handler for the restored accessory
|
|
817
821
|
// this is imported from `platformAccessory.ts`
|
|
818
822
|
new lights_1.Light(this, existingAccessory, device);
|
|
819
|
-
this.debug(`${device.remoteType}
|
|
823
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
820
824
|
}
|
|
821
825
|
else {
|
|
822
826
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
@@ -837,7 +841,7 @@ class SwitchBotPlatform {
|
|
|
837
841
|
// create the accessory handler for the newly create accessory
|
|
838
842
|
// this is imported from `platformAccessory.ts`
|
|
839
843
|
new lights_1.Light(this, accessory, device);
|
|
840
|
-
this.debug(`${device.remoteType}
|
|
844
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
841
845
|
// link the accessory to your platform
|
|
842
846
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
843
847
|
this.accessories.push(accessory);
|
|
@@ -847,7 +851,7 @@ class SwitchBotPlatform {
|
|
|
847
851
|
}
|
|
848
852
|
}
|
|
849
853
|
async createAirConditioner(device) {
|
|
850
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
854
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.remoteType}`);
|
|
851
855
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
852
856
|
// the cached devices we stored in the `configureAccessory` method above
|
|
853
857
|
const existingAccessory = this.accessories.find((accessory) => accessory.UUID === uuid);
|
|
@@ -864,7 +868,7 @@ class SwitchBotPlatform {
|
|
|
864
868
|
// create the accessory handler for the restored accessory
|
|
865
869
|
// this is imported from `platformAccessory.ts`
|
|
866
870
|
new airconditioners_1.AirConditioner(this, existingAccessory, device);
|
|
867
|
-
this.debug(
|
|
871
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
868
872
|
}
|
|
869
873
|
else {
|
|
870
874
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
@@ -885,7 +889,7 @@ class SwitchBotPlatform {
|
|
|
885
889
|
// create the accessory handler for the newly create accessory
|
|
886
890
|
// this is imported from `platformAccessory.ts`
|
|
887
891
|
new airconditioners_1.AirConditioner(this, accessory, device);
|
|
888
|
-
this.debug(
|
|
892
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
889
893
|
// link the accessory to your platform
|
|
890
894
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
891
895
|
this.accessories.push(accessory);
|
|
@@ -895,7 +899,7 @@ class SwitchBotPlatform {
|
|
|
895
899
|
}
|
|
896
900
|
}
|
|
897
901
|
async createAirPurifier(device) {
|
|
898
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
902
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.remoteType}`);
|
|
899
903
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
900
904
|
// the cached devices we stored in the `configureAccessory` method above
|
|
901
905
|
const existingAccessory = this.accessories.find((accessory) => accessory.UUID === uuid);
|
|
@@ -912,7 +916,7 @@ class SwitchBotPlatform {
|
|
|
912
916
|
// create the accessory handler for the restored accessory
|
|
913
917
|
// this is imported from `platformAccessory.ts`
|
|
914
918
|
new airpurifiers_1.AirPurifier(this, existingAccessory, device);
|
|
915
|
-
this.debug(`${device.remoteType}
|
|
919
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
916
920
|
}
|
|
917
921
|
else {
|
|
918
922
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
@@ -933,7 +937,7 @@ class SwitchBotPlatform {
|
|
|
933
937
|
// create the accessory handler for the newly create accessory
|
|
934
938
|
// this is imported from `platformAccessory.ts`
|
|
935
939
|
new airpurifiers_1.AirPurifier(this, accessory, device);
|
|
936
|
-
this.debug(`${device.remoteType}
|
|
940
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
937
941
|
// link the accessory to your platform
|
|
938
942
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
939
943
|
this.accessories.push(accessory);
|
|
@@ -943,7 +947,7 @@ class SwitchBotPlatform {
|
|
|
943
947
|
}
|
|
944
948
|
}
|
|
945
949
|
async createWaterHeater(device) {
|
|
946
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
950
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.remoteType}`);
|
|
947
951
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
948
952
|
// the cached devices we stored in the `configureAccessory` method above
|
|
949
953
|
const existingAccessory = this.accessories.find((accessory) => accessory.UUID === uuid);
|
|
@@ -960,7 +964,7 @@ class SwitchBotPlatform {
|
|
|
960
964
|
// create the accessory handler for the restored accessory
|
|
961
965
|
// this is imported from `platformAccessory.ts`
|
|
962
966
|
new waterheaters_1.WaterHeater(this, existingAccessory, device);
|
|
963
|
-
this.debug(`${device.remoteType}
|
|
967
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
964
968
|
}
|
|
965
969
|
else {
|
|
966
970
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
@@ -981,7 +985,7 @@ class SwitchBotPlatform {
|
|
|
981
985
|
// create the accessory handler for the newly create accessory
|
|
982
986
|
// this is imported from `platformAccessory.ts`
|
|
983
987
|
new waterheaters_1.WaterHeater(this, accessory, device);
|
|
984
|
-
this.debug(`${device.remoteType}
|
|
988
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
985
989
|
// link the accessory to your platform
|
|
986
990
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
987
991
|
this.accessories.push(accessory);
|
|
@@ -991,7 +995,7 @@ class SwitchBotPlatform {
|
|
|
991
995
|
}
|
|
992
996
|
}
|
|
993
997
|
async createVacuumCleaner(device) {
|
|
994
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
998
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.remoteType}`);
|
|
995
999
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
996
1000
|
// the cached devices we stored in the `configureAccessory` method above
|
|
997
1001
|
const existingAccessory = this.accessories.find((accessory) => accessory.UUID === uuid);
|
|
@@ -1008,7 +1012,7 @@ class SwitchBotPlatform {
|
|
|
1008
1012
|
// create the accessory handler for the restored accessory
|
|
1009
1013
|
// this is imported from `platformAccessory.ts`
|
|
1010
1014
|
new vacuumcleaners_1.VacuumCleaner(this, existingAccessory, device);
|
|
1011
|
-
this.debug(`${device.remoteType}
|
|
1015
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
1012
1016
|
}
|
|
1013
1017
|
else {
|
|
1014
1018
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
@@ -1029,7 +1033,7 @@ class SwitchBotPlatform {
|
|
|
1029
1033
|
// create the accessory handler for the newly create accessory
|
|
1030
1034
|
// this is imported from `platformAccessory.ts`
|
|
1031
1035
|
new vacuumcleaners_1.VacuumCleaner(this, accessory, device);
|
|
1032
|
-
this.debug(`${device.remoteType}
|
|
1036
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
1033
1037
|
// link the accessory to your platform
|
|
1034
1038
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
1035
1039
|
this.accessories.push(accessory);
|
|
@@ -1039,7 +1043,7 @@ class SwitchBotPlatform {
|
|
|
1039
1043
|
}
|
|
1040
1044
|
}
|
|
1041
1045
|
async createCamera(device) {
|
|
1042
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
1046
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.remoteType}`);
|
|
1043
1047
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
1044
1048
|
// the cached devices we stored in the `configureAccessory` method above
|
|
1045
1049
|
const existingAccessory = this.accessories.find((accessory) => accessory.UUID === uuid);
|
|
@@ -1056,7 +1060,7 @@ class SwitchBotPlatform {
|
|
|
1056
1060
|
// create the accessory handler for the restored accessory
|
|
1057
1061
|
// this is imported from `platformAccessory.ts`
|
|
1058
1062
|
new cameras_1.Camera(this, existingAccessory, device);
|
|
1059
|
-
this.debug(`${device.remoteType}
|
|
1063
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
1060
1064
|
}
|
|
1061
1065
|
else {
|
|
1062
1066
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
@@ -1077,7 +1081,7 @@ class SwitchBotPlatform {
|
|
|
1077
1081
|
// create the accessory handler for the newly create accessory
|
|
1078
1082
|
// this is imported from `platformAccessory.ts`
|
|
1079
1083
|
new cameras_1.Camera(this, accessory, device);
|
|
1080
|
-
this.debug(`${device.remoteType}
|
|
1084
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
1081
1085
|
// link the accessory to your platform
|
|
1082
1086
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
1083
1087
|
this.accessories.push(accessory);
|
|
@@ -1087,7 +1091,7 @@ class SwitchBotPlatform {
|
|
|
1087
1091
|
}
|
|
1088
1092
|
}
|
|
1089
1093
|
async createOthers(device) {
|
|
1090
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
1094
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.remoteType}`);
|
|
1091
1095
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
1092
1096
|
// the cached devices we stored in the `configureAccessory` method above
|
|
1093
1097
|
const existingAccessory = this.accessories.find((accessory) => accessory.UUID === uuid);
|
|
@@ -1104,7 +1108,7 @@ class SwitchBotPlatform {
|
|
|
1104
1108
|
// create the accessory handler for the restored accessory
|
|
1105
1109
|
// this is imported from `platformAccessory.ts`
|
|
1106
1110
|
new others_1.Others(this, existingAccessory, device);
|
|
1107
|
-
this.debug(`${device.remoteType}
|
|
1111
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
1108
1112
|
}
|
|
1109
1113
|
else {
|
|
1110
1114
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
@@ -1125,7 +1129,7 @@ class SwitchBotPlatform {
|
|
|
1125
1129
|
// create the accessory handler for the newly create accessory
|
|
1126
1130
|
// this is imported from `platformAccessory.ts`
|
|
1127
1131
|
new others_1.Others(this, accessory, device);
|
|
1128
|
-
this.debug(`${device.remoteType}
|
|
1132
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
1129
1133
|
// link the accessory to your platform
|
|
1130
1134
|
this.api.registerPlatformAccessories(settings_1.PLUGIN_NAME, settings_1.PLATFORM_NAME, [accessory]);
|
|
1131
1135
|
this.accessories.push(accessory);
|