@switchbot/homebridge-switchbot 5.0.0-beta.136 → 5.0.0-beta.138

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.
Files changed (61) hide show
  1. package/dist/errors.d.ts +37 -4
  2. package/dist/errors.d.ts.map +1 -1
  3. package/dist/errors.js +31 -50
  4. package/dist/errors.js.map +1 -1
  5. package/dist/homebridge-ui/endpoints/devices.d.ts.map +1 -1
  6. package/dist/homebridge-ui/endpoints/devices.js.map +1 -1
  7. package/dist/platform.d.ts +2 -1
  8. package/dist/platform.d.ts.map +1 -1
  9. package/dist/platform.js +1 -1
  10. package/dist/platform.js.map +1 -1
  11. package/dist/switchbotClient.d.ts +0 -4
  12. package/dist/switchbotClient.d.ts.map +1 -1
  13. package/dist/switchbotClient.js +16 -90
  14. package/dist/switchbotClient.js.map +1 -1
  15. package/docs/variables/default.html +1 -1
  16. package/package.json +3 -3
  17. package/src/errors.ts +30 -38
  18. package/src/homebridge-ui/endpoints/devices.ts +29 -14
  19. package/src/platform.ts +1 -1
  20. package/src/switchbotClient.ts +16 -90
  21. package/test/client/switchbot-client-debounce.spec.ts +35 -0
  22. package/test/client/switchbot-client-openapi.spec.ts +19 -0
  23. package/test/client/switchbotClient.spec.ts +23 -0
  24. package/test/device/device-mapping.spec.ts +23 -0
  25. package/test/device/deviceBase.spec.ts +26 -0
  26. package/test/device/deviceFactory-edge.spec.ts +15 -0
  27. package/test/device/deviceFactory.spec.ts +33 -0
  28. package/test/device/fan-swing.spec.ts +34 -0
  29. package/test/device/irdevice.spec.ts +9 -0
  30. package/test/device/lock-users.spec.ts +35 -0
  31. package/test/device/matter-descriptors.spec.ts +22 -0
  32. package/test/device/matter-device-state.spec.ts +37 -0
  33. package/test/errors/errors.spec.ts +10 -0
  34. package/test/homebridge-ui/server.spec.ts +9 -0
  35. package/test/platform/accessory-restore.spec.ts +36 -0
  36. package/test/platform/matter-childbridge.spec.ts +34 -0
  37. package/test/platform/matter-integration.spec.ts +33 -0
  38. package/test/platform/platform-edge.spec.ts +72 -0
  39. package/test/platform/platform.integration.spec.ts +34 -0
  40. package/test/utils/utils-extra.spec.ts +10 -0
  41. package/test/utils/utils.spec.ts +53 -0
  42. package/todo/TODO.md +55 -165
  43. package/test/accessory-restore.spec.ts +0 -74
  44. package/test/device-mapping.spec.ts +0 -38
  45. package/test/deviceFactory.spec.ts +0 -19
  46. package/test/fan-swing.spec.ts +0 -30
  47. package/test/lock-users.spec.ts +0 -44
  48. package/test/matter-childbridge.spec.ts +0 -62
  49. package/test/matter-descriptors.spec.ts +0 -110
  50. package/test/matter-device-state.spec.ts +0 -117
  51. package/test/matter-integration.spec.ts +0 -183
  52. package/test/platform.integration.spec.ts +0 -57
  53. package/test/switchbot-client-debounce.spec.ts +0 -127
  54. package/test/switchbot-client-openapi.spec.ts +0 -63
  55. package/test/switchbotClient.spec.ts +0 -11
  56. package/test/utils.spec.ts +0 -37
  57. package/todo/COMPLETED.md +0 -542
  58. package/todo/README.md +0 -59
  59. package/todo/mockups/filtering-sorting.svg +0 -112
  60. package/todo/mockups/modal-switchbot-theme.svg +0 -66
  61. package/todo/mockups/signal-strength-visualization.svg +0 -94
