Skip to content

Commit 2dca97c

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 7a34889 commit 2dca97c

File tree

7 files changed

+1768
-3387
lines changed

7 files changed

+1768
-3387
lines changed

β€Žconfig.schema.jsonβ€Ž

Lines changed: 129 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,134 @@
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+
"devices": {
31+
"type": "array",
32+
"title": "Devices",
33+
"description": "List of SwitchBot devices to manage. Use the UI to add devices and copy device IDs.",
34+
"items": {
35+
"type": "object",
36+
"required": ["deviceId", "configDeviceType"],
37+
"properties": {
38+
"configDeviceName": {
39+
"type": "string",
40+
"title": "Name",
41+
"description": "Friendly name for this device as shown in HomeKit/Matter."
42+
},
43+
"deviceId": {
44+
"type": "string",
45+
"title": "Device ID",
46+
"description": "The SwitchBot device identifier (MAC or SwitchBot Cloud deviceId). Use the plugin UI to copy this."
47+
},
48+
"configDeviceType": {
49+
"type": "string",
50+
"title": "Device Type",
51+
"description": "Select the device type so the plugin can expose the correct HomeKit/Matter services and characteristics.",
52+
"enum": [
53+
"bot",
54+
"curtain",
55+
"fan",
56+
"light",
57+
"lightstrip",
58+
"motion",
59+
"contact",
60+
"vacuum",
61+
"lock",
62+
"humidifier",
63+
"temperature",
64+
"relay",
65+
"plug",
66+
"wosweeper",
67+
"blindtilt",
68+
"curtain3",
69+
"rollershade",
70+
"meter",
71+
"waterdetector",
72+
"walletfinder",
73+
"unknown"
74+
],
75+
"default": "unknown"
76+
},
77+
"connectionPreference": {
78+
"type": "string",
79+
"title": "Connection Preference",
80+
"description": "Select whether this device should prefer BLE, OpenAPI, or auto-detect (hybrid).",
81+
"enum": ["auto", "ble", "openapi"],
82+
"default": "auto"
83+
},
84+
"room": {
85+
"type": "string",
86+
"title": "Room",
87+
"description": "Optional room/location metadata for the device."
10188
}
10289
}
10390
}
91+
},
92+
"enableMatter": {
93+
"type": "boolean",
94+
"title": "Enable Matter Support (Override)",
95+
"description": "Manually enable Matter support. By default, Matter is auto-detected from the child bridge configuration. Only change this if you need to override the auto-detection."
96+
},
97+
"preferMatter": {
98+
"type": "boolean",
99+
"title": "Prefer Matter when available",
100+
"description": "If enabled and Matter is available, devices will be presented as Matter accessories where supported (instead of HAP)."
104101
}
105102
}
106-
}
103+
},
104+
"layout": [
105+
{
106+
"type": "fieldset",
107+
"title": "API Credentials",
108+
"expandable": false,
109+
"items": [
110+
"name",
111+
"openApiToken",
112+
"openApiSecret"
113+
]
114+
},
115+
{
116+
"type": "fieldset",
117+
"title": "Devices",
118+
"expandable": false,
119+
"items": [
120+
"devices"
121+
]
122+
},
123+
{
124+
"type": "fieldset",
125+
"title": "Advanced Settings",
126+
"expandable": true,
127+
"expanded": false,
128+
"items": [
129+
"enableMatter",
130+
"preferMatter"
131+
]
132+
}
133+
]
134+
}

β€Ž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)