@switchbot/homebridge-switchbot 4.3.12 → 4.3.13

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/CHANGELOG.md CHANGED
@@ -458,6 +458,464 @@ All notable changes to this project will be documented in this file. This projec
458
458
 
459
459
 
460
460
 
461
+ # 0.1.0 (2021-09-11)
462
+
463
+ ## [4.3.12](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.3.11...v4.3.12) (2026-02-18)
464
+
465
+
466
+
467
+ ## [4.3.11](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.3.10...v4.3.11) (2026-02-17)
468
+
469
+
470
+
471
+ ## [4.3.10](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.3.9...v4.3.10) (2026-02-10)
472
+
473
+
474
+
475
+ ## [4.3.9](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.3.8...v4.3.9) (2026-02-09)
476
+
477
+
478
+
479
+ ## [4.3.8](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.3.7...v4.3.8) (2026-02-09)
480
+
481
+
482
+
483
+ ## [4.3.7](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.3.6...v4.3.7) (2026-02-07)
484
+
485
+
486
+
487
+ ## [4.3.6](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.3.4...v4.3.6) (2026-02-05)
488
+
489
+
490
+
491
+ ## [4.3.4](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.3.3...v4.3.4) (2026-02-05)
492
+
493
+
494
+
495
+ ## [4.3.3](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.3.1...v4.3.3) (2025-12-18)
496
+
497
+
498
+
499
+ ## [4.3.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.3.0...v4.3.1) (2025-03-05)
500
+
501
+
502
+
503
+ # [4.3.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.2.0...v4.3.0) (2025-01-24)
504
+
505
+
506
+
507
+ # [4.2.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.1.7...v4.2.0) (2025-01-24)
508
+
509
+
510
+
511
+ ## [4.1.7](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.1.6...v4.1.7) (2024-12-22)
512
+
513
+
514
+
515
+ ## [4.1.6](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.1.5...v4.1.6) (2024-12-22)
516
+
517
+
518
+
519
+ ## [4.1.5](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.1.4...v4.1.5) (2024-11-27)
520
+
521
+
522
+
523
+ ## [4.1.4](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.1.3...v4.1.4) (2024-11-18)
524
+
525
+
526
+
527
+ ## [4.1.3](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.1.2...v4.1.3) (2024-11-05)
528
+
529
+
530
+
531
+ ## [4.1.2](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.1.1...v4.1.2) (2024-11-05)
532
+
533
+
534
+
535
+ ## [4.1.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.1.0...v4.1.1) (2024-11-02)
536
+
537
+
538
+
539
+ # [4.1.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.0.0...v4.1.0) (2024-10-22)
540
+
541
+
542
+
543
+ # [4.0.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v3.8.3...v4.0.0) (2024-10-12)
544
+
545
+
546
+
547
+ ## [3.8.3](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v3.8.2...v3.8.3) (2024-10-09)
548
+
549
+
550
+
551
+ ## [3.8.2](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v3.8.1...v3.8.2) (2024-09-19)
552
+
553
+
554
+
555
+ ## [3.8.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v3.8.0...v3.8.1) (2024-09-13)
556
+
557
+
558
+
559
+ # [3.8.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v3.7.0...v3.8.0) (2024-09-11)
560
+
561
+
562
+
563
+ # [3.7.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v3.6.0...v3.7.0) (2024-07-21)
564
+
565
+
566
+
567
+ # [3.6.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v3.5.1...v3.6.0) (2024-07-06)
568
+
569
+
570
+
571
+ ## [3.5.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v3.5.0...v3.5.1) (2024-06-28)
572
+
573
+
574
+
575
+ # [3.5.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v3.4.0...v3.5.0) (2024-05-26)
576
+
577
+
578
+
579
+ # [3.4.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v3.3.0...v3.4.0) (2024-02-12)
580
+
581
+
582
+
583
+ # [3.3.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v3.2.0...v3.3.0) (2024-02-10)
584
+
585
+
586
+
587
+ # [3.2.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v3.1.3...v3.2.0) (2024-02-07)
588
+
589
+
590
+
591
+ ## [3.1.3](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v3.1.2...v3.1.3) (2024-02-07)
592
+
593
+
594
+
595
+ ## [3.1.2](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v3.1.1...v3.1.2) (2024-02-05)
596
+
597
+
598
+
599
+ ## [3.1.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v3.1.0...v3.1.1) (2024-02-05)
600
+
601
+
602
+
603
+ # [3.1.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v3.0.0...v3.1.0) (2024-02-03)
604
+
605
+
606
+
607
+ # [3.0.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.14.0...v3.0.0) (2024-01-31)
608
+
609
+
610
+
611
+ # [2.14.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.13.1...v2.14.0) (2024-01-06)
612
+
613
+
614
+
615
+ ## [2.13.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.13.0...v2.13.1) (2023-12-15)
616
+
617
+
618
+
619
+ # [2.13.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.12.1...v2.13.0) (2023-12-04)
620
+
621
+
622
+
623
+ ## [2.12.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.12.0...v2.12.1) (2023-11-26)
624
+
625
+
626
+
627
+ # [2.12.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.11.0...v2.12.0) (2023-11-17)
628
+
629
+
630
+
631
+ # [2.11.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.10.1...v2.11.0) (2023-11-08)
632
+
633
+
634
+
635
+ ## [2.10.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.10.0...v2.10.1) (2023-11-02)
636
+
637
+
638
+
639
+ # [2.10.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.9.2...v2.10.0) (2023-11-01)
640
+
641
+
642
+
643
+ ## [2.9.2](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.9.1...v2.9.2) (2023-10-26)
644
+
645
+
646
+
647
+ ## [2.9.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.9.0...v2.9.1) (2023-10-15)
648
+
649
+
650
+
651
+ # [2.9.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.8.2...v2.9.0) (2023-09-16)
652
+
653
+
654
+
655
+ ## [2.8.2](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.8.1...v2.8.2) (2023-08-28)
656
+
657
+
658
+
659
+ ## [2.8.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.8.0...v2.8.1) (2023-08-23)
660
+
661
+
662
+
663
+ # [2.8.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.7.1...v2.8.0) (2023-08-19)
664
+
665
+
666
+
667
+ ## [2.7.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.7.0...v2.7.1) (2023-07-29)
668
+
669
+
670
+
671
+ # [2.7.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.6.2...v2.7.0) (2023-07-26)
672
+
673
+
674
+
675
+ ## [2.6.2](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.6.1...v2.6.2) (2023-04-17)
676
+
677
+
678
+
679
+ ## [2.6.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.6.0...v2.6.1) (2023-04-16)
680
+
681
+
682
+
683
+ # [2.6.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.5.3...v2.6.0) (2023-04-16)
684
+
685
+
686
+
687
+ ## [2.5.3](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.5.2...v2.5.3) (2023-04-08)
688
+
689
+
690
+
691
+ ## [2.5.2](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.5.1...v2.5.2) (2023-02-11)
692
+
693
+
694
+
695
+ ## [2.5.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.5.0...v2.5.1) (2023-01-29)
696
+
697
+
698
+
699
+ # [2.5.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.4.1...v2.5.0) (2023-01-29)
700
+
701
+
702
+
703
+ # [2.4.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.3.3...v2.4.0) (2022-12-27)
704
+
705
+
706
+
707
+ ## [2.3.3](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.3.2...v2.3.3) (2022-12-16)
708
+
709
+
710
+
711
+ ## [2.3.2](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.3.1...v2.3.2) (2022-12-16)
712
+
713
+
714
+
715
+ ## [2.3.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.3.0...v2.3.1) (2022-12-12)
716
+
717
+
718
+
719
+ # [2.3.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.2.2...v2.3.0) (2022-12-08)
720
+
721
+
722
+
723
+ ## [2.2.2](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.2.1...v2.2.2) (2022-10-22)
724
+
725
+
726
+
727
+ ## [2.2.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.2.0...v2.2.1) (2022-10-19)
728
+
729
+
730
+
731
+ # [2.2.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.1.2...v2.2.0) (2022-10-18)
732
+
733
+
734
+
735
+ ## [2.1.2](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.1.1...v2.1.2) (2022-10-15)
736
+
737
+
738
+
739
+ ## [2.1.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.1.0...v2.1.1) (2022-10-14)
740
+
741
+
742
+
743
+ # [2.1.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v2.0.0...v2.1.0) (2022-10-13)
744
+
745
+
746
+
747
+ # [2.0.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.15.0...v2.0.0) (2022-10-12)
748
+
749
+
750
+
751
+ # [1.15.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.14.2...v1.15.0) (2022-08-27)
752
+
753
+
754
+
755
+ ## [1.14.2](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.14.1...v1.14.2) (2022-08-20)
756
+
757
+
758
+
759
+ ## [1.14.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.14.0...v1.14.1) (2022-06-28)
760
+
761
+
762
+
763
+ # [1.14.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.13.0...v1.14.0) (2022-06-25)
764
+
765
+
766
+
767
+ # [1.13.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.12.8...v1.13.0) (2022-05-04)
768
+
769
+
770
+
771
+ ## [1.12.8](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.12.7...v1.12.8) (2022-03-19)
772
+
773
+
774
+
775
+ ## [1.12.7](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.12.6...v1.12.7) (2022-03-08)
776
+
777
+
778
+
779
+ ## [1.12.6](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.12.5...v1.12.6) (2022-03-04)
780
+
781
+
782
+
783
+ ## [1.12.5](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.12.4...v1.12.5) (2022-02-15)
784
+
785
+
786
+
787
+ ## [1.12.4](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.12.3...v1.12.4) (2022-02-13)
788
+
789
+
790
+
791
+ ## [1.12.3](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.12.2...v1.12.3) (2022-02-05)
792
+
793
+
794
+
795
+ ## [1.12.2](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.12.1...v1.12.2) (2022-02-02)
796
+
797
+
798
+
799
+ ## [1.12.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.12.0...v1.12.1) (2022-02-02)
800
+
801
+
802
+
803
+ # [1.12.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.11.2...v1.12.0) (2022-01-30)
804
+
805
+
806
+
807
+ ## [1.11.2](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.11.1...v1.11.2) (2022-01-29)
808
+
809
+
810
+
811
+ ## [1.11.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.11.0...v1.11.1) (2022-01-29)
812
+
813
+
814
+
815
+ # [1.11.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.10.1...v1.11.0) (2022-01-29)
816
+
817
+
818
+
819
+ ## [1.10.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.10.0...v1.10.1) (2022-01-26)
820
+
821
+
822
+
823
+ # [1.10.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.9.0...v1.10.0) (2022-01-21)
824
+
825
+
826
+
827
+ # [1.9.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.8.2...v1.9.0) (2022-01-20)
828
+
829
+
830
+
831
+ ## [1.8.2](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.8.1...v1.8.2) (2022-01-16)
832
+
833
+
834
+
835
+ ## [1.8.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.8.0...v1.8.1) (2022-01-15)
836
+
837
+
838
+
839
+ # [1.8.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.7.0...v1.8.0) (2022-01-15)
840
+
841
+
842
+
843
+ # [1.7.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.6.3...v1.7.0) (2022-01-05)
844
+
845
+
846
+
847
+ ## [1.6.3](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.6.2...v1.6.3) (2022-01-03)
848
+
849
+
850
+
851
+ ## [1.6.2](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.6.1...v1.6.2) (2022-01-03)
852
+
853
+
854
+
855
+ ## [1.6.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.6.0...v1.6.1) (2022-01-02)
856
+
857
+
858
+
859
+ # [1.6.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.5.0...v1.6.0) (2021-12-31)
860
+
861
+
862
+
863
+ # [1.5.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.4.0...v1.5.0) (2021-12-27)
864
+
865
+
866
+
867
+ # [1.4.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.3.0...v1.4.0) (2021-12-16)
868
+
869
+
870
+
871
+ # [1.3.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.2.5...v1.3.0) (2021-12-02)
872
+
873
+
874
+
875
+ ## [1.2.5](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.2.4...v1.2.5) (2021-11-25)
876
+
877
+
878
+
879
+ ## [1.2.4](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.2.3...v1.2.4) (2021-11-25)
880
+
881
+
882
+
883
+ ## [1.2.3](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.2.2...v1.2.3) (2021-11-25)
884
+
885
+
886
+
887
+ ## [1.2.2](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.2.1...v1.2.2) (2021-11-25)
888
+
889
+
890
+
891
+ ## [1.2.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.2.0...v1.2.1) (2021-11-25)
892
+
893
+
894
+
895
+ # [1.2.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.1.0...v1.2.0) (2021-11-20)
896
+
897
+
898
+
899
+ # [1.1.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.0.2...v1.1.0) (2021-11-16)
900
+
901
+
902
+
903
+ ## [1.0.2](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.0.1...v1.0.2) (2021-11-16)
904
+
905
+
906
+
907
+ ## [1.0.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v1.0.0...v1.0.1) (2021-11-15)
908
+
909
+
910
+
911
+ # [1.0.0](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v0.1.1...v1.0.0) (2021-11-13)
912
+
913
+
914
+
915
+ ## [0.1.1](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v0.1.0...v0.1.1) (2021-09-11)
916
+
917
+
918
+
461
919
  # 0.1.0 (2021-09-11)
