@kohost/api-client 1.0.0-alpha.1 → 1.0.0-alpha.3

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.
Files changed (111) hide show
  1. package/.eslintrc.js +10 -0
  2. package/bitbucket-pipelines.yml +39 -0
  3. package/commands/Command.js +38 -0
  4. package/commands/SetAlarmCommand.js +21 -0
  5. package/commands/SetCourtesyCommand.js +21 -0
  6. package/commands/SetDimmerCommand.js +21 -0
  7. package/commands/SetLockCommand.js +21 -0
  8. package/commands/SetSceneControllerCommand.js +21 -0
  9. package/commands/SetSwitchCommand.js +21 -0
  10. package/commands/SetThermostatCommand.js +21 -0
  11. package/commands/SetWindowCoveringCommand.js +21 -0
  12. package/commands/VerifyDocumentCommand.js +24 -0
  13. package/commands/index.js +21 -0
  14. package/defs/deviceTypes.js +15 -0
  15. package/defs/formalDeviceTypes.js +6 -0
  16. package/defs/http.js +7 -0
  17. package/defs/index.js +11 -0
  18. package/errors/AppError.js +8 -0
  19. package/errors/AuthenticationError.js +9 -0
  20. package/errors/AuthorizationError.js +9 -0
  21. package/errors/DeviceCommError.js +9 -0
  22. package/errors/LoginError.js +9 -0
  23. package/errors/NotFoundError.js +9 -0
  24. package/errors/RequestError.js +9 -0
  25. package/errors/SystemCommError.js +9 -0
  26. package/errors/TokenExpiredError.js +9 -0
  27. package/errors/UnprocessableRequestError.js +9 -0
  28. package/errors/ValidationError.js +9 -0
  29. package/errors/index.js +15 -0
  30. package/events/Event.js +33 -0
  31. package/events/SystemCameraUpdatedEvent.js +17 -0
  32. package/events/SystemCourtesyUpdatedEvent.js +17 -0
  33. package/events/SystemDimmerUpdatedEvent.js +17 -0
  34. package/events/SystemLockUpdatedEvent.js +17 -0
  35. package/events/SystemReservationUpdatedEvent.js +17 -0
  36. package/events/SystemSceneControllerUpdatedEvent.js +17 -0
  37. package/events/SystemSourceUpdatedEvent.js +17 -0
  38. package/events/SystemSpaceUpdatedEvent.js +17 -0
  39. package/events/SystemSwitchUpdatedEvent.js +17 -0
  40. package/events/SystemThermostatUpdatedEvent.js +17 -0
  41. package/events/SystemUserUpdatedEvent.js +17 -0
  42. package/events/SystemWindowCoveringUpdatedEvent.js +17 -0
  43. package/events/index.js +28 -0
  44. package/http/handleResponseError.js +53 -0
  45. package/http/handleResponseSuccess.js +15 -0
  46. package/http/index.js +159 -0
  47. package/index.js +21 -71
  48. package/models/acl.js +29 -0
  49. package/models/admin/customer.js +28 -0
  50. package/models/admin/property.js +28 -0
  51. package/models/alarm.js +29 -0
  52. package/models/application.js +28 -0
  53. package/models/camera.js +29 -0
  54. package/models/courtesy.js +33 -0
  55. package/models/dimmer.js +49 -0
  56. package/models/discoveredDevice.js +30 -0
  57. package/models/gateway.js +37 -0
  58. package/models/index.js +56 -0
  59. package/models/integration.js +76 -0
  60. package/models/iotGateway.js +29 -0
  61. package/models/kohost.js +95 -0
  62. package/models/lock.js +33 -0
  63. package/models/mediaSource.js +29 -0
  64. package/models/motionSensor.js +29 -0
  65. package/models/reservation.js +36 -0
  66. package/models/room.js +185 -0
  67. package/models/scene.js +28 -0
  68. package/models/sceneController.js +29 -0
  69. package/models/space.js +99 -0
  70. package/models/switch.js +33 -0
  71. package/models/thermostat.js +80 -0
  72. package/models/ticket.js +91 -0
  73. package/models/user.js +58 -0
  74. package/models/windowCovering.js +49 -0
  75. package/package.json +27 -5
  76. package/prepare.js +4 -0
  77. package/schemas/acl.json +111 -0
  78. package/schemas/admin/customer.json +32 -0
  79. package/schemas/admin/property.json +54 -0
  80. package/schemas/alarm.json +5 -5
  81. package/schemas/application.json +24 -0
  82. package/schemas/camera.json +41 -0
  83. package/schemas/courtesy.json +5 -6
  84. package/schemas/definitions/common.json +21 -0
  85. package/schemas/{device.json → definitions/device.json} +22 -4
  86. package/schemas/dimmer.json +8 -5
  87. package/schemas/discoveredDevice.json +43 -0
  88. package/schemas/gateway.json +45 -13
  89. package/schemas/identification.json +35 -0
  90. package/schemas/integration.json +94 -0
  91. package/schemas/iotGateway.json +29 -0
  92. package/schemas/lock.json +8 -5
  93. package/schemas/mediaSource.json +151 -0
  94. package/schemas/motionSensor.json +26 -0
  95. package/schemas/payment.json +38 -0
  96. package/schemas/reservation.json +66 -0
  97. package/schemas/room.json +138 -0
  98. package/schemas/scene.json +118 -0
  99. package/schemas/sceneController.json +18 -6
  100. package/schemas/space.json +111 -0
  101. package/schemas/switch.json +8 -5
  102. package/schemas/thermostat.json +19 -10
  103. package/schemas/ticket.json +82 -0
  104. package/schemas/user.json +124 -0
  105. package/schemas/windowCovering.json +8 -5
  106. package/tests/unit/models/space.test.js +31 -0
  107. package/tests/unit/models/thermostat.test.js +146 -0
  108. package/useCases/http.json +902 -0
  109. package/utils/getDeviceTypes.js +7 -0
  110. package/utils/getFormalDeviceType.js +5 -0
  111. package/utils/schema.js +28 -0
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "https://api.kohost.app/schemas/v3/motionSensor.json",
4
+ "title": "Motion Sensor",
5
+ "description": "Any smart motion sensor",
6
+ "type": "object",
7
+ "properties": {
8
+ "id": {
9
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
10
+ },
11
+ "type": {
12
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
13
+ },
14
+ "systemData": {
15
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
16
+ },
17
+ "supportedNotifications": {
18
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
19
+ },
20
+ "notification": {
21
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
22
+ }
23
+ },
24
+ "additionalProperties": false,
25
+ "required": ["id", "type", "systemData"]
26
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "https://api.kohost.app/schemas/v3/payment.json",
4
+ "title": "Payment",
5
+ "type": "object",
6
+ "required": ["type", "maskedNumber", "expires"],
7
+ "properties": {
8
+ "id": {
9
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
10
+ },
11
+ "type": {
12
+ "type": "string",
13
+ "enum": [
14
+ "amex",
15
+ "visa",
16
+ "masterCard",
17
+ "discover",
18
+ "diners",
19
+ "jcb",
20
+ "applePay",
21
+ "alipay",
22
+ "chinaUnionPay"
23
+ ]
24
+ },
25
+ "maskedNumber": {
26
+ "string": "string"
27
+ },
28
+ "issued": {
29
+ "type": ["string", "null"]
30
+ },
31
+ "expires": {
32
+ "string": "string"
33
+ },
34
+ "systemData": {
35
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
36
+ }
37
+ }
38
+ }
@@ -0,0 +1,66 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "https://api.kohost.app/schemas/v3/reservation.json",
4
+ "title": "Reservation",
5
+ "type": "object",
6
+ "required": ["type", "status", "checkInDateTime", "checkOutDateTime"],
7
+ "properties": {
8
+ "id": {
9
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
10
+ },
11
+ "primaryGuest": {
12
+ "type": "string"
13
+ },
14
+ "type": {
15
+ "type": "string"
16
+ },
17
+ "sharedGuests": {
18
+ "type": "array",
19
+ "items": {
20
+ "type": "string"
21
+ }
22
+ },
23
+ "group": {
24
+ "type": "string"
25
+ },
26
+ "status": {
27
+ "type": "string",
28
+ "enum": ["reserved", "checkedIn", "checkedOut", "cancelled", "noShow"]
29
+ },
30
+ "confirmationNumber": {
31
+ "type": "string"
32
+ },
33
+ "checkInDateTime": {
34
+ "type": "string",
35
+ "format": "date-time"
36
+ },
37
+ "checkOutDateTime": {
38
+ "type": "string",
39
+ "format": "date-time"
40
+ },
41
+ "adultCount": {
42
+ "type": "number",
43
+ "default": 1,
44
+ "minimum": 1
45
+ },
46
+ "childCount": {
47
+ "type": "number",
48
+ "default": 0
49
+ },
50
+ "rateSuppressed": {
51
+ "type": "boolean"
52
+ },
53
+ "payment": {
54
+ "type": "string"
55
+ },
56
+ "company": {
57
+ "type": "string"
58
+ },
59
+ "travelAgent": {
60
+ "type": "string"
61
+ },
62
+ "systemData": {
63
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
64
+ }
65
+ }
66
+ }
@@ -0,0 +1,138 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "https://api.kohost.app/schemas/v3/room.json",
4
+ "title": "Room",
5
+ "description": "A room represents a physical space of controllable IoT devices",
6
+ "type": "object",
7
+ "properties": {
8
+ "id": {
9
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
10
+ },
11
+ "name": {
12
+ "type": "string"
13
+ },
14
+ "floor": {
15
+ "type": "string"
16
+ },
17
+ "dimmers": {
18
+ "type": "array",
19
+ "default": [],
20
+ "items": {
21
+ "$ref": "https://api.kohost.app/schemas/v3/dimmer.json"
22
+ }
23
+ },
24
+ "switches": {
25
+ "type": "array",
26
+ "default": [],
27
+ "items": {
28
+ "$ref": "https://api.kohost.app/schemas/v3/switch.json"
29
+ }
30
+ },
31
+ "thermostats": {
32
+ "type": "array",
33
+ "default": [],
34
+ "items": {
35
+ "$ref": "https://api.kohost.app/schemas/v3/thermostat.json"
36
+ }
37
+ },
38
+ "locks": {
39
+ "type": "array",
40
+ "default": [],
41
+ "items": {
42
+ "$ref": "https://api.kohost.app/schemas/v3/lock.json"
43
+ }
44
+ },
45
+ "windowCoverings": {
46
+ "type": "array",
47
+ "default": [],
48
+ "items": {
49
+ "$ref": "https://api.kohost.app/schemas/v3/windowCovering.json"
50
+ }
51
+ },
52
+ "courtesy": {
53
+ "type": "array",
54
+ "default": [],
55
+ "items": {
56
+ "$ref": "https://api.kohost.app/schemas/v3/courtesy.json"
57
+ }
58
+ },
59
+ "sceneControllers": {
60
+ "type": "array",
61
+ "default": [],
62
+ "items": {
63
+ "$ref": "https://api.kohost.app/schemas/v3/sceneController.json"
64
+ }
65
+ },
66
+ "cameras": {
67
+ "type": "array",
68
+ "default": [],
69
+ "items": {
70
+ "$ref": "https://api.kohost.app/schemas/v3/camera.json"
71
+ }
72
+ },
73
+ "sources": {
74
+ "type": "array",
75
+ "default": [],
76
+ "items": {
77
+ "$ref": "https://api.kohost.app/schemas/v3/mediaSource.json"
78
+ }
79
+ },
80
+ "motionSensors": {
81
+ "type": "array",
82
+ "default": [],
83
+ "items": {
84
+ "$ref": "https://api.kohost.app/schemas/v3/motionSensor.json"
85
+ }
86
+ },
87
+ "alarms": {
88
+ "type": "array",
89
+ "default": [],
90
+ "items": {
91
+ "$ref": "https://api.kohost.app/schemas/v3/alarm.json"
92
+ }
93
+ },
94
+ "media": {
95
+ "type": "object",
96
+ "additionalProperties": false,
97
+ "default": {
98
+ "volume": 0,
99
+ "currentSource": null
100
+ },
101
+ "properties": {
102
+ "volume": {
103
+ "type": "number",
104
+ "minimum": 0,
105
+ "maximum": 100
106
+ },
107
+ "currentSource": {
108
+ "type": ["string", "null"]
109
+ }
110
+ }
111
+ },
112
+ "scenes": {
113
+ "type": "array",
114
+ "default": [],
115
+ "items": {
116
+ "description": "A list of scene IDs for later population, or entire scene objects",
117
+ "oneOf": [
118
+ {
119
+ "$ref": "https://api.kohost.app/schemas/v3/scene.json"
120
+ },
121
+ {
122
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
123
+ }
124
+ ]
125
+ }
126
+ },
127
+ "occupiedAt": {
128
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
129
+ },
130
+ "createdAt": {
131
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
132
+ },
133
+ "updatedAt": {
134
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/updatedAt"
135
+ }
136
+ },
137
+ "additionalProperties": false
138
+ }
@@ -0,0 +1,118 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "https://api.kohost.app/schemas/v3/scene.json",
4
+ "title": "Scene",
5
+ "description": "A room represents a physical space of controllable IoT devices",
6
+ "type": "object",
7
+ "properties": {
8
+ "id": {
9
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
10
+ },
11
+ "name": {
12
+ "type": "string"
13
+ },
14
+ "devices": {
15
+ "type": "object",
16
+ "properties": {
17
+ "switches": {
18
+ "type": "array",
19
+ "items": {
20
+ "type": "object",
21
+ "properties": {
22
+ "id": {
23
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
24
+ },
25
+ "state": {
26
+ "$ref": "https://api.kohost.app/schemas/v3/switch.json#/properties/state"
27
+ }
28
+ },
29
+ "default": []
30
+ }
31
+ },
32
+ "dimmers": {
33
+ "type": "array",
34
+ "items": {
35
+ "type": "object",
36
+ "properties": {
37
+ "id": {
38
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
39
+ },
40
+ "level": {
41
+ "$ref": "https://api.kohost.app/schemas/v3/dimmer.json#/properties/level"
42
+ }
43
+ }
44
+ },
45
+ "default": []
46
+ },
47
+ "windowCoverings": {
48
+ "type": "array",
49
+ "items": {
50
+ "type": "object",
51
+ "properties": {
52
+ "id": {
53
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
54
+ },
55
+ "position": {
56
+ "$ref": "https://api.kohost.app/schemas/v3/windowCovering.json#/properties/position"
57
+ }
58
+ }
59
+ },
60
+ "default": []
61
+ },
62
+ "thermostats": {
63
+ "type": "array",
64
+ "items": {
65
+ "type": "object",
66
+ "properties": {
67
+ "id": {
68
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
69
+ },
70
+ "hvacMode": {
71
+ "$ref": "https://api.kohost.app/schemas/v3/thermostat.json#/properties/hvacMode"
72
+ },
73
+ "setpoints": {
74
+ "$ref": "https://api.kohost.app/schemas/v3/thermostat.json#/properties/setpoints"
75
+ },
76
+ "fanMode": {
77
+ "$ref": "https://api.kohost.app/schemas/v3/thermostat.json#/properties/fanMode"
78
+ }
79
+ }
80
+ },
81
+ "default": []
82
+ },
83
+ "media": {
84
+ "type": "array",
85
+ "items": {
86
+ "type": "object",
87
+ "properties": {
88
+ "id": {
89
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
90
+ },
91
+ "volume": {
92
+ "type": "number",
93
+ "minimum": 0,
94
+ "maximum": 100
95
+ },
96
+ "commands": {
97
+ "type": "array",
98
+ "items": {
99
+ "type": "string"
100
+ }
101
+ }
102
+ }
103
+ }
104
+ }
105
+ },
106
+ "additionalProperties": false
107
+ },
108
+ "isDefault": {
109
+ "type": "boolean",
110
+ "default": false
111
+ },
112
+ "showOnUi": {
113
+ "type": "boolean",
114
+ "default": true
115
+ }
116
+ },
117
+ "additionalProperties": false
118
+ }
@@ -6,19 +6,22 @@
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "id": {
9
- "$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/id"
9
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
10
10
  },
