@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/src/platform.ts
CHANGED
|
@@ -261,7 +261,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
261
261
|
this.debug(`Discovered ${device.deviceType}: ${device.deviceId} is Not Supported.`);
|
|
262
262
|
break;
|
|
263
263
|
default:
|
|
264
|
-
|
|
264
|
+
// eslint-disable-next-line max-len
|
|
265
|
+
this.log.info(`Device: ${device.deviceName} with Device Type: ${device.deviceType}, is currently not supported.`);
|
|
266
|
+
this.log.info('Submit Feature Requests Here: https://git.io/JL14Z');
|
|
265
267
|
}
|
|
266
268
|
}
|
|
267
269
|
for (const device of devices.body.infraredRemoteList) {
|
|
@@ -324,7 +326,9 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
324
326
|
this.createOthers(device);
|
|
325
327
|
break;
|
|
326
328
|
default:
|
|
327
|
-
|
|
329
|
+
// eslint-disable-next-line max-len
|
|
330
|
+
this.log.info(`Device: ${device.deviceName} with Device Type: ${device.remoteType}, is currently not supported.`);
|
|
331
|
+
this.log.info('Submit Feature Requests Here: https://git.io/JL14Z');
|
|
328
332
|
}
|
|
329
333
|
}
|
|
330
334
|
} catch (e: any) {
|
|
@@ -334,7 +338,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
334
338
|
}
|
|
335
339
|
|
|
336
340
|
private async createHumidifier(device: device) {
|
|
337
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
341
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.deviceType}`);
|
|
338
342
|
|
|
339
343
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
340
344
|
// the cached devices we stored in the `configureAccessory` method above
|
|
@@ -355,7 +359,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
355
359
|
// create the accessory handler for the restored accessory
|
|
356
360
|
// this is imported from `platformAccessory.ts`
|
|
357
361
|
new Humidifier(this, existingAccessory, device);
|
|
358
|
-
this.debug(`${device.deviceType}
|
|
362
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
359
363
|
} else {
|
|
360
364
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
361
365
|
}
|
|
@@ -376,7 +380,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
376
380
|
// create the accessory handler for the newly create accessory
|
|
377
381
|
// this is imported from `platformAccessory.ts`
|
|
378
382
|
new Humidifier(this, accessory, device);
|
|
379
|
-
this.debug(`${device.deviceType}
|
|
383
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
380
384
|
|
|
381
385
|
// link the accessory to your platform
|
|
382
386
|
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
@@ -387,7 +391,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
387
391
|
}
|
|
388
392
|
|
|
389
393
|
private async createBot(device: device) {
|
|
390
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
394
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.deviceType}`);
|
|
391
395
|
|
|
392
396
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
393
397
|
// the cached devices we stored in the `configureAccessory` method above
|
|
@@ -407,7 +411,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
407
411
|
// create the accessory handler for the restored accessory
|
|
408
412
|
// this is imported from `platformAccessory.ts`
|
|
409
413
|
new Bot(this, existingAccessory, device);
|
|
410
|
-
this.debug(`${device.deviceType}
|
|
414
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
411
415
|
} else {
|
|
412
416
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
413
417
|
}
|
|
@@ -432,7 +436,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
432
436
|
// create the accessory handler for the newly create accessory
|
|
433
437
|
// this is imported from `platformAccessory.ts`
|
|
434
438
|
new Bot(this, accessory, device);
|
|
435
|
-
this.debug(`${device.deviceType}
|
|
439
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
436
440
|
|
|
437
441
|
// link the accessory to your platform
|
|
438
442
|
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
@@ -443,7 +447,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
443
447
|
}
|
|
444
448
|
|
|
445
449
|
private async createMeter(device: device) {
|
|
446
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
450
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.deviceType}`);
|
|
447
451
|
|
|
448
452
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
449
453
|
// the cached devices we stored in the `configureAccessory` method above
|
|
@@ -463,7 +467,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
463
467
|
// create the accessory handler for the restored accessory
|
|
464
468
|
// this is imported from `platformAccessory.ts`
|
|
465
469
|
new Meter(this, existingAccessory, device);
|
|
466
|
-
this.debug(`${device.deviceType}
|
|
470
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
467
471
|
} else {
|
|
468
472
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
469
473
|
}
|
|
@@ -484,7 +488,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
484
488
|
// create the accessory handler for the newly create accessory
|
|
485
489
|
// this is imported from `platformAccessory.ts`
|
|
486
490
|
new Meter(this, accessory, device);
|
|
487
|
-
this.debug(`${device.deviceType}
|
|
491
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
488
492
|
|
|
489
493
|
// link the accessory to your platform
|
|
490
494
|
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
@@ -495,7 +499,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
495
499
|
}
|
|
496
500
|
|
|
497
501
|
private async createMotion(device: device) {
|
|
498
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
502
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.deviceType}`);
|
|
499
503
|
|
|
500
504
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
501
505
|
// the cached devices we stored in the `configureAccessory` method above
|
|
@@ -514,7 +518,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
514
518
|
// create the accessory handler for the restored accessory
|
|
515
519
|
// this is imported from `platformAccessory.ts`
|
|
516
520
|
new Motion(this, existingAccessory, device);
|
|
517
|
-
this.debug(`${device.deviceType}
|
|
521
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
518
522
|
} else {
|
|
519
523
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
520
524
|
}
|
|
@@ -534,7 +538,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
534
538
|
// create the accessory handler for the newly create accessory
|
|
535
539
|
// this is imported from `platformAccessory.ts`
|
|
536
540
|
new Motion(this, accessory, device);
|
|
537
|
-
this.debug(`${device.deviceType}
|
|
541
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
538
542
|
|
|
539
543
|
// link the accessory to your platform
|
|
540
544
|
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
@@ -545,7 +549,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
545
549
|
}
|
|
546
550
|
|
|
547
551
|
private async createContact(device: device) {
|
|
548
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
552
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.deviceType}`);
|
|
549
553
|
|
|
550
554
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
551
555
|
// the cached devices we stored in the `configureAccessory` method above
|
|
@@ -564,7 +568,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
564
568
|
// create the accessory handler for the restored accessory
|
|
565
569
|
// this is imported from `platformAccessory.ts`
|
|
566
570
|
new Contact(this, existingAccessory, device);
|
|
567
|
-
this.debug(`${device.deviceType}
|
|
571
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
568
572
|
} else {
|
|
569
573
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
570
574
|
}
|
|
@@ -584,7 +588,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
584
588
|
// create the accessory handler for the newly create accessory
|
|
585
589
|
// this is imported from `platformAccessory.ts`
|
|
586
590
|
new Contact(this, accessory, device);
|
|
587
|
-
this.debug(`${device.deviceType}
|
|
591
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
588
592
|
|
|
589
593
|
// link the accessory to your platform
|
|
590
594
|
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
@@ -595,7 +599,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
595
599
|
}
|
|
596
600
|
|
|
597
601
|
private async createCurtain(device: device) {
|
|
598
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
602
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.deviceType}`);
|
|
599
603
|
|
|
600
604
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
601
605
|
// the cached devices we stored in the `configureAccessory` method above
|
|
@@ -615,7 +619,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
615
619
|
// create the accessory handler for the restored accessory
|
|
616
620
|
// this is imported from `platformAccessory.ts`
|
|
617
621
|
new Curtain(this, existingAccessory, device);
|
|
618
|
-
this.debug(`${device.deviceType}
|
|
622
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
619
623
|
} else {
|
|
620
624
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
621
625
|
}
|
|
@@ -646,7 +650,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
646
650
|
// create the accessory handler for the newly create accessory
|
|
647
651
|
// this is imported from `platformAccessory.ts`
|
|
648
652
|
new Curtain(this, accessory, device);
|
|
649
|
-
this.debug(`${device.deviceType}
|
|
653
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
650
654
|
|
|
651
655
|
// link the accessory to your platform
|
|
652
656
|
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
@@ -665,7 +669,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
665
669
|
}
|
|
666
670
|
|
|
667
671
|
private async createPlug(device: device) {
|
|
668
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
672
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.deviceType}`);
|
|
669
673
|
|
|
670
674
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
671
675
|
// the cached devices we stored in the `configureAccessory` method above
|
|
@@ -685,7 +689,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
685
689
|
// create the accessory handler for the restored accessory
|
|
686
690
|
// this is imported from `platformAccessory.ts`
|
|
687
691
|
new Plug(this, existingAccessory, device);
|
|
688
|
-
this.debug(`${device.deviceType}
|
|
692
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
689
693
|
} else {
|
|
690
694
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
691
695
|
}
|
|
@@ -706,7 +710,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
706
710
|
// create the accessory handler for the newly create accessory
|
|
707
711
|
// this is imported from `platformAccessory.ts`
|
|
708
712
|
new Plug(this, accessory, device);
|
|
709
|
-
this.debug(`${device.deviceType}
|
|
713
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
710
714
|
|
|
711
715
|
// link the accessory to your platform
|
|
712
716
|
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
@@ -717,7 +721,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
717
721
|
}
|
|
718
722
|
|
|
719
723
|
private async createIndoorCam(device: device) {
|
|
720
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
724
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.deviceType}`);
|
|
721
725
|
|
|
722
726
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
723
727
|
// the cached devices we stored in the `configureAccessory` method above
|
|
@@ -737,7 +741,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
737
741
|
// create the accessory handler for the restored accessory
|
|
738
742
|
// this is imported from `platformAccessory.ts`
|
|
739
743
|
new IndoorCam(this, existingAccessory, device);
|
|
740
|
-
this.debug(`${device.deviceType}
|
|
744
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
741
745
|
} else {
|
|
742
746
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
743
747
|
}
|
|
@@ -758,7 +762,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
758
762
|
// create the accessory handler for the newly create accessory
|
|
759
763
|
// this is imported from `platformAccessory.ts`
|
|
760
764
|
new IndoorCam(this, accessory, device);
|
|
761
|
-
this.debug(`${device.deviceType}
|
|
765
|
+
this.debug(`${device.deviceType} uuid: ${device.deviceId}-${device.deviceType}`);
|
|
762
766
|
|
|
763
767
|
// link the accessory to your platform
|
|
764
768
|
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
@@ -769,9 +773,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
769
773
|
}
|
|
770
774
|
|
|
771
775
|
private async createTV(device: irdevice) {
|
|
772
|
-
const uuid = this.api.hap.uuid.generate(
|
|
773
|
-
`${device.deviceName}-${device.deviceId}-${device.remoteType}-${device.hubDeviceId}`,
|
|
774
|
-
);
|
|
776
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.remoteType}`);
|
|
775
777
|
|
|
776
778
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
777
779
|
// the cached devices we stored in the `configureAccessory` method above
|
|
@@ -789,9 +791,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
789
791
|
// create the accessory handler for the restored accessory
|
|
790
792
|
// this is imported from `platformAccessory.ts`
|
|
791
793
|
new TV(this, existingAccessory, device);
|
|
792
|
-
this.debug(
|
|
793
|
-
`${device.remoteType} UDID: ${device.deviceName}-${device.deviceId}-${device.remoteType}-${device.hubDeviceId}`,
|
|
794
|
-
);
|
|
794
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
795
795
|
} else if (!this.config.options?.hide_device.includes(device.deviceId)) {
|
|
796
796
|
// the accessory does not yet exist, so we need to create it
|
|
797
797
|
this.log.info(`Adding new accessory: ${device.deviceName} ${device.remoteType} DeviceID: ${device.deviceId}`);
|
|
@@ -809,9 +809,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
809
809
|
// create the accessory handler for the newly create accessory
|
|
810
810
|
// this is imported from `platformAccessory.ts`
|
|
811
811
|
new TV(this, accessory, device);
|
|
812
|
-
this.debug(
|
|
813
|
-
`${device.remoteType} UDID: ${device.deviceName}-${device.deviceId}-${device.remoteType}-${device.hubDeviceId}`,
|
|
814
|
-
);
|
|
812
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
815
813
|
|
|
816
814
|
/**
|
|
817
815
|
* Publish as external accessory
|
|
@@ -826,7 +824,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
826
824
|
}
|
|
827
825
|
|
|
828
826
|
private async createFan(device: irdevice) {
|
|
829
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
827
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.remoteType}`);
|
|
830
828
|
|
|
831
829
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
832
830
|
// the cached devices we stored in the `configureAccessory` method above
|
|
@@ -847,7 +845,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
847
845
|
// create the accessory handler for the restored accessory
|
|
848
846
|
// this is imported from `platformAccessory.ts`
|
|
849
847
|
new Fan(this, existingAccessory, device);
|
|
850
|
-
this.debug(`${device.remoteType}
|
|
848
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
851
849
|
} else {
|
|
852
850
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
853
851
|
}
|
|
@@ -868,7 +866,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
868
866
|
// create the accessory handler for the newly create accessory
|
|
869
867
|
// this is imported from `platformAccessory.ts`
|
|
870
868
|
new Fan(this, accessory, device);
|
|
871
|
-
this.debug(`${device.remoteType}
|
|
869
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
872
870
|
|
|
873
871
|
// link the accessory to your platform
|
|
874
872
|
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
@@ -879,7 +877,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
879
877
|
}
|
|
880
878
|
|
|
881
879
|
private async createLight(device: irdevice) {
|
|
882
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
880
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.remoteType}`);
|
|
883
881
|
|
|
884
882
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
885
883
|
// the cached devices we stored in the `configureAccessory` method above
|
|
@@ -899,7 +897,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
899
897
|
// create the accessory handler for the restored accessory
|
|
900
898
|
// this is imported from `platformAccessory.ts`
|
|
901
899
|
new Light(this, existingAccessory, device);
|
|
902
|
-
this.debug(`${device.remoteType}
|
|
900
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
903
901
|
} else {
|
|
904
902
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
905
903
|
}
|
|
@@ -920,7 +918,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
920
918
|
// create the accessory handler for the newly create accessory
|
|
921
919
|
// this is imported from `platformAccessory.ts`
|
|
922
920
|
new Light(this, accessory, device);
|
|
923
|
-
this.debug(`${device.remoteType}
|
|
921
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
924
922
|
|
|
925
923
|
// link the accessory to your platform
|
|
926
924
|
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
@@ -931,7 +929,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
931
929
|
}
|
|
932
930
|
|
|
933
931
|
private async createAirConditioner(device: irdevice) {
|
|
934
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
932
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.remoteType}`);
|
|
935
933
|
|
|
936
934
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
937
935
|
// the cached devices we stored in the `configureAccessory` method above
|
|
@@ -951,7 +949,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
951
949
|
// create the accessory handler for the restored accessory
|
|
952
950
|
// this is imported from `platformAccessory.ts`
|
|
953
951
|
new AirConditioner(this, existingAccessory, device);
|
|
954
|
-
this.debug(
|
|
952
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
955
953
|
} else {
|
|
956
954
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
957
955
|
}
|
|
@@ -972,7 +970,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
972
970
|
// create the accessory handler for the newly create accessory
|
|
973
971
|
// this is imported from `platformAccessory.ts`
|
|
974
972
|
new AirConditioner(this, accessory, device);
|
|
975
|
-
this.debug(
|
|
973
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
976
974
|
|
|
977
975
|
// link the accessory to your platform
|
|
978
976
|
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
@@ -983,7 +981,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
983
981
|
}
|
|
984
982
|
|
|
985
983
|
private async createAirPurifier(device: irdevice) {
|
|
986
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
984
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.remoteType}`);
|
|
987
985
|
|
|
988
986
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
989
987
|
// the cached devices we stored in the `configureAccessory` method above
|
|
@@ -1003,7 +1001,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1003
1001
|
// create the accessory handler for the restored accessory
|
|
1004
1002
|
// this is imported from `platformAccessory.ts`
|
|
1005
1003
|
new AirPurifier(this, existingAccessory, device);
|
|
1006
|
-
this.debug(`${device.remoteType}
|
|
1004
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
1007
1005
|
} else {
|
|
1008
1006
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
1009
1007
|
}
|
|
@@ -1024,7 +1022,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1024
1022
|
// create the accessory handler for the newly create accessory
|
|
1025
1023
|
// this is imported from `platformAccessory.ts`
|
|
1026
1024
|
new AirPurifier(this, accessory, device);
|
|
1027
|
-
this.debug(`${device.remoteType}
|
|
1025
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
1028
1026
|
|
|
1029
1027
|
// link the accessory to your platform
|
|
1030
1028
|
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
@@ -1035,7 +1033,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1035
1033
|
}
|
|
1036
1034
|
|
|
1037
1035
|
private async createWaterHeater(device: irdevice) {
|
|
1038
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
1036
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.remoteType}`);
|
|
1039
1037
|
|
|
1040
1038
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
1041
1039
|
// the cached devices we stored in the `configureAccessory` method above
|
|
@@ -1055,7 +1053,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1055
1053
|
// create the accessory handler for the restored accessory
|
|
1056
1054
|
// this is imported from `platformAccessory.ts`
|
|
1057
1055
|
new WaterHeater(this, existingAccessory, device);
|
|
1058
|
-
this.debug(`${device.remoteType}
|
|
1056
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
1059
1057
|
} else {
|
|
1060
1058
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
1061
1059
|
}
|
|
@@ -1076,7 +1074,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1076
1074
|
// create the accessory handler for the newly create accessory
|
|
1077
1075
|
// this is imported from `platformAccessory.ts`
|
|
1078
1076
|
new WaterHeater(this, accessory, device);
|
|
1079
|
-
this.debug(`${device.remoteType}
|
|
1077
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
1080
1078
|
|
|
1081
1079
|
// link the accessory to your platform
|
|
1082
1080
|
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
@@ -1087,7 +1085,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1087
1085
|
}
|
|
1088
1086
|
|
|
1089
1087
|
private async createVacuumCleaner(device: irdevice) {
|
|
1090
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
1088
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.remoteType}`);
|
|
1091
1089
|
|
|
1092
1090
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
1093
1091
|
// the cached devices we stored in the `configureAccessory` method above
|
|
@@ -1107,7 +1105,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1107
1105
|
// create the accessory handler for the restored accessory
|
|
1108
1106
|
// this is imported from `platformAccessory.ts`
|
|
1109
1107
|
new VacuumCleaner(this, existingAccessory, device);
|
|
1110
|
-
this.debug(`${device.remoteType}
|
|
1108
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
1111
1109
|
} else {
|
|
1112
1110
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
1113
1111
|
}
|
|
@@ -1128,7 +1126,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1128
1126
|
// create the accessory handler for the newly create accessory
|
|
1129
1127
|
// this is imported from `platformAccessory.ts`
|
|
1130
1128
|
new VacuumCleaner(this, accessory, device);
|
|
1131
|
-
this.debug(`${device.remoteType}
|
|
1129
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
1132
1130
|
|
|
1133
1131
|
// link the accessory to your platform
|
|
1134
1132
|
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
@@ -1139,7 +1137,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1139
1137
|
}
|
|
1140
1138
|
|
|
1141
1139
|
private async createCamera(device: irdevice) {
|
|
1142
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
1140
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.remoteType}`);
|
|
1143
1141
|
|
|
1144
1142
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
1145
1143
|
// the cached devices we stored in the `configureAccessory` method above
|
|
@@ -1159,7 +1157,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1159
1157
|
// create the accessory handler for the restored accessory
|
|
1160
1158
|
// this is imported from `platformAccessory.ts`
|
|
1161
1159
|
new Camera(this, existingAccessory, device);
|
|
1162
|
-
this.debug(`${device.remoteType}
|
|
1160
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
1163
1161
|
} else {
|
|
1164
1162
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
1165
1163
|
}
|
|
@@ -1180,7 +1178,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1180
1178
|
// create the accessory handler for the newly create accessory
|
|
1181
1179
|
// this is imported from `platformAccessory.ts`
|
|
1182
1180
|
new Camera(this, accessory, device);
|
|
1183
|
-
this.debug(`${device.remoteType}
|
|
1181
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
1184
1182
|
|
|
1185
1183
|
// link the accessory to your platform
|
|
1186
1184
|
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|
|
@@ -1191,7 +1189,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1191
1189
|
}
|
|
1192
1190
|
|
|
1193
1191
|
private async createOthers(device: irdevice) {
|
|
1194
|
-
const uuid = this.api.hap.uuid.generate(`${device.
|
|
1192
|
+
const uuid = this.api.hap.uuid.generate(`${device.deviceId}-${device.remoteType}`);
|
|
1195
1193
|
|
|
1196
1194
|
// see if an accessory with the same uuid has already been registered and restored from
|
|
1197
1195
|
// the cached devices we stored in the `configureAccessory` method above
|
|
@@ -1211,7 +1209,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1211
1209
|
// create the accessory handler for the restored accessory
|
|
1212
1210
|
// this is imported from `platformAccessory.ts`
|
|
1213
1211
|
new Others(this, existingAccessory, device);
|
|
1214
|
-
this.debug(`${device.remoteType}
|
|
1212
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
1215
1213
|
} else {
|
|
1216
1214
|
this.unregisterPlatformAccessories(existingAccessory);
|
|
1217
1215
|
}
|
|
@@ -1232,7 +1230,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {
|
|
|
1232
1230
|
// create the accessory handler for the newly create accessory
|
|
1233
1231
|
// this is imported from `platformAccessory.ts`
|
|
1234
1232
|
new Others(this, accessory, device);
|
|
1235
|
-
this.debug(`${device.remoteType}
|
|
1233
|
+
this.debug(`${device.remoteType} uuid: ${device.deviceId}-${device.remoteType}`);
|
|
1236
1234
|
|
|
1237
1235
|
// link the accessory to your platform
|
|
1238
1236
|
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory]);
|