462
920
 
463
921
  ## [4.3.11](https://github.com/OpenWonderLabs/homebridge-switchbot/compare/v4.3.10...v4.3.11) (2026-02-17)
@@ -71,6 +71,8 @@
71
71
  </tr>
72
72
  </tbody>
73
73
  </table>
74
+ <h5 class="mt-4">Cached Accessories</h5>
75
+ <ul id="cachedAccessoriesList"></ul>
74
76
  <p class="text-center">External accessories will not be displayed here.</p>
75
77
  </div>
76
78
  </div>
@@ -161,6 +163,110 @@
161
163
  option.value = a.UUID;
162
164
  deviceSelect.add(option);
163
165
  });
166
+ const cachedAccessoriesList = document.getElementById('cachedAccessoriesList');
167
+ cachedAccessoriesList.innerHTML = ''; // Clear previous entries
168
+ cachedAccessories.forEach((a) => {
169
+ const listItem = document.createElement('li');
170
+ listItem.textContent = `${a.displayName} (${a.UUID || a.uuid})`;
171
+ cachedAccessoriesList.appendChild(listItem);
172
+ });
173
+ const validateConfig = (config) => {
174
+ const deviceIds = new Set();
175
+ const isValid = config[0].options.devices.every((device) => {
176
+ if (!device.deviceId || typeof device.deviceId !== 'string') {
177
+ homebridge.toast.error(`Invalid device ID: ${device.deviceId}`, 'Error');
178
+ return false;
179
+ }
180
+ if (deviceIds.has(device.deviceId)) {
181
+ homebridge.toast.error(`Duplicate device ID found: ${device.deviceId}`, 'Error');
182
+ return false;
183
+ }
184
+ deviceIds.add(device.deviceId);
185
+ return true;
186
+ });
187
+ return isValid;
188
+ };
189
+
190
+ const addDeviceToConfig = async (deviceId) => {
191
+ try {
192
+ homebridge.showSpinner();
193
+ const currentConfig = await homebridge.getPluginConfig();
194
+ if (!currentConfig[0].options.devices) {
195
+ currentConfig[0].options.devices = [];
196
+ }
197
+ currentConfig[0].options.devices.push({
198
+ deviceId: deviceId.replace(/:/g, ''),
199
+ hide_device: false,
200
+ disablePlatformBLE: false,
201
+ allowPush: false,
202
+ disableCaching: false,
203
+ });
204
+ if (!validateConfig(currentConfig)) {
205
+ homebridge.hideSpinner();
206
+ return;
207
+ }
208
+ await homebridge.updatePluginConfig(currentConfig);
209
+ await homebridge.savePluginConfig();
210
+ homebridge.toast.success('Device added to config successfully!', 'Success');
211
+ } catch (error) {
212
+ homebridge.toast.error('Failed to add device to config!', 'Error');
213
+ } finally {
214
+ homebridge.hideSpinner();
215
+ }
216
+ };
217
+
218
+ const protocolInfo = document.createElement('p');
219
+ protocolInfo.id = 'protocolInfo';
220
+ protocolInfo.style.marginTop = '10px';
221
+ document.getElementById('deviceInfo').appendChild(protocolInfo);
222
+
223
+ const addDeviceButton = document.createElement('button');
224
+ addDeviceButton.textContent = 'Add Device to Config';
225
+ addDeviceButton.className = 'btn btn-success';
226
+ addDeviceButton.style.marginTop = '10px';
227
+ addDeviceButton.addEventListener('click', () => {
228
+ const deviceId = document.getElementById('deviceId').textContent;
229
+ if (deviceId) {
230
+ addDeviceToConfig(deviceId);
231
+ } else {
232
+ homebridge.toast.error('No device ID found!', 'Error');
233
+ }
234
+ });
235
+ document.getElementById('deviceInfo').appendChild(addDeviceButton);
236
+
237
+ const updateTableWithDetails = (deviceContext) => {
238
+ const tableBody = document.querySelector('#deviceTable tbody');
239
+
240
+ Object.entries(deviceContext).forEach(([key, value]) => {
241
+ if (/string|number|boolean/.test(typeof value) && (typeof value !== 'string' || value.trim())) {
242
+ let existingCell = document.getElementById(key);
243
+ if (existingCell) {
244
+ existingCell.textContent = value;
245
+ } else {
246
+ const row = document.createElement('tr');
247
+ const keyCell = document.createElement('th');
248
+ keyCell.scope = 'row';
249
+ keyCell.textContent = key;
250
+ const valueCell = document.createElement('td');
251
+ valueCell.textContent = value;
252
+ row.appendChild(keyCell);
253
+ row.appendChild(valueCell);
254
+ tableBody.appendChild(row);
255
+ }
256
+ }
257
+ });
258
+ };
259
+
260
+ // Ensure the element exists before attempting to set its innerHTML
261
+ const safeSetInnerHTML = (id, value) => {
262
+ const element = document.getElementById(id);
263
+ if (element) {
264
+ element.innerHTML = value;
265
+ } else {
266
+ console.warn(`Element with id '${id}' not found.`);
267
+ }
268
+ };
269
+
164
270
  showDeviceInfo = async (UUID) => {
165
271
  homebridge.showSpinner();
166
272
  const thisAcc = cachedAccessories.find((x) => x.UUID === UUID);
@@ -1 +1 @@
1
- <!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>default | @switchbot/homebridge-switchbot</title><meta name="description" content="Documentation for @switchbot/homebridge-switchbot"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">@switchbot/homebridge-switchbot</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">default</a></li></ul><h1>Variable default</h1></div><div class="tsd-signature"><span class="tsd-kind-variable">default</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">API</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">void</span></div><div class="tsd-type-declaration"><h4>Type Declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature" id="__type"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">API</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">api</span>: <span class="tsd-signature-type">API</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/OpenWonderLabs/homebridge-switchbot/blob/b66834dea4e3c561bbad3d2663c09971e8e218f7/src/index.ts#L11">index.ts:11</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@switchbot/homebridge-switchbot</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer></footer><div class="overlay"></div></body></html>
1
+ <!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>default | @switchbot/homebridge-switchbot</title><meta name="description" content="Documentation for @switchbot/homebridge-switchbot"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">@switchbot/homebridge-switchbot</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">default</a></li></ul><h1>Variable default</h1></div><div class="tsd-signature"><span class="tsd-kind-variable">default</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">API</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=&gt;</span> <span class="tsd-signature-type">void</span></div><div class="tsd-type-declaration"><h4>Type Declaration</h4><ul class="tsd-parameters"><li class="tsd-parameter-signature"><ul class="tsd-signatures"><li class="tsd-signature" id="__type"><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">api</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">API</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span></li><li class="tsd-description"><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">api</span>: <span class="tsd-signature-type">API</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4></li></ul></li></ul></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/OpenWonderLabs/homebridge-switchbot/blob/0e266410b60b2dbd9e9769171fd64904bf333eb7/src/index.ts#L11">index.ts:11</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@switchbot/homebridge-switchbot</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer></footer><div class="overlay"></div></body></html>
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@switchbot/homebridge-switchbot",
3
3
  "displayName": "SwitchBot",
4
4
  "type": "module",
5
- "version": "4.3.12",
5
+ "version": "4.3.13",
6
6
  "description": "The SwitchBot plugin allows you to access your SwitchBot device(s) from HomeKit.",
7
7
  "author": "SwitchBot <support@wondertechlabs.com> (https://github.com/SwitchBot)",
8
8
  "contributors": [
@@ -71,6 +71,8 @@
71
71
  </tr>
72
72
  </tbody>
73
73
  </table>
74
+ <h5 class="mt-4">Cached Accessories</h5>
75
+ <ul id="cachedAccessoriesList"></ul>
74
76
  <p class="text-center">External accessories will not be displayed here.</p>
75
77
  </div>
76
78
  </div>
@@ -161,6 +163,110 @@
161
163
  option.value = a.UUID;
162
164
  deviceSelect.add(option);
163
165
  });