11
11
  "type": {
12
- "$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/type"
12
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
13
+ },
14
+ "subType": {
15
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/subType"
13
16
  },
14
17
  "systemData": {
15
- "$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/systemData"
18
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
16
19
  },
17
20
  "supportedNotifications": {
18
- "$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/supportedNotifications"
21
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
19
22
  },
20
23
  "notification": {
21
- "$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/notification"
24
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
22
25
  },
23
26
  "supportedScenes": {
24
27
  "type": "array",
@@ -28,7 +31,7 @@
28
31
  }
29
32
  },
30
33
  "scene": {
31
- "type": "object",
34
+ "type": ["object", "null"],
32
35
  "properties": {
33
36
  "name": {
34
37
  "type": "string",
@@ -39,6 +42,15 @@
39
42
  "minimum": 1655907956593
40
43
  }
41
44
  }
45
+ },
46
+ "level": {
47
+ "type": "number",
48
+ "minimum": 0,
49
+ "maximum": 100
50
+ },
51
+ "state": {
52
+ "type": "string",
53
+ "enum": ["on", "off"]
42
54
  }
43
55
  },
44
56
  "additionalProperties": false,
@@ -0,0 +1,111 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "https://api.kohost.app/schemas/v3/space.json",
4
+ "title": "Space",
5
+ "type": "object",
6
+ "properties": {
7
+ "id": {
8
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
9
+ },
10
+ "name": {
11
+ "type": "string",
12
+ "minLength": 1
13
+ },
14
+ "type": {
15
+ "type": ["string"],
16
+ "enum": [
17
+ "classRoom",
18
+ "hotelRoom",
19
+ "office",
20
+ "building",
21
+ "commonArea",
22
+ "other"
23
+ ]
24
+ },
25
+ "rooms": {
26
+ "type": "array",
27
+ "items": {
28
+ "type": "string"
29
+ }
30
+ },
31
+ "subGroups": {
32
+ "type": "array",
33
+ "items": {
34
+ "type": "string"
35
+ }
36
+ },
37
+ "eco": {
38
+ "type": "object",
39
+ "additionalProperties": false,
40
+ "default": {
41
+ "active": false,
42
+ "allowed": false
43
+ },
44
+ "properties": {
45
+ "active": {
46
+ "type": "boolean",
47
+ "default": false
48
+ },
49
+ "activatedAt": {
50
+ "type": "string",
51
+ "format": "date-time"
52
+ },
53
+ "allowed": {
54
+ "type": "boolean",
55
+ "default": false
56
+ }
57
+ }
58
+ },
59
+ "features": {
60
+ "type": "array",
61
+ "items": {
62
+ "type": "string"
63
+ }
64
+ },
65
+ "maximumOccupancy": {
66
+ "type": "number",
67
+ "minimum": 1
68
+ },
69
+ "housekeepingStatus": {
70
+ "type": "string",
71
+ "enum": ["clean", "dirty", "inspected", "pickup"]
72
+ },
73
+ "serviceStatus": {
74
+ "type": "string",
75
+ "enum": ["inService", "outOfOrder", "outOfService"]
76
+ },
77
+ "systemData": {
78
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
79
+ }
80
+ },
81
+ "if": {
82
+ "properties": { "type": { "const": "hotelRoom" } }
83
+ },
84
+ "then": {
85
+ "required": [
86
+ "name",
87
+ "type",
88
+ "features",
89
+ "maximumOccupancy",
90
+ "housekeepingStatus",
91
+ "serviceStatus"
92
+ ],
93
+ "properties": {
94
+ "features": {
95
+ "default": []
96
+ },
97
+ "maximumOccupancy": {
98
+ "default": 2
99
+ },
100
+ "housekeepingStatus": {
101
+ "default": "dirty"
102
+ },
103
+ "serviceStatus": {
104
+ "default": "inService"
105
+ }
106
+ }
107
+ },
108
+ "else": {
109
+ "required": ["name", "type"]
110
+ }
111
+ }
@@ -6,19 +6,22 @@
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "id": {
9
- "$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/id"
9
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
10
10
  },
