homebridge-http-advanced-platform 2.0.0-alpha.6
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/LICENSE +176 -0
- package/README.md +175 -0
- package/config.schema.json +449 -0
- package/dist/accessory.d.ts +27 -0
- package/dist/accessory.js +164 -0
- package/dist/accessory.js.map +1 -0
- package/dist/actions.d.ts +8 -0
- package/dist/actions.js +47 -0
- package/dist/actions.js.map +1 -0
- package/dist/compatibility.d.ts +3 -0
- package/dist/compatibility.js +26 -0
- package/dist/compatibility.js.map +1 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.js +81 -0
- package/dist/config.js.map +1 -0
- package/dist/coordinator.d.ts +51 -0
- package/dist/coordinator.js +145 -0
- package/dist/coordinator.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/mappers.d.ts +3 -0
- package/dist/mappers.js +116 -0
- package/dist/mappers.js.map +1 -0
- package/dist/metadata.d.ts +5 -0
- package/dist/metadata.js +8 -0
- package/dist/metadata.js.map +1 -0
- package/dist/platform.d.ts +18 -0
- package/dist/platform.js +129 -0
- package/dist/platform.js.map +1 -0
- package/dist/runtime.d.ts +54 -0
- package/dist/runtime.js +376 -0
- package/dist/runtime.js.map +1 -0
- package/dist/settings.d.ts +21 -0
- package/dist/settings.js +51 -0
- package/dist/settings.js.map +1 -0
- package/dist/transport.d.ts +25 -0
- package/dist/transport.js +139 -0
- package/dist/transport.js.map +1 -0
- package/dist/types.d.ts +106 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/dist/ui-config.d.ts +27 -0
- package/dist/ui-config.js +208 -0
- package/dist/ui-config.js.map +1 -0
- package/docs/alpha-release-notes.md +19 -0
- package/docs/legacy-reference.md +678 -0
- package/docs/migration.md +43 -0
- package/docs/modernization.md +211 -0
- package/docs/performance.md +37 -0
- package/docs/service-support.md +47 -0
- package/homebridge-ui/public/index.html +74 -0
- package/homebridge-ui/public/settings.js +132 -0
- package/homebridge-ui/server.js +17 -0
- package/package.json +83 -0
- package/sample-config.json +39 -0
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
{
|
|
2
|
+
"pluginAlias": "HttpAdvancedAccessory",
|
|
3
|
+
"pluginType": "accessory",
|
|
4
|
+
"singular": false,
|
|
5
|
+
"strictValidation": false,
|
|
6
|
+
"schema": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"required": [
|
|
9
|
+
"name",
|
|
10
|
+
"service"
|
|
11
|
+
],
|
|
12
|
+
"additionalProperties": true,
|
|
13
|
+
"properties": {
|
|
14
|
+
"id": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "Stable platform identity; set before pairing"
|
|
17
|
+
},
|
|
18
|
+
"name": {
|
|
19
|
+
"type": "string"
|
|
20
|
+
},
|
|
21
|
+
"service": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"default": "Switch"
|
|
24
|
+
},
|
|
25
|
+
"manufacturer": {
|
|
26
|
+
"type": "string"
|
|
27
|
+
},
|
|
28
|
+
"model": {
|
|
29
|
+
"type": "string"
|
|
30
|
+
},
|
|
31
|
+
"username": {
|
|
32
|
+
"type": "string"
|
|
33
|
+
},
|
|
34
|
+
"password": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"format": "password"
|
|
37
|
+
},
|
|
38
|
+
"immediately": {
|
|
39
|
+
"type": "boolean",
|
|
40
|
+
"default": true
|
|
41
|
+
},
|
|
42
|
+
"debug": {
|
|
43
|
+
"type": "boolean",
|
|
44
|
+
"default": false
|
|
45
|
+
},
|
|
46
|
+
"optionCharacteristic": {
|
|
47
|
+
"type": "array",
|
|
48
|
+
"items": {
|
|
49
|
+
"type": "string"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"props": {
|
|
53
|
+
"type": "object",
|
|
54
|
+
"additionalProperties": {
|
|
55
|
+
"type": "object",
|
|
56
|
+
"additionalProperties": true
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"forceRefreshDelay": {
|
|
60
|
+
"type": "number",
|
|
61
|
+
"minimum": 0,
|
|
62
|
+
"description": "Legacy polling interval in seconds; 0 selects adaptive refresh"
|
|
63
|
+
},
|
|
64
|
+
"setterDelay": {
|
|
65
|
+
"type": "number",
|
|
66
|
+
"minimum": 0,
|
|
67
|
+
"description": "Legacy debounce in milliseconds"
|
|
68
|
+
},
|
|
69
|
+
"uriCallsDelay": {
|
|
70
|
+
"type": "number",
|
|
71
|
+
"minimum": 0,
|
|
72
|
+
"description": "Minimum milliseconds between request starts for this device"
|
|
73
|
+
},
|
|
74
|
+
"refresh": {
|
|
75
|
+
"type": "object",
|
|
76
|
+
"properties": {
|
|
77
|
+
"activeInterval": {
|
|
78
|
+
"type": "number",
|
|
79
|
+
"exclusiveMinimum": 0,
|
|
80
|
+
"default": 5
|
|
81
|
+
},
|
|
82
|
+
"idleInterval": {
|
|
83
|
+
"type": "number",
|
|
84
|
+
"exclusiveMinimum": 0,
|
|
85
|
+
"default": 60
|
|
86
|
+
},
|
|
87
|
+
"idleAfter": {
|
|
88
|
+
"type": "number",
|
|
89
|
+
"exclusiveMinimum": 0,
|
|
90
|
+
"default": 60
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"description": "All intervals are in seconds"
|
|
94
|
+
},
|
|
95
|
+
"urls": {
|
|
96
|
+
"type": "object",
|
|
97
|
+
"additionalProperties": {
|
|
98
|
+
"$ref": "#/definitions/action"
|
|
99
|
+
},
|
|
100
|
+
"description": "Complete action definitions, including encoded URLs, templates, recursive fallbacks and arbitrary mapper parameters"
|
|
101
|
+
},
|
|
102
|
+
"accessory": {
|
|
103
|
+
"type": "string",
|
|
104
|
+
"default": "HttpAdvancedAccessory"
|
|
105
|
+
},
|
|
106
|
+
"writeConfirmationTimeout": {
|
|
107
|
+
"type": "number",
|
|
108
|
+
"minimum": 0,
|
|
109
|
+
"description": "Milliseconds to hold a requested value while confirming it after HTTP success; default 10000, 0 disables the confirmation window"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"definitions": {
|
|
113
|
+
"action": {
|
|
114
|
+
"type": "object",
|
|
115
|
+
"required": [
|
|
116
|
+
"url"
|
|
117
|
+
],
|
|
118
|
+
"additionalProperties": true,
|
|
119
|
+
"properties": {
|
|
120
|
+
"url": {
|
|
121
|
+
"type": "string",
|
|
122
|
+
"description": "HTTP(S) URL; setter supports legacy templates and {value}"
|
|
123
|
+
},
|
|
124
|
+
"httpMethod": {
|
|
125
|
+
"type": "string",
|
|
126
|
+
"default": "GET"
|
|
127
|
+
},
|
|
128
|
+
"body": {
|
|
129
|
+
"type": "string"
|
|
130
|
+
},
|
|
131
|
+
"responsePattern": {
|
|
132
|
+
"type": "string",
|
|
133
|
+
"description": "Optional regular expression that the raw response body must match before accepting a read or write; mismatch retains cached state or an explicit resultOnError fallback and fails writes without replay"
|
|
134
|
+
},
|
|
135
|
+
"requireResponseMatch": {
|
|
136
|
+
"type": "boolean",
|
|
137
|
+
"default": false,
|
|
138
|
+
"description": "Reject unmatched getter extractions unless a later mapper explicitly handles them; leave off to preserve legacy missing-match pass-through"
|
|
139
|
+
},
|
|
140
|
+
"headers": {
|
|
141
|
+
"type": "object",
|
|
142
|
+
"additionalProperties": {
|
|
143
|
+
"type": "string"
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"mappers": {
|
|
147
|
+
"type": "array",
|
|
148
|
+
"items": {
|
|
149
|
+
"type": "object",
|
|
150
|
+
"required": [
|
|
151
|
+
"type",
|
|
152
|
+
"parameters"
|
|
153
|
+
],
|
|
154
|
+
"additionalProperties": true,
|
|
155
|
+
"properties": {
|
|
156
|
+
"type": {
|
|
157
|
+
"type": "string",
|
|
158
|
+
"enum": [
|
|
159
|
+
"static",
|
|
160
|
+
"regex",
|
|
161
|
+
"xpath",
|
|
162
|
+
"jpath",
|
|
163
|
+
"eval"
|
|
164
|
+
]
|
|
165
|
+
},
|
|
166
|
+
"parameters": {
|
|
167
|
+
"type": "object",
|
|
168
|
+
"additionalProperties": true,
|
|
169
|
+
"description": "Mapper-specific mapping, regexp/capture, xpath/index, jpath/index, or expression. See README."
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
"resultOnError": {
|
|
175
|
+
"type": [
|
|
176
|
+
"string",
|
|
177
|
+
"number",
|
|
178
|
+
"boolean"
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
"timeout": {
|
|
182
|
+
"type": "number",
|
|
183
|
+
"exclusiveMinimum": 0,
|
|
184
|
+
"default": 10000,
|
|
185
|
+
"description": "Request timeout in milliseconds including response body and redirects; initial queue wait is excluded for background reads and included for control writes"
|
|
186
|
+
},
|
|
187
|
+
"strictHTTP": {
|
|
188
|
+
"type": "boolean",
|
|
189
|
+
"default": false
|
|
190
|
+
},
|
|
191
|
+
"inconclusive": {
|
|
192
|
+
"$ref": "#/definitions/action"
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
"platform": {
|
|
197
|
+
"type": "object",
|
|
198
|
+
"required": [
|
|
199
|
+
"name",
|
|
200
|
+
"devices"
|
|
201
|
+
],
|
|
202
|
+
"additionalProperties": true,
|
|
203
|
+
"properties": {
|
|
204
|
+
"name": {
|
|
205
|
+
"type": "string",
|
|
206
|
+
"default": "HTTP Advanced"
|
|
207
|
+
},
|
|
208
|
+
"platform": {
|
|
209
|
+
"type": "string",
|
|
210
|
+
"default": "HttpAdvanced"
|
|
211
|
+
},
|
|
212
|
+
"coordinator": {
|
|
213
|
+
"type": "object",
|
|
214
|
+
"properties": {
|
|
215
|
+
"concurrency": {
|
|
216
|
+
"type": "integer",
|
|
217
|
+
"minimum": 1,
|
|
218
|
+
"default": 4
|
|
219
|
+
},
|
|
220
|
+
"perOrigin": {
|
|
221
|
+
"type": "integer",
|
|
222
|
+
"minimum": 1,
|
|
223
|
+
"default": 2
|
|
224
|
+
},
|
|
225
|
+
"maxQueue": {
|
|
226
|
+
"type": "integer",
|
|
227
|
+
"minimum": 1,
|
|
228
|
+
"default": 256
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
"devices": {
|
|
233
|
+
"type": "array",
|
|
234
|
+
"items": {
|
|
235
|
+
"type": "object",
|
|
236
|
+
"required": [
|
|
237
|
+
"name",
|
|
238
|
+
"service"
|
|
239
|
+
],
|
|
240
|
+
"additionalProperties": true,
|
|
241
|
+
"properties": {
|
|
242
|
+
"id": {
|
|
243
|
+
"type": "string",
|
|
244
|
+
"description": "Stable platform identity; set before pairing"
|
|
245
|
+
},
|
|
246
|
+
"name": {
|
|
247
|
+
"type": "string"
|
|
248
|
+
},
|
|
249
|
+
"service": {
|
|
250
|
+
"type": "string",
|
|
251
|
+
"default": "Switch"
|
|
252
|
+
},
|
|
253
|
+
"manufacturer": {
|
|
254
|
+
"type": "string"
|
|
255
|
+
},
|
|
256
|
+
"model": {
|
|
257
|
+
"type": "string"
|
|
258
|
+
},
|
|
259
|
+
"username": {
|
|
260
|
+
"type": "string"
|
|
261
|
+
},
|
|
262
|
+
"password": {
|
|
263
|
+
"type": "string",
|
|
264
|
+
"format": "password"
|
|
265
|
+
},
|
|
266
|
+
"immediately": {
|
|
267
|
+
"type": "boolean",
|
|
268
|
+
"default": true
|
|
269
|
+
},
|
|
270
|
+
"debug": {
|
|
271
|
+
"type": "boolean",
|
|
272
|
+
"default": false
|
|
273
|
+
},
|
|
274
|
+
"optionCharacteristic": {
|
|
275
|
+
"type": "array",
|
|
276
|
+
"items": {
|
|
277
|
+
"type": "string"
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
"props": {
|
|
281
|
+
"type": "object",
|
|
282
|
+
"additionalProperties": {
|
|
283
|
+
"type": "object",
|
|
284
|
+
"additionalProperties": true
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
"forceRefreshDelay": {
|
|
288
|
+
"type": "number",
|
|
289
|
+
"minimum": 0,
|
|
290
|
+
"description": "Legacy polling interval in seconds; 0 selects adaptive refresh"
|
|
291
|
+
},
|
|
292
|
+
"setterDelay": {
|
|
293
|
+
"type": "number",
|
|
294
|
+
"minimum": 0,
|
|
295
|
+
"description": "Legacy debounce in milliseconds"
|
|
296
|
+
},
|
|
297
|
+
"uriCallsDelay": {
|
|
298
|
+
"type": "number",
|
|
299
|
+
"minimum": 0,
|
|
300
|
+
"description": "Minimum milliseconds between request starts for this device"
|
|
301
|
+
},
|
|
302
|
+
"refresh": {
|
|
303
|
+
"type": "object",
|
|
304
|
+
"properties": {
|
|
305
|
+
"activeInterval": {
|
|
306
|
+
"type": "number",
|
|
307
|
+
"exclusiveMinimum": 0,
|
|
308
|
+
"default": 5
|
|
309
|
+
},
|
|
310
|
+
"idleInterval": {
|
|
311
|
+
"type": "number",
|
|
312
|
+
"exclusiveMinimum": 0,
|
|
313
|
+
"default": 60
|
|
314
|
+
},
|
|
315
|
+
"idleAfter": {
|
|
316
|
+
"type": "number",
|
|
317
|
+
"exclusiveMinimum": 0,
|
|
318
|
+
"default": 60
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
"description": "All intervals are in seconds"
|
|
322
|
+
},
|
|
323
|
+
"urls": {
|
|
324
|
+
"type": "object",
|
|
325
|
+
"additionalProperties": {
|
|
326
|
+
"$ref": "#/definitions/action"
|
|
327
|
+
},
|
|
328
|
+
"description": "Complete action definitions, including encoded URLs, templates, recursive fallbacks and arbitrary mapper parameters"
|
|
329
|
+
},
|
|
330
|
+
"accessory": {
|
|
331
|
+
"type": "string",
|
|
332
|
+
"default": "HttpAdvancedAccessory"
|
|
333
|
+
},
|
|
334
|
+
"writeConfirmationTimeout": {
|
|
335
|
+
"type": "number",
|
|
336
|
+
"minimum": 0,
|
|
337
|
+
"description": "Milliseconds to hold a requested value while confirming it after HTTP success; default 10000, 0 disables the confirmation window"
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
"enabled": {
|
|
343
|
+
"type": "boolean",
|
|
344
|
+
"default": true,
|
|
345
|
+
"description": "Enable this platform; after restart, disabling retains device definitions and cached identities but reports devices unavailable"
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
"globalSettings": {
|
|
350
|
+
"type": "object",
|
|
351
|
+
"additionalProperties": true,
|
|
352
|
+
"properties": {
|
|
353
|
+
"requestTimeout": {
|
|
354
|
+
"type": "number",
|
|
355
|
+
"exclusiveMinimum": 0,
|
|
356
|
+
"default": 10000,
|
|
357
|
+
"title": "Request timeout (milliseconds)"
|
|
358
|
+
},
|
|
359
|
+
"uriCallsDelay": {
|
|
360
|
+
"type": "number",
|
|
361
|
+
"minimum": 0,
|
|
362
|
+
"default": 0,
|
|
363
|
+
"title": "Request spacing per device (milliseconds)"
|
|
364
|
+
},
|
|
365
|
+
"setterDelay": {
|
|
366
|
+
"type": "number",
|
|
367
|
+
"minimum": 0,
|
|
368
|
+
"default": 0,
|
|
369
|
+
"title": "Setter debounce (milliseconds)"
|
|
370
|
+
},
|
|
371
|
+
"refresh": {
|
|
372
|
+
"type": "object",
|
|
373
|
+
"properties": {
|
|
374
|
+
"activeInterval": {
|
|
375
|
+
"type": "number",
|
|
376
|
+
"exclusiveMinimum": 0,
|
|
377
|
+
"default": 5
|
|
378
|
+
},
|
|
379
|
+
"idleInterval": {
|
|
380
|
+
"type": "number",
|
|
381
|
+
"exclusiveMinimum": 0,
|
|
382
|
+
"default": 60
|
|
383
|
+
},
|
|
384
|
+
"idleAfter": {
|
|
385
|
+
"type": "number",
|
|
386
|
+
"exclusiveMinimum": 0,
|
|
387
|
+
"default": 60
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
"description": "All intervals are in seconds"
|
|
391
|
+
},
|
|
392
|
+
"coordinator": {
|
|
393
|
+
"type": "object",
|
|
394
|
+
"properties": {
|
|
395
|
+
"concurrency": {
|
|
396
|
+
"type": "integer",
|
|
397
|
+
"minimum": 1,
|
|
398
|
+
"default": 4
|
|
399
|
+
},
|
|
400
|
+
"perOrigin": {
|
|
401
|
+
"type": "integer",
|
|
402
|
+
"minimum": 1,
|
|
403
|
+
"default": 2
|
|
404
|
+
},
|
|
405
|
+
"maxQueue": {
|
|
406
|
+
"type": "integer",
|
|
407
|
+
"minimum": 1,
|
|
408
|
+
"default": 256
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
},
|
|
412
|
+
"recovery": {
|
|
413
|
+
"type": "object",
|
|
414
|
+
"properties": {
|
|
415
|
+
"retryInterval": {
|
|
416
|
+
"type": "number",
|
|
417
|
+
"minimum": 0,
|
|
418
|
+
"default": 5
|
|
419
|
+
},
|
|
420
|
+
"maxRetryInterval": {
|
|
421
|
+
"type": "number",
|
|
422
|
+
"minimum": 0,
|
|
423
|
+
"default": 30
|
|
424
|
+
},
|
|
425
|
+
"quietPeriod": {
|
|
426
|
+
"type": "number",
|
|
427
|
+
"minimum": 0,
|
|
428
|
+
"default": 90
|
|
429
|
+
},
|
|
430
|
+
"reminderInterval": {
|
|
431
|
+
"type": "number",
|
|
432
|
+
"minimum": 0,
|
|
433
|
+
"default": 300
|
|
434
|
+
}
|
|
435
|
+
},
|
|
436
|
+
"description": "All recovery intervals are in seconds"
|
|
437
|
+
},
|
|
438
|
+
"writeConfirmationTimeout": {
|
|
439
|
+
"type": "number",
|
|
440
|
+
"minimum": 0,
|
|
441
|
+
"description": "Milliseconds to hold a requested value while confirming it after HTTP success; default 10000, 0 disables the confirmation window"
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
"customUi": true,
|
|
448
|
+
"headerDisplay": "Homebridge HTTP Advanced Platform supports existing accessories and optional platform devices. Use Plugin Config for platforms and shared settings."
|
|
449
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { API, AccessoryConfig, Characteristic, CharacteristicValue, Logging, Service } from 'homebridge';
|
|
2
|
+
import { type CacheEntry, type DeviceConfig, type State } from './types.js';
|
|
3
|
+
import { Runtime } from './runtime.js';
|
|
4
|
+
type ServiceConstructor = {
|
|
5
|
+
new (name?: string): Service;
|
|
6
|
+
UUID: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function serviceConstructor(api: API, name: string): ServiceConstructor;
|
|
9
|
+
export declare function convertValue(characteristic: Characteristic, value: unknown): CharacteristicValue;
|
|
10
|
+
export declare class DeviceAdapter {
|
|
11
|
+
readonly api: API;
|
|
12
|
+
readonly runtime: Runtime;
|
|
13
|
+
readonly config: DeviceConfig;
|
|
14
|
+
readonly identity: string;
|
|
15
|
+
readonly state: State;
|
|
16
|
+
readonly entries: Map<string, CacheEntry>;
|
|
17
|
+
readonly service: Service;
|
|
18
|
+
constructor(api: API, runtime: Runtime, config: DeviceConfig, identity: string, existing?: Service);
|
|
19
|
+
}
|
|
20
|
+
export declare class LegacyAccessory {
|
|
21
|
+
readonly name: string;
|
|
22
|
+
private readonly services;
|
|
23
|
+
constructor(log: Logging, rawConfig: AccessoryConfig, api: API);
|
|
24
|
+
getServices(): Service[];
|
|
25
|
+
identify(callback?: (error?: Error | null) => void): void;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { validateDevice } from './config.js';
|
|
2
|
+
import { ActionError } from './types.js';
|
|
3
|
+
import { fingerprint, sharedRuntime } from './runtime.js';
|
|
4
|
+
export function serviceConstructor(api, name) {
|
|
5
|
+
const alias = name === 'BatteryService' ? 'Battery' : name;
|
|
6
|
+
const constructor = api.hap.Service[alias];
|
|
7
|
+
if (typeof constructor !== 'function' || !constructor.UUID)
|
|
8
|
+
throw new Error(`HTTP Advanced unsupported HomeKit service: ${name}`);
|
|
9
|
+
return constructor;
|
|
10
|
+
}
|
|
11
|
+
export function convertValue(characteristic, value) {
|
|
12
|
+
const format = characteristic.props.format;
|
|
13
|
+
let converted;
|
|
14
|
+
if (format === 'bool') {
|
|
15
|
+
if (value === 'inconclusive' || !['boolean', 'number', 'string'].includes(typeof value))
|
|
16
|
+
throw new ActionError('mapper');
|
|
17
|
+
converted = value === true || value === 1 || value === '1' || value === 'true';
|
|
18
|
+
}
|
|
19
|
+
else if (['int', 'uint8', 'uint16', 'uint32', 'uint64', 'float'].includes(format)) {
|
|
20
|
+
if (value === null || value === undefined || typeof value === 'object')
|
|
21
|
+
throw new ActionError('mapper');
|
|
22
|
+
converted = typeof value === 'boolean' ? Number(value) : typeof value === 'number' ? value : format === 'float' ? parseFloat(String(value)) : parseInt(String(value), 10);
|
|
23
|
+
if (!Number.isFinite(converted))
|
|
24
|
+
throw new ActionError('mapper');
|
|
25
|
+
}
|
|
26
|
+
else if (format === 'string' && (typeof value === 'string' || typeof value === 'number')) {
|
|
27
|
+
converted = String(value);
|
|
28
|
+
}
|
|
29
|
+
else if (['data', 'tlv8'].includes(format) && typeof value === 'string') {
|
|
30
|
+
converted = value;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
throw new ActionError('mapper');
|
|
34
|
+
}
|
|
35
|
+
// let the supplied HAP implementation normalize bounds, minStep and valid values
|
|
36
|
+
// on an unbound characteristic, so normalization cannot emit premature device events
|
|
37
|
+
const Constructor = characteristic.constructor;
|
|
38
|
+
const normalizer = new Constructor();
|
|
39
|
+
normalizer.setProps(characteristic.props);
|
|
40
|
+
if (characteristic.value !== null)
|
|
41
|
+
normalizer.updateValue(characteristic.value);
|
|
42
|
+
normalizer.updateValue(converted);
|
|
43
|
+
if (normalizer.value === null)
|
|
44
|
+
throw new ActionError('mapper');
|
|
45
|
+
return normalizer.value;
|
|
46
|
+
}
|
|
47
|
+
export class DeviceAdapter {
|
|
48
|
+
api;
|
|
49
|
+
runtime;
|
|
50
|
+
config;
|
|
51
|
+
identity;
|
|
52
|
+
state = {};
|
|
53
|
+
entries = new Map();
|
|
54
|
+
service;
|
|
55
|
+
constructor(api, runtime, config, identity, existing) {
|
|
56
|
+
this.api = api;
|
|
57
|
+
this.runtime = runtime;
|
|
58
|
+
this.config = config;
|
|
59
|
+
this.identity = identity;
|
|
60
|
+
validateDevice(config);
|
|
61
|
+
const Constructor = serviceConstructor(api, config.service);
|
|
62
|
+
this.service = existing ?? new Constructor(config.name);
|
|
63
|
+
this.service.displayName = config.name;
|
|
64
|
+
const registry = api.hap.Characteristic;
|
|
65
|
+
const names = new Map();
|
|
66
|
+
for (const [name, value] of Object.entries(registry))
|
|
67
|
+
if (typeof value === 'function' && value.UUID)
|
|
68
|
+
names.set(value.UUID, name);
|
|
69
|
+
if (existing) {
|
|
70
|
+
const required = new Constructor(config.name).characteristics.map(c => c.UUID);
|
|
71
|
+
for (const characteristic of existing.characteristics.slice()) {
|
|
72
|
+
const compact = characteristic.displayName.replace(/\s/g, '');
|
|
73
|
+
const canonical = names.get(characteristic.UUID) ?? compact;
|
|
74
|
+
if (!required.includes(characteristic.UUID) && !config.optionCharacteristic?.includes(compact) && !config.optionCharacteristic?.includes(canonical)) {
|
|
75
|
+
existing.removeCharacteristic(characteristic);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// preserve the optional service ordering used by the legacy adapter, not config order
|
|
80
|
+
for (const characteristic of this.service.optionalCharacteristics.slice()) {
|
|
81
|
+
const compact = characteristic.displayName.replace(/\s/g, '');
|
|
82
|
+
const canonical = names.get(characteristic.UUID) ?? compact;
|
|
83
|
+
if (config.optionCharacteristic?.includes(compact) || config.optionCharacteristic?.includes(canonical)) {
|
|
84
|
+
if (!this.service.characteristics.some(c => c.UUID === characteristic.UUID))
|
|
85
|
+
this.service.addCharacteristic(characteristic);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
for (const characteristic of this.service.characteristics) {
|
|
89
|
+
const compact = characteristic.displayName.replace(/\s/g, '');
|
|
90
|
+
const canonical = names.get(characteristic.UUID) ?? compact;
|
|
91
|
+
const props = config.props?.[compact] ?? config.props?.[canonical];
|
|
92
|
+
if (props)
|
|
93
|
+
characteristic.setProps(props);
|
|
94
|
+
const resolve = (prefix) => config.urls?.[prefix + compact] ? prefix + compact : prefix + canonical;
|
|
95
|
+
const getName = resolve('get');
|
|
96
|
+
const setName = resolve('set');
|
|
97
|
+
if (characteristic.UUID === api.hap.Characteristic.Name.UUID) {
|
|
98
|
+
characteristic.updateValue(config.name).onGet(() => config.name);
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
let entry;
|
|
102
|
+
if (config.urls?.[getName]) {
|
|
103
|
+
entry = runtime.register(identity, getName, config, this.state, value => convertValue(characteristic, value), value => characteristic.updateValue(value));
|
|
104
|
+
this.entries.set(getName, entry);
|
|
105
|
+
const cached = entry;
|
|
106
|
+
characteristic.onGet(() => {
|
|
107
|
+
try {
|
|
108
|
+
return runtime.read(cached);
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
throw new api.hap.HapStatusError(-70402 /* api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
if (config.urls?.[setName]) {
|
|
116
|
+
characteristic.onSet(async (value) => {
|
|
117
|
+
const intent = entry ? runtime.beginWrite(entry, value) : undefined;
|
|
118
|
+
const work = async () => {
|
|
119
|
+
try {
|
|
120
|
+
await runtime.set(config, this.state, setName, value, entry, intent);
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
throw new api.hap.HapStatusError(-70402 /* api.hap.HAPStatus.SERVICE_COMMUNICATION_FAILURE */);
|
|
124
|
+
}
|
|
125
|
+
finally {
|
|
126
|
+
// HAP stores each completed write's value; a later intent must win
|
|
127
|
+
if (entry)
|
|
128
|
+
setImmediate(() => runtime.publish(entry));
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
const setterDelay = config.setterDelay ?? runtime.settings.setterDelay;
|
|
132
|
+
if (setterDelay)
|
|
133
|
+
runtime.debounce(fingerprint([identity, setName]), setterDelay, work);
|
|
134
|
+
else
|
|
135
|
+
await work();
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
export class LegacyAccessory {
|
|
142
|
+
name;
|
|
143
|
+
services;
|
|
144
|
+
constructor(log, rawConfig, api) {
|
|
145
|
+
const config = rawConfig;
|
|
146
|
+
this.name = config.name;
|
|
147
|
+
const information = new api.hap.Service.AccessoryInformation()
|
|
148
|
+
.setCharacteristic(api.hap.Characteristic.Manufacturer, 'Custom Manufacturer')
|
|
149
|
+
.setCharacteristic(api.hap.Characteristic.Model, 'HTTP Accessory Model')
|
|
150
|
+
.setCharacteristic(api.hap.Characteristic.SerialNumber, 'HTTP Accessory Serial Number');
|
|
151
|
+
this.services = [information];
|
|
152
|
+
try {
|
|
153
|
+
const adapter = new DeviceAdapter(api, sharedRuntime(api, log), config, `legacy:${config.name}`);
|
|
154
|
+
this.services.push(adapter.service);
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
const unsupported = error instanceof Error && error.message.startsWith('HTTP Advanced unsupported HomeKit service:');
|
|
158
|
+
log.error(unsupported ? error.message : 'HTTP Advanced accessory configuration failed; check action and characteristic definitions');
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
getServices() { return this.services; }
|
|
162
|
+
identify(callback) { callback?.(null); }
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=accessory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accessory.js","sourceRoot":"","sources":["../src/accessory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAkD,MAAM,YAAY,CAAC;AACzF,OAAO,EAAE,WAAW,EAAW,aAAa,EAAE,MAAM,cAAc,CAAC;AAKnE,MAAM,UAAU,kBAAkB,CAAC,GAAQ,EAAE,IAAY;IACvD,MAAM,KAAK,GAAG,IAAI,KAAK,gBAAgB,CAAC,CAAC,CAAC,SAAS,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,CAAC;IAClD,QAAQ,CAAC,QAAyC,IAAU,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CAChF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ActionConfig, type DeviceConfig, type ErrorCategory, type State } from './types.js';
|
|
2
|
+
import { Transport } from './transport.js';
|
|
3
|
+
export declare class Actions {
|
|
4
|
+
readonly transport: Transport;
|
|
5
|
+
constructor(transport: Transport);
|
|
6
|
+
get(action: ActionConfig, config: DeviceConfig, owner: string, state: State, seen?: Set<ActionConfig>, onFailure?: (category: ErrorCategory, retryAfter?: number) => void): Promise<unknown>;
|
|
7
|
+
set(action: ActionConfig, config: DeviceConfig, owner: string, state: State, value: unknown): Promise<void>;
|
|
8
|
+
}
|