166
+ const cachedAccessoriesList = document.getElementById('cachedAccessoriesList');
167
+ cachedAccessoriesList.innerHTML = ''; // Clear previous entries
168
+ cachedAccessories.forEach((a) => {
169
+ const listItem = document.createElement('li');
170
+ listItem.textContent = `${a.displayName} (${a.UUID || a.uuid})`;
171
+ cachedAccessoriesList.appendChild(listItem);
172
+ });
173
+ const validateConfig = (config) => {
174
+ const deviceIds = new Set();
175
+ const isValid = config[0].options.devices.every((device) => {
176
+ if (!device.deviceId || typeof device.deviceId !== 'string') {
177
+ homebridge.toast.error(`Invalid device ID: ${device.deviceId}`, 'Error');
178
+ return false;
179
+ }
180
+ if (deviceIds.has(device.deviceId)) {
181
+ homebridge.toast.error(`Duplicate device ID found: ${device.deviceId}`, 'Error');
182
+ return false;
183
+ }
184
+ deviceIds.add(device.deviceId);
185
+ return true;
186
+ });
187
+ return isValid;
188
+ };
189
+
190
+ const addDeviceToConfig = async (deviceId) => {
191
+ try {
192
+ homebridge.showSpinner();
193
+ const currentConfig = await homebridge.getPluginConfig();
194
+ if (!currentConfig[0].options.devices) {
195
+ currentConfig[0].options.devices = [];
196
+ }
197
+ currentConfig[0].options.devices.push({
198
+ deviceId: deviceId.replace(/:/g, ''),
199
+ hide_device: false,
200
+ disablePlatformBLE: false,
201
+ allowPush: false,
202
+ disableCaching: false,
203
+ });
204
+ if (!validateConfig(currentConfig)) {
205
+ homebridge.hideSpinner();
206
+ return;
207
+ }
208
+ await homebridge.updatePluginConfig(currentConfig);
209
+ await homebridge.savePluginConfig();
210
+ homebridge.toast.success('Device added to config successfully!', 'Success');
211
+ } catch (error) {
212
+ homebridge.toast.error('Failed to add device to config!', 'Error');
213
+ } finally {
214
+ homebridge.hideSpinner();
215
+ }
216
+ };
217
+
218
+ const protocolInfo = document.createElement('p');
219
+ protocolInfo.id = 'protocolInfo';
220
+ protocolInfo.style.marginTop = '10px';
221
+ document.getElementById('deviceInfo').appendChild(protocolInfo);
222
+
223
+ const addDeviceButton = document.createElement('button');
224
+ addDeviceButton.textContent = 'Add Device to Config';
225
+ addDeviceButton.className = 'btn btn-success';
226
+ addDeviceButton.style.marginTop = '10px';
227
+ addDeviceButton.addEventListener('click', () => {
228
+ const deviceId = document.getElementById('deviceId').textContent;
229
+ if (deviceId) {
230
+ addDeviceToConfig(deviceId);
231
+ } else {
232
+ homebridge.toast.error('No device ID found!', 'Error');
233
+ }
234
+ });
235
+ document.getElementById('deviceInfo').appendChild(addDeviceButton);
236
+
237
+ const updateTableWithDetails = (deviceContext) => {
238
+ const tableBody = document.querySelector('#deviceTable tbody');
239
+
240
+ Object.entries(deviceContext).forEach(([key, value]) => {
241
+ if (/string|number|boolean/.test(typeof value) && (typeof value !== 'string' || value.trim())) {
242
+ let existingCell = document.getElementById(key);
243
+ if (existingCell) {
244
+ existingCell.textContent = value;
245
+ } else {
246
+ const row = document.createElement('tr');
247
+ const keyCell = document.createElement('th');
248
+ keyCell.scope = 'row';
249
+ keyCell.textContent = key;
250
+ const valueCell = document.createElement('td');
251
+ valueCell.textContent = value;
252
+ row.appendChild(keyCell);
253
+ row.appendChild(valueCell);
254
+ tableBody.appendChild(row);
255
+ }
256
+ }
257
+ });
258
+ };
259
+
260
+ // Ensure the element exists before attempting to set its innerHTML
261
+ const safeSetInnerHTML = (id, value) => {
262
+ const element = document.getElementById(id);
263
+ if (element) {
264
+ element.innerHTML = value;
265
+ } else {
266
+ console.warn(`Element with id '${id}' not found.`);
267
+ }
268
+ };
269
+
164
270
  showDeviceInfo = async (UUID) => {
165
271
  homebridge.showSpinner();
166
272
  const thisAcc = cachedAccessories.find((x) => x.UUID === UUID);