11
11
  "type": {
12
- "$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/type"
12
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
13
+ },
14
+ "subType": {
15
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/subType"
13
16
  },
14
17
  "systemData": {
15
- "$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/systemData"
18
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
16
19
  },
17
20
  "supportedNotifications": {
18
- "$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/supportedNotifications"
21
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
19
22
  },
20
23
  "notification": {
21
- "$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/notification"
24
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
22
25
  },
23
26
  "state": {
24
27
  "type": "string",
@@ -6,27 +6,35 @@
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "id": {
9
- "$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/id"
9
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
10
+ },
11
+ "name": {
12
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/name"
10
13
  },
11
14
  "type": {
12
- "$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/type"
15
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type",
16
+ "default": "thermostat"
17
+ },
18
+ "subType": {
19
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/subType"
13
20
  },
14
21
  "systemData": {
15
- "$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/systemData"
22
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData",
23
+ "default": {}
16
24
  },
17
25
  "supportedNotifications": {
18
- "$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/supportedNotifications"
26
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
19
27
  },
20
28
  "notification": {
21
- "$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/notification"
29
+ "$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
22
30
  },
23
31
  "currentTemperature": {
24
32
  "type": "number",
25
33
  "minimum": 0,
26
- "maximum": 99
34
+ "maximum": 130
27
35
  },
28
36
  "currentHumidity": {
29
- "type": "number",
37
+ "type": ["number", "null"],
30
38
  "minimum": 0,
31
39
  "maximum": 99
32
40
  },
@@ -48,11 +56,12 @@
48
56
  },
49
57
  "temperatureScale": {
50
58
  "type": "string",
51
- "enum": ["celcius", "farenheit"]
59
+ "enum": ["celsius", "fahrenheit"],
60
+ "default": "fahrenheit"
52
61
  },
53
62
  "humidityScale": {
54
- "type": "string",
55
- "enum": ["absolute", "relative"]
63
+ "type": ["string", "null"],
64
+ "enum": ["absolute", "relative", null]
56
65
  },
57
66
  "supportedHvacModes": {
58
67
  "type": "array",