-
Notifications
You must be signed in to change notification settings - Fork 0
/
konnected-alarm-panel.yaml
599 lines (572 loc) · 17.5 KB
/
konnected-alarm-panel.yaml
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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
openapi: 3.1.0
info:
title: Alarm Panel Device API
summary: Local REST based API for the Konnected Alarm Panel and Alarm Panel Pro
description: Konnected's Alarm Panel and Alarm Panel Pro share a common HTTP API for integrating with a local smart home platform, app or controller.
version: 1.0.0
termsOfService: https://konnected.io/terms
contact:
name: Konnected Support
url: https://help.konnected.io
email: [email protected]
servers:
- url: http://{localIP}:{port}
description: Device on local network
variables:
localIp:
default: 192.168.1.100
port:
default: '9123'
paths:
/ota:
post:
summary: Over the Air Update
description: Initiate an Over-the-Air (OTA) update of the device embedded software or firmware.
operationId: postOta
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ota'
responses:
'200':
description: OTA update initiated successfully
content:
application/json:
schema:
type: object
properties:
status:
type: string
uri:
type: string
/lock:
get:
summary: Lock Status
description: Status of the device settings lock.
operationId: getLock
responses:
'200':
description: Lock status
content:
application/json:
schema:
type: object
properties:
state:
type: string
description: Lock state (`locked` or `unlocked`)
put:
summary: Lock Device Settings
description: Locks or unlocks the device settings for security. Locking prevents any settings or configuration from being changed until the device is unlocked.
operationId: putLock
requestBody:
content:
application/json:
schema:
type: object
required:
- pwd
properties:
pwd:
type: string
description: A lock password.
responses:
'200':
description: Lock status
content:
application/json:
schema:
type: object
properties:
state:
type: string
description: Lock state (`locked` or `unlocked`)
msg:
type: string
description: A message
/settings:
post:
summary: Device Provisioning
description: >
A Konnected Alarm Panel or Alarm Panel Pro needs to be provisioned via this endpoint to specify the device inputs, outputs,
and the endpoint for the hub or controller. After this provisioning step, the Alarm Panel will communicate state changes to the
endpoint specified, and will respond to state change commands authenticated with the valid token.
operationId: postSettings
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/settings'
responses:
'200':
description: Settings set successfully
/status:
get:
summary: Device Status
description: Returns a snapshot of the device settings, IO states, and device information.
operationId: getStatus
responses:
'200':
description: status response
content:
text/html:
schema:
type: string
application/json:
schema:
$ref: '#/components/schemas/status'
/wifi:
put:
summary: Set WiFi Credentials
description: Set the SSID and password to connect to a WiFi network. This endpoint is only available on the Alarm Panel Pro.
operationId: putWifi
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/wifi'
responses:
'200':
description: WiFi Settings Set
content:
application/json:
schema:
$ref: '#/components/schemas/wifi'
/zone:
get:
summary: Zone Status
description: >
Returns the state of a zone. This endpoint works for binary sensor zones or outputs, but not digital sensors.
This endpoint should only be used for controller/hub initialization or manual user refresh actions. It is NOT recommended to
poll this endpoint to monitor sensor states. For that, you should implement an endpoint or to receive state updates pushed from
the device.
operationId: getZone
parameters:
- in: query
name: zone
schema:
type: string
description: Zone identifier to query state (if omitted, all binary sensor zones are returned).
responses:
'200':
description: Zone response
content:
application/json:
schema:
$ref: '#/components/schemas/zone'
put:
summary: Switch/Actuator Command
description: Update the state of one or more switch/actuator zones.
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/actuatorCommand'
responses:
'200':
description: Command received
content:
application/json:
schema:
$ref: '#/components/schemas/actuatorReading'
components:
schemas:
ota:
type: object
required:
- uri
properties:
uri:
type: string
description: The URI of the OTA update image.
type:
type: string
description: The software layer to update. `fw` for the device firmware or `app` for the software/application layer. This parameter only for the Alarm Panel Pro.
settings:
type: object
required:
- endpoint
- token
properties:
endpoint:
type: string
description: >
The http(s) endpoint of the smart home hub or controller that Konnected will post state updates to. Include `http` or `https`
and the full hostname or IP address and path.
examples:
local:
summary: A local home automation controller
value: http://192.168.1.105:8123/api/konnected
remote:
summary: A dynamic DNS host
value: https://mysmarthome.duckdns.org/api/konnected
token:
type: string
description: A shared secret token set by the controller. Subsequent reqeusts to actuate inputs will require this token in the `Authorization` header.
endpoint_type:
type: string
description: The endpoint type. Use `rest` for local REST-based controllers.
enum:
- rest
- aws_iot
default: rest
aws:
type: object
description: >
A set of AWS credentials and settings for connecting and communicating with AWS IoT. This is only required
if `endpoint_type` is `aws_iot`.
properties:
authorizier:
type: string
description: The name of the AWS IoT Authorizer (Alarm Panel / ESP8266 only)
token:
type: string
description: A token unique to the device that is authenticated, passed to the authorizer (Alarm Panel / ESP8266 only)
token_signature:
type: string
description: The token signature, signed by the private key of the authorizer (Alarm Panel / ESP8266 only)
certs:
type: object
description: An object containing certificates (Alarm Panel Pro / ESP32 only)
properties:
client_cert:
type: string
description: PEM encoded client certificate.
client_key:
type: string
description: PEM encoded client key.
topics:
type: object
properties:
sensor:
type: string
description: An AWS IoT topic string that Konnected will post state changes to.
switch:
type: string
description: An AWS IoT topic string that Konnected will subscribe to for actuator state change commands.
heartbeat:
type: string
description: An AWS Iot topic string that Konnected will post a heartbeat every 5 minutes.
sensors:
type: array
description: >
Binary sensor zones to monitor. Use for contact sensors, motion sensors, water leak sensors, and any
open/close or on/off sensor type. Valid zones on the Alarm Panel (ESP8266) are `1` thru `6`.
On the Alarm Panel Pro (ESP32) valid zones are `1` thru `12`.
items:
$ref: '#/components/schemas/sensor'
actuators:
type: array
description: >
Actuator zones to control. Use for sirens, switches, strobes, buzzers and any device which is turned
on and off by Konnected. Valid zones on the Alarm Panel (ESP8266) are `1` thru `5` and `out`.
On the Alarm Panel Pro (ESP32) valid zones are `1` thru `8` and `alarm1`, `out1`, and `alarm2_out2`.
items:
$ref: '#/components/schemas/actuator'
dht_sensors:
type: array
description: >
Digital temperature and humidity sensor zones. Use a DHT22 type sensor connected to zones `1` thru `5` on the Alarm
Panel or `1` thru `8` on the Alarm Panel Pro.
items:
$ref: '#/components/schemas/tempSensor'
ds18b20_sensors:
type: array
description: >
Digital temperature sensor zones. Use a DS18B20 type sensor connected to zones `1` thru `5` on the Alarm
Panel or `1` thru `8` on the Alarm Panel Pro.
items:
$ref: '#/components/schemas/tempSensor'
blink:
type: boolean
description: Should the blue status LED blink upon communication with the controller (`true` if not set).
discovery:
type: boolean
description: Should the Konnected device respond to SSDP discovery requests (`true` if not set).
time_server:
type: string
description: A custom time server implementing the NTP protocol.
example: time.google.com
status:
type: object
properties:
model:
type: string
description: The device model name
chipId:
type: string
description: A unique ID for the device
hwVersion:
type: string
description: The firmware version
swVersion:
type: string
description: The software application version
heap:
type: integer
description: The amount of remaining heap memory
uptime:
type: integer
description: The time elapsed since the device last booted/rebooted (seconds)
ip:
type: string
description: The device's IP address on the network
port:
type: string
description: The device's HTTP control port
nm:
type: string
description: Netmask
gw:
type: string
description: Gateway IP address
mac:
type: string
description: The device's mac address
rssi:
type: integer
description: RSSI of the WiFi connection (if active)
connection_type:
type: string
description: The device's connection type
enum:
- WiFi
- wired
sensors:
type: array
items:
$ref: '#/components/schemas/sensorReading'
actuators:
type: array
items:
$ref: '#/components/schemas/actuatorReading'
dht_sensors:
type: array
items:
$ref: '#/components/schemas/tempSensor'
ds18b20_sensors:
type: array
items:
$ref: '#/components/schemas/tempSensor'
settings:
type: object
properties:
endpoint:
type: string
description: The configured hub/controller endpoint
endpoint_type:
type: string
description: The configured endpoint type
enum:
- rest
- aws_iot
sensor:
type: object
required:
- zone
properties:
zone:
type: string
description: The zone identifier
enum:
- '1'
- '2'
- '3'
- '4'
- '5'
- '6'
- '7'
- '8'
- '9'
- '10'
- '11'
- '12'
wifi:
type: object
required:
- ssid
properties:
ssid:
type: string
description: The WiFi network name (SSID).
pwd:
type: string
description: The WiFi network password.
zone:
type: object
properties:
zone:
type: string
description: The zone identifier
enum:
- '1'
- '2'
- '3'
- '4'
- '5'
- '6'
- '7'
- '8'
- '9'
- '10'
- '11'
- '12'
- 'out'
- 'alarm1'
- 'out1'
- 'alarm2_out2'
state:
type: integer
description: The current state of the zone (`1` = open/on; `0` = closed/off)
enum:
- '0'
- '1'
actuatorCommand:
type: object
required:
- zone
- state
properties:
zone:
type: string
description: The zone identifier
enum:
- '1'
- '2'
- '3'
- '4'
- '5'
- '6'
- '7'
- '8'
- 'out'
- 'out1'
- 'alarm1'
- 'alarm2_out2'
state:
type: integer
description: Switch state
enum:
- '0'
- '1'
times:
type: integer
description: >
Number of times to pulse/blink the switch. Must be a positive integer greater than 0, or the special value `-1`
which indicates infinite repeat (until turned off).
minimum: -1
momentary:
type: integer
description: The duration of each pulse in milliseconds. For example, a value of `500` means half of a second.
pause:
type: integer
description: The duration of pauses between each pulse in millsecons. For example, a value of `1000` means one second.
sensorReading:
type: object
properties:
zone:
type: string
description: The zone identifier
enum:
- '1'
- '2'
- '3'
- '4'
- '5'
- '6'
- '7'
- '8'
- '9'
- '10'
- '11'
- '12'
state:
type: integer
description: Sensor state
enum:
- '0'
- '1'
actuator:
type: object
required:
- zone
properties:
zone:
type: string
description: The zone identifier
enum:
- '1'
- '2'
- '3'
- '4'
- '5'
- '6'
- '7'
- '8'
- 'out'
- 'out1'
- 'alarm1'
- 'alarm2_out2'
trigger:
type: integer
description: Trigger level (`1` means high and is the default)
enum:
- '0'
- '1'
actuatorReading:
type: object
required:
- zone
properties:
zone:
type: string
description: The zone identifier
enum:
- '1'
- '2'
- '3'
- '4'
- '5'
- '6'
- '7'
- '8'
- 'out'
- 'out1'
- 'alarm1'
- 'alarm2_out2'
state:
type: integer
description: The on/off state
enum:
- '0'
- '1'
trigger:
type: integer
description: Trigger level (`1` means high and is the default)
enum:
- '0'
- '1'
tempSensor:
type: object
required:
- zone
properties:
zone:
type: string
description: The zone identifier
enum:
- '1'
- '2'
- '3'
- '4'
- '5'
- '6'
- '7'
- '8'
poll_interval:
type: integer
description: Polling interval in minutes (default `3` minutes)
minimum: 1
maximum: 114
x-explorer-enabled: false