forked from alexryd/homebridge-shelly-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.schema.json
302 lines (302 loc) · 10.9 KB
/
config.schema.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
{
"pluginAlias": "ShellyNG",
"pluginType": "platform",
"singular": true,
"schema": {
"type": "object",
"properties": {
"name": {
"title": "Name",
"type": "string",
"required": true,
"default": "Shelly NG"
},
"mdns": {
"type": "object",
"properties": {
"enable": {
"title": "Enable",
"description": "Whether devices should be automatically discovered using mDNS.",
"type": "boolean",
"default": true
},
"interface": {
"title": "Network interface",
"description": "The network interface to use when sending and receiving mDNS packets. You probably don't need to use this setting unless you know what you're doing. If not specified, all available network interfaces will be used.",
"type": "string",
"placeholder": "e.g. eth0 or 192.168.1.100"
}
}
},
"websocket": {
"type": "object",
"properties": {
"requestTimeout": {
"title": "Request timeout",
"type": "integer",
"placeholder": "10",
"description": "The time, in seconds, to wait for a response before a request is aborted."
},
"pingInterval": {
"title": "Ping interval",
"type": "integer",
"placeholder": "60",
"description": "The interval, in seconds, at which ping requests should be made to verify that the connection is open. Set to 0 to disable."
},
"reconnectInterval": {
"title": "Reconnect intervals",
"type": "string",
"placeholder": "5,10,30,60,300,600",
"description": "The interval, in seconds, at which a connection attempt should be made after a socket has been closed. Multiple intervals can be specified as a comma-separated list of numbers. Set to 0 to disable."
}
}
},
"devices": {
"type": "array",
"items": {
"title": "Device",
"type": "object",
"properties": {
"id": {
"title": "Device ID",
"description": "See <a href='https://github.com/alexryd/homebridge-shelly-ng/wiki/Finding-a-device-ID' target='_blank'>this page</a> for instructions on how to find your device's ID.",
"type": "string",
"placeholder": "e.g. shellyplus1-abcdef123456",
"required": true
},
"name": {
"title": "Name",
"description": "This name will be shown in the homebridge log and will be used as the default name when the device is added to HomeKit. Note though that setting this value after the device has been added will not change the name in HomeKit.",
"type": "string"
},
"exclude": {
"title": "Exclude this device",
"type": "boolean",
"default": false
},
"hostname": {
"title": "IP address or hostname",
"description": "Set this value if your device can't be discovered automatically.",
"type": "string",
"placeholder": "e.g. 192.168.1.100"
},
"password": {
"title": "Password",
"type": "string",
"description": "The password to use if the Shelly device requires authentication."
},
"switch:0": {
"title": "Switch 1",
"type": "object",
"properties": {
"exclude": {
"title": "Exclude this switch",
"type": "boolean",
"default": false
},
"type": {
"title": "Type",
"description": "The type of accessory used to represent the switch.",
"type": "string",
"oneOf": [
{ "title": "Outlet", "enum": [ "outlet" ] },
{ "title": "Switch", "enum": [ "switch" ] }
],
"default": "switch"
}
}
},
"switch:1": {
"title": "Switch 2",
"type": "object",
"properties": {
"exclude": {
"title": "Exclude this switch",
"type": "boolean",
"default": false
},
"type": {
"title": "Type",
"description": "The type of accessory used to represent the switch.",
"type": "string",
"oneOf": [
{ "title": "Outlet", "enum": [ "outlet" ] },
{ "title": "Switch", "enum": [ "switch" ] }
],
"default": "switch"
}
}
},
"switch:2": {
"title": "Switch 3",
"type": "object",
"properties": {
"exclude": {
"title": "Exclude this switch",
"type": "boolean",
"default": false
},
"type": {
"title": "Type",
"description": "The type of accessory used to represent the switch.",
"type": "string",
"oneOf": [
{ "title": "Outlet", "enum": [ "outlet" ] },
{ "title": "Switch", "enum": [ "switch" ] }
],
"default": "switch"
}
}
},
"switch:3": {
"title": "Switch 4",
"type": "object",
"properties": {
"exclude": {
"title": "Exclude this switch",
"type": "boolean",
"default": false
},
"type": {
"title": "Type",
"description": "The type of accessory used to represent the switch.",
"type": "string",
"oneOf": [
{ "title": "Outlet", "enum": [ "outlet" ] },
{ "title": "Switch", "enum": [ "switch" ] }
],
"default": "switch"
}
}
},
"cover:0": {
"title": "Cover",
"type": "object",
"properties": {
"exclude": {
"title": "Exclude this cover",
"type": "boolean",
"default": false
},
"type": {
"title": "Type",
"description": "The type of accessory used to represent the cover. This setting apply only when the device is in cover mode.",
"type": "string",
"oneOf": [
{ "title": "Door", "enum": [ "door" ] },
{ "title": "Window", "enum": [ "window" ] },
{ "title": "Window Covering", "enum": [ "windowCovering" ] }
],
"default": "window"
}
}
}
}
}
}
}
},
"layout": [
"name",
{
"key": "devices",
"type": "array",
"title": "Devices",
"description": "Use these settings to configure individual devices. Note though that unless your devices can't be discovered using mDNS, you don't necessarily have to add them here manually.",
"items": [
"devices[].id",
"devices[].exclude",
{
"key": "devices[].name",
"condition": {
"functionBody": "return model.devices && !model.devices[arrayIndices[0]].exclude"
}
},
{
"key": "devices[].hostname",
"condition": {
"functionBody": "return model.devices && !model.devices[arrayIndices[0]].exclude"
}
},
{
"key": "devices[].password",
"condition": {
"functionBody": "return model.devices && !model.devices[arrayIndices[0]].exclude"
}
},
{
"key": "devices[].switch:0",
"condition": {
"functionBody": "return model.devices && !model.devices[arrayIndices[0]].exclude && model.devices[arrayIndices[0]].id && model.devices[arrayIndices[0]].id.match(/^\\s*(?:shellyplus1|shellyplus1pm|shellyplus2pm|shellyplusplug|shellyplusplugus|shellypro1|shellypro1pm|shellypro2|shellypro2pm|shellypro3|shellypro4pm)-/i) !== null"
},
"items": [
"devices[].switch:0.exclude",
"devices[].switch:0.type"
]
},
{
"key": "devices[].switch:1",
"condition": {
"functionBody": "return model.devices && !model.devices[arrayIndices[0]].exclude && model.devices[arrayIndices[0]].id && model.devices[arrayIndices[0]].id.match(/^\\s*(?:shellyplus2pm|shellypro2|shellypro2pm|shellypro3|shellypro4pm)-/i) !== null"
},
"items": [
"devices[].switch:1.exclude",
"devices[].switch:1.type"
]
},
{
"key": "devices[].switch:2",
"condition": {
"functionBody": "return model.devices && !model.devices[arrayIndices[0]].exclude && model.devices[arrayIndices[0]].id && model.devices[arrayIndices[0]].id.match(/^\\s*(?:shellypro3|shellypro4pm)-/i) !== null"
},
"items": [
"devices[].switch:2.exclude",
"devices[].switch:2.type"
]
},
{
"key": "devices[].switch:3",
"condition": {
"functionBody": "return model.devices && !model.devices[arrayIndices[0]].exclude && model.devices[arrayIndices[0]].id && model.devices[arrayIndices[0]].id.match(/^\\s*(?:shellypro4pm)-/i) !== null"
},
"items": [
"devices[].switch:3.exclude",
"devices[].switch:3.type"
]
},
{
"key": "devices[].cover:0",
"condition": {
"functionBody": "return model.devices && !model.devices[arrayIndices[0]].exclude && model.devices[arrayIndices[0]].id && model.devices[arrayIndices[0]].id.match(/\\s*(?:shellyplus2pm|shellypro2pm)-/i) !== null"
},
"items": [
"devices[].cover:0.exclude",
"devices[].cover:0.type"
]
}
]
},
{
"type": "fieldset",
"expandable": true,
"title": "mDNS device discovery",
"items": [
"mdns.enable",
{
"key": "mdns.interface",
"condition": "mdns.enable"
}
]
},
{
"type": "fieldset",
"expandable": true,
"title": "WebSocket connections",
"items": [
"websocket.requestTimeout",
"websocket.pingInterval",
"websocket.reconnectInterval"
]
}
]
}