@@ -1,112 +0,0 @@
1
- <svg width="700" height="500" xmlns="http://www.w3.org/2000/svg">
2
- <!-- Background -->
3
- <rect width="700" height="500" fill="#f5f5f5"/>
4
-
5
- <!-- Title -->
6
- <text x="20" y="30" font-family="system-ui, -apple-system, Arial" font-size="18" font-weight="600" fill="#1a1a1a">
7
- Discovery Results - Filtering &amp; Sorting
8
- </text>
9
-
10
- <!-- Main Container -->
11
- <rect x="20" y="50" width="660" height="430" rx="8" fill="#fff" stroke="#ddd" stroke-width="1"/>
12
-
13
- <!-- Filter Buttons -->
14
- <g transform="translate(40, 75)">
15
- <text x="0" y="0" font-family="system-ui" font-size="12" font-weight="600" fill="#666">Filter by Connection:</text>
16
-
17
- <!-- All Button (Active) -->
18
- <rect x="0" y="10" width="60" height="32" rx="6" fill="#ef4444"/>
19
- <text x="30" y="31" font-family="system-ui" font-size="13" font-weight="500" fill="#fff" text-anchor="middle">All</text>
20
-
21
- <!-- BLE Button -->
22
- <rect x="70" y="10" width="80" height="32" rx="6" fill="#e5e7eb" stroke="#ddd" stroke-width="1"/>
23
- <text x="110" y="31" font-family="system-ui" font-size="13" font-weight="500" fill="#4b5563" text-anchor="middle">BLE Only</text>
24
-
25
- <!-- API Button -->
26
- <rect x="160" y="10" width="80" height="32" rx="6" fill="#e5e7eb" stroke="#ddd" stroke-width="1"/>
27
- <text x="200" y="31" font-family="system-ui" font-size="13" font-weight="500" fill="#4b5563" text-anchor="middle">API Only</text>
28
-
29
- <!-- Both Button -->
30
- <rect x="250" y="10" width="60" height="32" rx="6" fill="#e5e7eb" stroke="#ddd" stroke-width="1"/>
31
- <text x="280" y="31" font-family="system-ui" font-size="13" font-weight="500" fill="#4b5563" text-anchor="middle">Both</text>
32
-
33
- <!-- IR Button -->
34
- <rect x="320" y="10" width="100" height="32" rx="6" fill="#e5e7eb" stroke="#ddd" stroke-width="1"/>
35
- <text x="370" y="31" font-family="system-ui" font-size="13" font-weight="500" fill="#4b5563" text-anchor="middle">IR Devices</text>
36
- </g>
37
-
38
- <!-- Sort Dropdown and Search -->
39
- <g transform="translate(40, 145)">
40
- <text x="0" y="0" font-family="system-ui" font-size="12" font-weight="600" fill="#666">Sort by:</text>
41
-
42
- <!-- Sort Dropdown -->
43
- <rect x="0" y="10" width="180" height="32" rx="6" fill="#fff" stroke="#d1d5db" stroke-width="1"/>
44
- <text x="10" y="31" font-family="system-ui" font-size="13" fill="#1a1a1a">Signal Strength ▼</text>
45
-
46
- <!-- Search Box -->
47
- <text x="210" y="0" font-family="system-ui" font-size="12" font-weight="600" fill="#666">Search:</text>
48
- <rect x="210" y="10" width="410" height="32" rx="6" fill="#fff" stroke="#d1d5db" stroke-width="1"/>
49
- <text x="220" y="31" font-family="system-ui" font-size="13" fill="#9ca3af">🔍 Search by name, ID, or type...</text>
50
- </g>
51
-
52
- <!-- Status Line -->
53
- <text x="40" y="210" font-family="system-ui" font-size="12" fill="#666">
54
- Showing 12 of 12 device(s)
55
- </text>
56
-
57
- <!-- Device List -->
58
- <g transform="translate(40, 230)">
59
- <!-- Device 1 -->
60
- <rect x="0" y="0" width="620" height="50" rx="4" fill="#f9f9f9" stroke="#e0e0e0" stroke-width="1"/>
61
- <text x="15" y="22" font-family="system-ui" font-size="14" font-weight="500" fill="#1a1a1a">Kitchen Hub</text>
62
- <text x="15" y="38" font-family="monospace" font-size="11" fill="#666">B0E9FEC3F112 | Hub 2</text>
63
-
64
- <!-- Signal bars - 4 bars -->
65
- <g transform="translate(500, 12)">
66
- <rect x="0" y="12" width="6" height="3" rx="1" fill="#10b981"/>
67
- <rect x="9" y="8" width="6" height="7" rx="1" fill="#10b981"/>
68
- <rect x="18" y="4" width="6" height="11" rx="1" fill="#10b981"/>
69
- <rect x="27" y="0" width="6" height="15" rx="1" fill="#10b981"/>
70
- </g>
71
-
72
- <!-- Connection badge -->
73
- <rect x="550" y="13" width="50" height="18" rx="4" fill="#fef3c7"/>
74
- <text x="575" y="26" font-family="system-ui" font-size="10" font-weight="500" fill="#d97706" text-anchor="middle">Both</text>
75
-
76
- <!-- Device 2 -->
77
- <rect x="0" y="60" width="620" height="50" rx="4" fill="#f9f9f9" stroke="#e0e0e0" stroke-width="1"/>
78
- <text x="15" y="82" font-family="system-ui" font-size="14" font-weight="500" fill="#1a1a1a">Front Door Bot</text>
79
- <text x="15" y="98" font-family="monospace" font-size="11" fill="#666">84F703B32E12 | Bot</text>
80
-
81
- <!-- Signal bars - 3 bars -->
82
- <g transform="translate(500, 72)">
83
- <rect x="0" y="12" width="6" height="3" rx="1" fill="#eab308"/>
84
- <rect x="9" y="8" width="6" height="7" rx="1" fill="#eab308"/>
85
- <rect x="18" y="4" width="6" height="11" rx="1" fill="#eab308"/>
86
- <rect x="27" y="0" width="6" height="15" rx="1" fill="#e5e7eb"/>
87
- </g>
88
-
89
- <!-- Connection badge -->
90
- <rect x="550" y="73" width="50" height="18" rx="4" fill="#dbeafe"/>
91
- <text x="575" y="86" font-family="system-ui" font-size="10" font-weight="500" fill="#3b82f6" text-anchor="middle">BLE</text>
92
-
93
- <!-- Device 3 -->
94
- <rect x="0" y="120" width="620" height="50" rx="4" fill="#f9f9f9" stroke="#e0e0e0" stroke-width="1"/>
95
- <text x="15" y="142" font-family="system-ui" font-size="14" font-weight="500" fill="#1a1a1a">Living Room TV</text>
96
- <text x="15" y="158" font-family="monospace" font-size="11" fill="#666">IR-A1B2C3D4 | TV (IR)</text>
97
-
98
- <!-- No signal bars for IR -->
99
-
100
- <!-- Connection badge -->
101
- <rect x="550" y="133" width="50" height="18" rx="4" fill="#fce7f3"/>
102
- <text x="575" y="146" font-family="system-ui" font-size="10" font-weight="500" fill="#ec4899" text-anchor="middle">IR</text>
103
- </g>
104
-
105
- <!-- Feature Labels -->
106
- <g transform="translate(40, 450)">
107
- <text x="0" y="0" font-family="system-ui" font-size="10" font-weight="600" fill="#9ca3af">Features:</text>
108
- <text x="0" y="15" font-family="system-ui" font-size="9" fill="#9ca3af">✓ Real-time search with 300ms debounce</text>
109
- <text x="200" y="15" font-family="system-ui" font-size="9" fill="#9ca3af">✓ Client-side filtering (instant)</text>
110
- <text x="400" y="15" font-family="system-ui" font-size="9" fill="#9ca3af">✓ localStorage persistence</text>
111
- </g>
112
- </svg>
@@ -1,66 +0,0 @@
1
- <svg width="600" height="500" xmlns="http://www.w3.org/2000/svg">
2
- <!-- Backdrop Overlay -->
3
- <rect width="600" height="500" fill="rgba(0,0,0,0.7)"/>
4
-
5
- <!-- Modal Container -->
6
- <g transform="translate(60, 80)">
7
- <!-- Modal Background with Red Top Border -->
8
- <rect x="0" y="4" width="480" height="370" rx="12" fill="#fff"/>
9
- <rect x="0" y="0" width="480" height="4" rx="2" fill="#ef4444"/>
10
-
11
- <!-- Box Shadow Effect -->
12
- <rect x="2" y="6" width="476" height="368" rx="12" fill="none" stroke="rgba(0,0,0,0.1)" stroke-width="2"/>
13
-
14
- <!-- Modal Header -->
15
- <text x="24" y="50" font-family="system-ui, -apple-system, Arial" font-size="20" font-weight="600" fill="#ef4444">
16
- Edit Device
17
- </text>
18
-
19
- <!-- Content Area -->
20
- <g transform="translate(24, 80)">
21
- <!-- Device Name Field -->
22
- <text x="0" y="0" font-family="system-ui" font-size="13" font-weight="500" fill="#374151">Device Name</text>
23
- <rect x="0" y="8" width="432" height="40" rx="6" fill="#fff" stroke="#d1d5db" stroke-width="1"/>
24
- <text x="10" y="33" font-family="system-ui" font-size="14" fill="#1a1a1a">Girl's Bedroom Hub</text>
25
-
26
- <!-- API Device Type Field (Read-only) -->
27
- <text x="0" y="70" font-family="system-ui" font-size="13" font-weight="500" fill="#374151">Device Type (API - Read Only)</text>
28
- <rect x="0" y="78" width="432" height="40" rx="6" fill="#f9fafb" stroke="#d1d5db" stroke-width="1"/>
29
- <text x="10" y="103" font-family="system-ui" font-size="14" fill="#6b7280">Hub 2</text>
30
-
31
- <!-- Config Device Type Dropdown -->
32
- <text x="0" y="140" font-family="system-ui" font-size="13" font-weight="500" fill="#374151">Config Device Type (Override)</text>
33
- <rect x="0" y="148" width="432" height="40" rx="6" fill="#fff" stroke="#d1d5db" stroke-width="1"/>
34
- <text x="10" y="173" font-family="system-ui" font-size="14" fill="#1a1a1a">Hub 2 ▼</text>
35
-
36
- <!-- Divider Line -->
37
- <line x1="0" y1="220" x2="432" y2="220" stroke="rgba(0,0,0,0.1)" stroke-width="1"/>
38
-
39
- <!-- Button Group -->
40
- <g transform="translate(0, 240)">
41
- <!-- Cancel Button -->
42
- <rect x="0" y="0" width="100" height="40" rx="6" fill="#6b7280"/>
43
- <text x="50" y="25" font-family="system-ui" font-size="14" font-weight="500" fill="#fff" text-anchor="middle">Cancel</text>
44
-
45
- <!-- Save Button with Hover Effect -->
46
- <g transform="translate(332, 0)">
47
- <!-- Button Shadow -->
48
- <rect x="0" y="2" width="100" height="40" rx="6" fill="rgba(239,68,68,0.2)"/>
49
- <!-- Button -->
50
- <rect x="0" y="0" width="100" height="40" rx="6" fill="#ef4444"/>
51
- <text x="50" y="25" font-family="system-ui" font-size="14" font-weight="500" fill="#fff" text-anchor="middle">Save</text>
52
- </g>
53
- </g>
54
- </g>
55
- </g>
56
-
57
- <!-- Design Notes -->
58
- <g transform="translate(20, 470)">
59
- <text x="0" y="0" font-family="system-ui" font-size="10" font-weight="600" fill="#9ca3af">Design Elements:</text>
60
- <text x="100" y="0" font-family="system-ui" font-size="9" fill="#9ca3af">● 4px SwitchBot Red top accent</text>
61
- <text x="270" y="0" font-family="system-ui" font-size="9" fill="#9ca3af">● 12px border-radius</text>
62
- <text x="380" y="0" font-family="system-ui" font-size="9" fill="#9ca3af">● Smooth shadows</text>
63
- <text x="100" y="15" font-family="system-ui" font-size="9" fill="#9ca3af">● Red title and primary button</text>
64
- <text x="270" y="15" font-family="system-ui" font-size="9" fill="#9ca3af">● Gray secondary button</text>
65
- </g>
66
- </svg>
@@ -1,94 +0,0 @@
1
- <svg width="600" height="400" xmlns="http://www.w3.org/2000/svg">
2
- <!-- Background -->
3
- <rect width="600" height="400" fill="#f5f5f5"/>
4
-
5
- <!-- Title -->
6
- <text x="20" y="30" font-family="system-ui, -apple-system, Arial" font-size="18" font-weight="600" fill="#1a1a1a">
7
- Discovery Results - Signal Strength Visualization
8
- </text>
9
-
10
- <!-- Device List Container -->
11
- <rect x="20" y="50" width="560" height="330" rx="8" fill="#fff" stroke="#ddd" stroke-width="1"/>
12
-
13
- <!-- Device 1: Excellent Signal -->
14
- <g transform="translate(40, 80)">
15
- <text font-family="system-ui" font-size="14" font-weight="500" fill="#1a1a1a">Living Room Bot</text>
16
- <text y="20" font-family="monospace" font-size="12" fill="#666">C1A2B3C4D5E6</text>
17
-
18
- <!-- RSSI Bars - 4 bars filled (Excellent) -->
19
- <g transform="translate(0, 35)">
20
- <rect x="0" y="12" width="8" height="4" rx="1" fill="#10b981"/>
21
- <rect x="12" y="8" width="8" height="8" rx="1" fill="#10b981"/>
22
- <rect x="24" y="4" width="8" height="12" rx="1" fill="#10b981"/>
23
- <rect x="36" y="0" width="8" height="16" rx="1" fill="#10b981"/>
24
- </g>
25
-
26
- <!-- Quality Badge -->
27
- <rect x="60" y="35" width="80" height="20" rx="4" fill="#d1fae5"/>
28
- <text x="100" y="49" font-family="system-ui" font-size="11" font-weight="500" fill="#10b981" text-anchor="middle">Excellent</text>
29
-
30
- <!-- RSSI Value -->
31
- <text x="150" y="49" font-family="monospace" font-size="11" fill="#666">-55 dBm</text>
32
-
33
- <!-- Connection Badge -->
34
- <rect x="220" y="35" width="45" height="20" rx="4" fill="#dbeafe"/>
35
- <text x="242.5" y="49" font-family="system-ui" font-size="11" font-weight="500" fill="#3b82f6" text-anchor="middle">BLE</text>
36
- </g>
37
-
38
- <!-- Device 2: Good Signal -->
39
- <g transform="translate(40, 180)">
40
- <text font-family="system-ui" font-size="14" font-weight="500" fill="#1a1a1a">Bedroom Curtain</text>
41
- <text y="20" font-family="monospace" font-size="12" fill="#666">F7E8D9C0B1A2</text>
42
-
43
- <!-- RSSI Bars - 3 bars filled (Good) -->
44
- <g transform="translate(0, 35)">
45
- <rect x="0" y="12" width="8" height="4" rx="1" fill="#eab308"/>
46
- <rect x="12" y="8" width="8" height="8" rx="1" fill="#eab308"/>
47
- <rect x="24" y="4" width="8" height="12" rx="1" fill="#eab308"/>
48
- <rect x="36" y="0" width="8" height="16" rx="1" fill="#e5e7eb"/>
49
- </g>
50
-
51
- <!-- Quality Badge -->
52
- <rect x="60" y="35" width="80" height="20" rx="4" fill="#fef9c3"/>
53
- <text x="100" y="49" font-family="system-ui" font-size="11" font-weight="500" fill="#eab308" text-anchor="middle">Good</text>
54
-
55
- <!-- RSSI Value -->
56
- <text x="150" y="49" font-family="monospace" font-size="11" fill="#666">-68 dBm</text>
57
-
58
- <!-- Connection Badge -->
59
- <rect x="220" y="35" width="45" height="20" rx="4" fill="#dbeafe"/>
60
- <text x="242.5" y="49" font-family="system-ui" font-size="11" font-weight="500" fill="#3b82f6" text-anchor="middle">BLE</text>
61
- </g>
62
-
63
- <!-- Device 3: Fair Signal -->
64
- <g transform="translate(40, 280)">
65
- <text font-family="system-ui" font-size="14" font-weight="500" fill="#1a1a1a">Garage Lock</text>
66
- <text y="20" font-family="monospace" font-size="12" fill="#666">A1B2C3D4E5F6</text>
67
-
68
- <!-- RSSI Bars - 2 bars filled (Fair) -->
69
- <g transform="translate(0, 35)">
70
- <rect x="0" y="12" width="8" height="4" rx="1" fill="#f97316"/>
71
- <rect x="12" y="8" width="8" height="8" rx="1" fill="#f97316"/>
72
- <rect x="24" y="4" width="8" height="12" rx="1" fill="#e5e7eb"/>
73
- <rect x="36" y="0" width="8" height="16" rx="1" fill="#e5e7eb"/>
74
- </g>
75
-
76
- <!-- Quality Badge -->
77
- <rect x="60" y="35" width="80" height="20" rx="4" fill="#ffedd5"/>
78
- <text x="100" y="49" font-family="system-ui" font-size="11" font-weight="500" fill="#f97316" text-anchor="middle">Fair</text>
79
-
80
- <!-- RSSI Value -->
81
- <text x="150" y="49" font-family="monospace" font-size="11" fill="#666">-78 dBm</text>
82
-
83
- <!-- Connection Badge -->
84
- <rect x="220" y="35" width="45" height="20" rx="4" fill="#dbeafe"/>
85
- <text x="242.5" y="49" font-family="system-ui" font-size="11" font-weight="500" fill="#3b82f6" text-anchor="middle">BLE</text>
86
- </g>
87
-
88
- <!-- Legend -->
89
- <text x="400" y="100" font-family="system-ui" font-size="12" font-weight="600" fill="#666">Signal Quality:</text>
90
- <text x="400" y="120" font-family="system-ui" font-size="11" fill="#10b981">● Excellent: &gt; -60 dBm</text>
91
- <text x="400" y="140" font-family="system-ui" font-size="11" fill="#eab308">● Good: -60 to -75 dBm</text>
92
- <text x="400" y="160" font-family="system-ui" font-size="11" fill="#f97316">● Fair: -75 to -85 dBm</text>
93
- <text x="400" y="180" font-family="system-ui" font-size="11" fill="#ef4444">● Poor: &lt; -85 dBm</text>
94
- </svg>