Skip to content

Commit 5c6fbd2

Browse files
author
homebridge-bot
committed
Device management UI
πŸ” Discover devices from SwitchBot API βž• Add devices to config automatically ✏️ Edit device names πŸ—‘οΈ Delete devices πŸ“‹ Copy device IDs All without manually editing config files
1 parent 95e4bbb commit 5c6fbd2

File tree

8 files changed

+1536
-3387
lines changed

8 files changed

+1536
-3387
lines changed

β€Žconfig.schema.jsonβ€Ž

Lines changed: 100 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,106 @@
1-
{
2-
"pluginAlias": "SwitchBot",
3-
"pluginType": "platform",
4-
"singular": true,
5-
"customUi": true,
6-
"customUiPath": "./dist/homebridge-ui",
7-
"headerDisplay": "<p align='center'><img width='100px' src='https://user-images.githubusercontent.com/9875439/102681754-ac2eb800-4189-11eb-8e17-7c47c804484b.png'></p>\n\nThe **SwitchBot** plugin allows you to control SwitchBot Devices. Use the hybrid client (BLE + OpenAPI) or only OpenAPI by supplying an Open Token.",
8-
"footerDisplay": "Please raise any issues on our [project page](https://github.com/OpenWonderLabs/homebridge-switchbot/issues).",
9-
"schema": {
10-
"type": "object",
11-
"required": [],
12-
"properties": {
13-
"name": {
14-
"type": "string",
15-
"title": "Name",
16-
"default": "SwitchBot"
17-
},
18-
"openApiToken": {
19-
"type": "string",
20-
"title": "OpenAPI Token",
21-
"description": "SwitchBot OpenAPI token used as a fallback when BLE isn't available. Keep this secret.",
22-
"format": "password"
23-
},
24-
"openApiSecret": {
25-
"type": "string",
26-
"title": "OpenAPI Secret (optional)",
27-
"description": "Optional OpenAPI secret for certain account setups.",
28-
"format": "password"
29-
},
30-
"enableMatter": {
31-
"type": "boolean",
32-
"title": "Enable Matter Support",
33-
"default": true,
34-
"description": "Allow the plugin to register Matter accessories when Homebridge Matter is available."
35-
},
36-
"preferMatter": {
37-
"type": "boolean",
38-
"title": "Prefer Matter when available",
39-
"default": true,
40-
"description": "If enabled and Matter is available, device will be presented as Matter accessories where supported."
41-
},
42-
"devices": {
43-
"type": "array",
44-
"title": "Devices",
45-
"description": "List of SwitchBot devices to manage. Use the UI to add devices and copy device IDs.",
46-
"items": {
47-
"type": "object",
48-
"required": ["deviceId", "configDeviceType"],
49-
"properties": {
50-
"configDeviceName": {
51-
"type": "string",
52-
"title": "Name",
53-
"description": "Friendly name for this device as shown in HomeKit/Matter."
54-
},
55-
"deviceId": {
56-
"type": "string",
57-
"title": "Device ID",
58-
"description": "The SwitchBot device identifier (MAC or SwitchBot Cloud deviceId). Use the plugin UI to copy this."
59-
},
60-
"configDeviceType": {
61-
"type": "string",
62-
"title": "Device Type",
63-
"description": "Select the device type so the plugin can expose the correct HomeKit/Matter services and characteristics.",
64-
"enum": [
65-
"bot",
66-
"curtain",
67-
"fan",
68-
"light",
69-
"lightstrip",
70-
"motion",
71-
"contact",
72-
"vacuum",
73-
"lock",
74-
"humidifier",
75-
"temperature",
76-
"relay",
77-
"plug",
78-
"wosweeper",
79-
"blindtilt",
80-
"curtain3",
81-
"rollershade",
82-
"meter",
83-
"waterdetector",
84-
"walletfinder",
85-
"unknown"
86-
],
87-
"default": "unknown"
88-
},
89-
"connectionPreference": {
90-
"type": "string",
91-
"title": "Connection Preference",
92-
"description": "Select whether this device should prefer BLE, OpenAPI, or auto-detect (hybrid).",
93-
"enum": ["auto", "ble", "openapi"],
94-
"default": "auto"
95-
},
96-
"room": {
97-
"type": "string",
98-
"title": "Room",
99-
"description": "Optional room/location metadata for the device."
100-
}
1+
{
2+
"pluginAlias": "SwitchBot",
3+
"pluginType": "platform",
4+
"singular": true,
5+
"customUi": true,
6+
"customUiPath": "./dist/homebridge-ui",
7+
"headerDisplay": "<p align='center'><img width='100px' src='https://user-images.githubusercontent.com/9875439/102681754-ac2eb800-4189-11eb-8e17-7c47c804484b.png'></p>\n\nThe **SwitchBot** plugin allows you to control SwitchBot Devices. Use the hybrid client (BLE + OpenAPI) or only OpenAPI by supplying an Open Token.",
8+
"footerDisplay": "Please raise any issues on our [project page](https://github.com/OpenWonderLabs/homebridge-switchbot/issues).",
9+
"schema": {
10+
"type": "object",
11+
"required": [],
12+
"properties": {
13+
"name": {
14+
"type": "string",
15+
"title": "Name",
16+
"default": "SwitchBot"
17+
},
18+
"openApiToken": {
19+
"type": "string",
20+
"title": "OpenAPI Token",
21+
"description": "SwitchBot OpenAPI token used as a fallback when BLE isn't available. Keep this secret.",
22+
"format": "password"
23+
},
24+
"openApiSecret": {
25+
"type": "string",
26+
"title": "OpenAPI Secret (optional)",
27+
"description": "Optional OpenAPI secret for certain account setups.",
28+
"format": "password"
29+
},
30+
"enableMatter": {
31+
"type": "boolean",
32+
"title": "Enable Matter Support",
33+
"default": true,
34+
"description": "Allow the plugin to register Matter accessories when Homebridge Matter is available."
35+
},
36+
"preferMatter": {
37+
"type": "boolean",
38+
"title": "Prefer Matter when available",
39+
"default": true,
40+
"description": "If enabled and Matter is available, device will be presented as Matter accessories where supported."
41+
},
42+
"devices": {
43+
"type": "array",
44+
"title": "Devices",
45+
"description": "List of SwitchBot devices to manage. Use the UI to add devices and copy device IDs.",
46+
"items": {
47+
"type": "object",
48+
"required": ["deviceId", "configDeviceType"],
49+
"properties": {
50+
"configDeviceName": {
51+
"type": "string",
52+
"title": "Name",
53+
"description": "Friendly name for this device as shown in HomeKit/Matter."
54+
},
55+
"deviceId": {
56+
"type": "string",
57+
"title": "Device ID",
58+
"description": "The SwitchBot device identifier (MAC or SwitchBot Cloud deviceId). Use the plugin UI to copy this."
59+
},
60+
"configDeviceType": {
61+
"type": "string",
62+
"title": "Device Type",
63+
"description": "Select the device type so the plugin can expose the correct HomeKit/Matter services and characteristics.",
64+
"enum": [
65+
"bot",
66+
"curtain",
67+
"fan",
68+
"light",
69+
"lightstrip",
70+
"motion",
71+
"contact",
72+
"vacuum",
73+
"lock",
74+
"humidifier",
75+
"temperature",
76+
"relay",
77+
"plug",
78+
"wosweeper",
79+
"blindtilt",
80+
"curtain3",
81+
"rollershade",
82+
"meter",
83+
"waterdetector",
84+
"walletfinder",
85+
"unknown"
86+
],
87+
"default": "unknown"
88+
},
89+
"connectionPreference": {
90+
"type": "string",
91+
"title": "Connection Preference",
92+
"description": "Select whether this device should prefer BLE, OpenAPI, or auto-detect (hybrid).",
93+
"enum": ["auto", "ble", "openapi"],
94+
"default": "auto"
95+
},
96+
"room": {
97+
"type": "string",
98+
"title": "Room",
99+
"description": "Optional room/location metadata for the device."
101100
}
102101
}
103102
}
104103
}
105104
}
106105
}
106+
}

β€Ždocs/variables/default.htmlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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/f56eec5368fd4a3ad430dc4050f2debcbd5f6cf2/src/index.ts#L12">index.ts:12</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/0c3bba22e06039260e02162e71169960ccffbc82/src/index.ts#L12">index.ts:12</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>

β€Žeslint.config.jsβ€Ž

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,17 @@ export default antfu(
1010
},
1111
rules: {
1212
'curly': ['error', 'multi-line'],
13-
'import/order': 0,
1413
'jsdoc/check-alignment': 'error',
1514
'jsdoc/check-line-alignment': 'error',
1615
'perfectionist/sort-exports': 'error',
1716
'perfectionist/sort-imports': [
1817
'error',
1918
{
2019
groups: [
21-
'builtin-type',
22-
'external-type',
23-
'internal-type',
24-
['parent-type', 'sibling-type', 'index-type'],
25-
'builtin',
26-
'external',
20+
'type',
21+
['builtin', 'external'],
2722
'internal',
2823
['parent', 'sibling', 'index'],
29-
'object',
3024
'unknown',
3125
],
3226
order: 'asc',

0 commit comments

Comments
Β (0)