node-red-contrib-homekit-bridged 2.0.0-dev.5 → 2.0.0-dev.8

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 (128) hide show
  1. package/build/lib/HAPHostNode.js +183 -141
  2. package/build/lib/HAPServiceNode.js +199 -172
  3. package/build/lib/HAPServiceNode2.js +207 -172
  4. package/build/lib/NRCHKBError.js +23 -2
  5. package/build/lib/PairingQRCode.js +62 -0
  6. package/build/lib/Storage.js +152 -90
  7. package/build/lib/api.js +654 -288
  8. package/build/lib/camera/CameraControl.js +119 -84
  9. package/build/lib/camera/CameraDelegate.js +481 -404
  10. package/build/lib/camera/MP4StreamingServer.js +148 -139
  11. package/build/lib/hap/HAPCharacteristic.js +25 -4
  12. package/build/lib/hap/HAPService.js +25 -4
  13. package/build/lib/hap/eve-app/EveCharacteristics.js +124 -81
  14. package/build/lib/hap/eve-app/EveServices.js +50 -17
  15. package/build/lib/hap/hap-nodejs.js +32 -0
  16. package/build/lib/migration/HomeKitService2Migration.js +34 -0
  17. package/build/lib/migration/NodeMigration.js +75 -0
  18. package/build/lib/types/AccessoryInformationType.js +15 -1
  19. package/build/lib/types/CameraConfigType.js +15 -1
  20. package/build/lib/types/CustomCharacteristicType.js +15 -1
  21. package/build/lib/types/HAPHostConfigType.js +15 -1
  22. package/build/lib/types/HAPHostNodeType.js +15 -1
  23. package/build/lib/types/HAPService2ConfigType.js +15 -1
  24. package/build/lib/types/HAPService2NodeType.js +15 -1
  25. package/build/lib/types/HAPServiceConfigType.js +15 -1
  26. package/build/lib/types/HAPServiceNodeType.js +15 -1
  27. package/build/lib/types/HAPStatusConfigType.js +15 -1
  28. package/build/lib/types/HAPStatusNodeType.js +15 -1
  29. package/build/lib/types/HostType.js +28 -7
  30. package/build/lib/types/NodeType.js +15 -1
  31. package/build/lib/types/PublishTimersType.js +15 -1
  32. package/build/lib/types/UniFiControllerConfigType.js +16 -0
  33. package/build/lib/types/hap-nodejs/HapAdaptiveLightingControllerMode.js +28 -7
  34. package/build/lib/types/hap-nodejs/HapCategories.js +64 -43
  35. package/build/lib/types/storage/SerializedHostType.js +15 -1
  36. package/build/lib/types/storage/StorageType.js +34 -10
  37. package/build/lib/unifi/ProtectDiscovery.js +80 -0
  38. package/build/lib/utils/AccessoryUtils.js +152 -110
  39. package/build/lib/utils/BridgeUtils.js +82 -39
  40. package/build/lib/utils/CharacteristicUtils.js +5 -49
  41. package/build/lib/utils/CharacteristicUtils2.js +5 -49
  42. package/build/lib/utils/CharacteristicUtilsBase.js +81 -0
  43. package/build/lib/utils/NodeStatusUtils.js +89 -40
  44. package/build/lib/utils/ServiceUtils.js +433 -375
  45. package/build/lib/utils/ServiceUtils2.js +519 -309
  46. package/build/lib/utils/index.js +10 -11
  47. package/build/nodes/bridge.html +206 -168
  48. package/build/nodes/bridge.js +27 -9
  49. package/build/nodes/locales/en-US/node-red-contrib-homekit-bridged.json +22 -0
  50. package/build/nodes/nrchkb.html +1753 -117
  51. package/build/nodes/nrchkb.js +66 -88
  52. package/build/nodes/plugin-instance.html +509 -0
  53. package/build/nodes/plugin-instance.js +46 -0
  54. package/build/nodes/service.html +544 -307
  55. package/build/nodes/service.js +5 -6
  56. package/build/nodes/service2.html +1721 -455
  57. package/build/nodes/service2.js +5 -8
  58. package/build/nodes/standalone.html +208 -176
  59. package/build/nodes/standalone.js +27 -9
  60. package/build/nodes/status.html +51 -18
  61. package/build/nodes/status.js +47 -40
  62. package/build/nodes/unifi-controller.html +92 -0
  63. package/build/nodes/unifi-controller.js +20 -0
  64. package/build/plugins/embedded/homebridge-camera-ffmpeg/index.js +479 -0
  65. package/build/plugins/embedded/homebridge-unifi-protect/index.js +521 -0
  66. package/build/plugins/embedded/index.js +58 -0
  67. package/build/plugins/nrchkb-homekit-plugins.js +17 -0
  68. package/build/plugins/registry/index.js +203 -0
  69. package/build/plugins/registry/types.js +16 -0
  70. package/build/scripts/migrate-homekit-service-flows.js +47 -0
  71. package/examples/demo/01 - ALL Demos single import.json +1885 -1885
  72. package/examples/demo/02 - Air Purifier.json +279 -279
  73. package/examples/demo/03 - Air Quality sensor with Battery.json +254 -254
  74. package/examples/demo/04 - Dimmable Bulb.json +172 -172
  75. package/examples/demo/05 - Color Bulb (HSV).json +195 -195
  76. package/examples/demo/06 - Fan (simple, 3 speeds).json +240 -240
  77. package/examples/demo/07 - Fan (with speed, oscillate, rotation direction).json +175 -175
  78. package/examples/demo/08 - CO2 detector.json +224 -224
  79. package/examples/demo/09 - CO (carbon monoxide) example.json +255 -255
  80. package/examples/demo/10 - Door window contact sensor.json +234 -234
  81. package/examples/demos (advanced)/01 - Television with inputs and speaker.json +541 -541
  82. package/examples/switch/01 - Plain Switch.json +178 -178
  83. package/package.json +95 -84
  84. package/build/lib/HAPHostNode.d.ts +0 -1
  85. package/build/lib/HAPServiceNode.d.ts +0 -1
  86. package/build/lib/HAPServiceNode2.d.ts +0 -1
  87. package/build/lib/NRCHKBError.d.ts +0 -3
  88. package/build/lib/Storage.d.ts +0 -30
  89. package/build/lib/api.d.ts +0 -1
  90. package/build/lib/camera/CameraControl.d.ts +0 -3
  91. package/build/lib/camera/CameraDelegate.d.ts +0 -38
  92. package/build/lib/camera/MP4StreamingServer.d.ts +0 -26
  93. package/build/lib/hap/HAPCharacteristic.d.ts +0 -9
  94. package/build/lib/hap/HAPService.d.ts +0 -6
  95. package/build/lib/hap/eve-app/EveCharacteristics.d.ts +0 -20
  96. package/build/lib/hap/eve-app/EveServices.d.ts +0 -5
  97. package/build/lib/types/AccessoryInformationType.d.ts +0 -11
  98. package/build/lib/types/CameraConfigType.d.ts +0 -24
  99. package/build/lib/types/CustomCharacteristicType.d.ts +0 -6
  100. package/build/lib/types/HAPHostConfigType.d.ts +0 -22
  101. package/build/lib/types/HAPHostNodeType.d.ts +0 -14
  102. package/build/lib/types/HAPService2ConfigType.d.ts +0 -6
  103. package/build/lib/types/HAPService2NodeType.d.ts +0 -7
  104. package/build/lib/types/HAPServiceConfigType.d.ts +0 -26
  105. package/build/lib/types/HAPServiceNodeType.d.ts +0 -38
  106. package/build/lib/types/HAPStatusConfigType.d.ts +0 -5
  107. package/build/lib/types/HAPStatusNodeType.d.ts +0 -12
  108. package/build/lib/types/HostType.d.ts +0 -5
  109. package/build/lib/types/NodeType.d.ts +0 -3
  110. package/build/lib/types/PublishTimersType.d.ts +0 -4
  111. package/build/lib/types/hap-nodejs/HapAdaptiveLightingControllerMode.d.ts +0 -5
  112. package/build/lib/types/hap-nodejs/HapCategories.d.ts +0 -41
  113. package/build/lib/types/storage/SerializedHostType.d.ts +0 -5
  114. package/build/lib/types/storage/StorageType.d.ts +0 -8
  115. package/build/lib/utils/AccessoryUtils.d.ts +0 -1
  116. package/build/lib/utils/BridgeUtils.d.ts +0 -1
  117. package/build/lib/utils/CharacteristicUtils.d.ts +0 -1
  118. package/build/lib/utils/CharacteristicUtils2.d.ts +0 -1
  119. package/build/lib/utils/NodeStatusUtils.d.ts +0 -17
  120. package/build/lib/utils/ServiceUtils.d.ts +0 -1
  121. package/build/lib/utils/ServiceUtils2.d.ts +0 -1
  122. package/build/lib/utils/index.d.ts +0 -1
  123. package/build/nodes/bridge.d.ts +0 -1
  124. package/build/nodes/nrchkb.d.ts +0 -1
  125. package/build/nodes/service.d.ts +0 -1
  126. package/build/nodes/service2.d.ts +0 -1
  127. package/build/nodes/standalone.d.ts +0 -1
  128. package/build/nodes/status.d.ts +0 -1
@@ -1,258 +1,258 @@
1
1
  [
2
- {
3
- "id": "6eaa9b9e.282734",
4
- "type": "group",
5
- "z": "60b06629.a2ebd",
6
- "name": "CO plus CO2 Sensor: input only sensor",
7
- "style": {
8
- "stroke": "#999999",
9
- "fill": "none",
10
- "label": true,
11
- "label-position": "nw",
12
- "color": "#a4a4a4"
2
+ {
3
+ "id": "6eaa9b9e.282734",
4
+ "type": "group",
5
+ "z": "60b06629.a2ebd",
6
+ "name": "CO plus CO2 Sensor: input only sensor",
7
+ "style": {
8
+ "stroke": "#999999",
9
+ "fill": "none",
10
+ "label": true,
11
+ "label-position": "nw",
12
+ "color": "#a4a4a4"
13
+ },
14
+ "nodes": [
15
+ "2e6738a6.ef5dd8",
16
+ "79889759.8219c",
17
+ "7f53465b.356a68",
18
+ "97aff586.786ff8",
19
+ "659ff3da.236404",
20
+ "e6105066.f8911",
21
+ "b433a780.665a7",
22
+ "d4b30334.a19e58",
23
+ "b0eeeb34.2dde8"
24
+ ],
25
+ "x": 14,
26
+ "y": 1059,
27
+ "w": 752,
28
+ "h": 282,
29
+ "info": "# Combined Sensor\nThis is a sensor which will display both Carbon Monoxide (poisonous, deadly gas) and Carbon Dioxide (what humans exhale) levels.\n\n# CO Sensor\n\nThere are three inputs to this example, one for each level of Carbon Monoxide in the air. Options are:\n\n**0 ppm:** this will assume no CO in the air <br/>\n**Low level:** this will assume a level between 1 and 35 ppm, inclusive. This level is generally assumed to not cause problems in healthy adults <br/>\n**Dangerous level:** this will assume a level between 35 and 5000, inclusive; this will also trigger an alert in Home app\n\n## IF YOU HAVE A CARBON MONOXIDE DETECTOR EVER READING ABOVE 35 PPM, PLEASE EVACUATE THE AREA AND SEEK FRESH AIR IMMEDIATELY TO AVOID RISK OF DEATH ##\n\n# CO2 Sensor\n\nThere are three inputs to this example, one for each level of Carbon Dioxide in the air. Options are:\n\n**0 ppm:** this will assume no CO2 in the air <br/>\n**CO2 Level:** this will assume a level between 1 and 100,000 ppm, inclusive <br/>\n**Dangerous level:** this will assume a level between 1,000 and 100,000, inclusive\n\n"
13
30
  },
14
- "nodes": [
15
- "2e6738a6.ef5dd8",
16
- "79889759.8219c",
17
- "7f53465b.356a68",
18
- "97aff586.786ff8",
19
- "659ff3da.236404",
20
- "e6105066.f8911",
21
- "b433a780.665a7",
22
- "d4b30334.a19e58",
23
- "b0eeeb34.2dde8"
24
- ],
25
- "x": 14,
26
- "y": 1059,
27
- "w": 752,
28
- "h": 282,
29
- "info": "# Combined Sensor\nThis is a sensor which will display both Carbon Monoxide (poisonous, deadly gas) and Carbon Dioxide (what humans exhale) levels.\n\n# CO Sensor\n\nThere are three inputs to this example, one for each level of Carbon Monoxide in the air. Options are:\n\n**0 ppm:** this will assume no CO in the air <br/>\n**Low level:** this will assume a level between 1 and 35 ppm, inclusive. This level is generally assumed to not cause problems in healthy adults <br/>\n**Dangerous level:** this will assume a level between 35 and 5000, inclusive; this will also trigger an alert in Home app\n\n## IF YOU HAVE A CARBON MONOXIDE DETECTOR EVER READING ABOVE 35 PPM, PLEASE EVACUATE THE AREA AND SEEK FRESH AIR IMMEDIATELY TO AVOID RISK OF DEATH ##\n\n# CO2 Sensor\n\nThere are three inputs to this example, one for each level of Carbon Dioxide in the air. Options are:\n\n**0 ppm:** this will assume no CO2 in the air <br/>\n**CO2 Level:** this will assume a level between 1 and 100,000 ppm, inclusive <br/>\n**Dangerous level:** this will assume a level between 1,000 and 100,000, inclusive\n\n"
30
- },
31
- {
32
- "id": "2e6738a6.ef5dd8",
33
- "type": "homekit-service",
34
- "z": "60b06629.a2ebd",
35
- "g": "6eaa9b9e.282734",
36
- "isParent": true,
37
- "bridge": "409001a1.3e7a78",
38
- "parentService": "",
39
- "name": "CO detector",
40
- "serviceName": "CarbonMonoxideSensor",
41
- "topic": "",
42
- "filter": false,
43
- "manufacturer": "MONOxide",
44
- "model": "1",
45
- "serialNo": "2",
46
- "firmwareRev": "2",
47
- "hardwareRev": "2",
48
- "softwareRev": "1.0.0",
49
- "cameraConfigVideoProcessor": "ffmpeg",
50
- "cameraConfigSource": "",
51
- "cameraConfigStillImageSource": "",
52
- "cameraConfigMaxStreams": 2,
53
- "cameraConfigMaxWidth": 1280,
54
- "cameraConfigMaxHeight": 720,
55
- "cameraConfigMaxFPS": 10,
56
- "cameraConfigMaxBitrate": 300,
57
- "cameraConfigVideoCodec": "libx264",
58
- "cameraConfigAudioCodec": "libfdk_aac",
59
- "cameraConfigAudio": false,
60
- "cameraConfigPacketSize": 1316,
61
- "cameraConfigVerticalFlip": false,
62
- "cameraConfigHorizontalFlip": false,
63
- "cameraConfigMapVideo": "0:0",
64
- "cameraConfigMapAudio": "0:1",
65
- "cameraConfigVideoFilter": "scale=1280:720",
66
- "cameraConfigAdditionalCommandLine": "-tune zerolatency",
67
- "cameraConfigDebug": false,
68
- "cameraConfigSnapshotOutput": "disabled",
69
- "cameraConfigInterfaceName": "",
70
- "characteristicProperties": "{\n \"CarbonMonoxideLevel\":{\n \"maxValue\":5000\n },\n \"CarbonMonoxidePeakLevel\":{\n \"maxValue\":5000\n },\n \"CarbonDioxideLevel\":true,\n \"CarbonDioxidePeakLevel\":true\n}",
71
- "outputs": 2,
72
- "x": 670,
73
- "y": 1100,
74
- "wires": [[], []]
75
- },
76
- {
77
- "id": "79889759.8219c",
78
- "type": "function",
79
- "z": "60b06629.a2ebd",
80
- "g": "6eaa9b9e.282734",
81
- "name": "Carbon DIoxide",
82
- "func": "if(msg.payload === 0){\n context.set('lastPeak',0);\n newMsg = {\n payload: {\n \"CarbonDioxideLevel\":0\n }\n }\n return newMsg;\n}\n\n// Initialize vars\nvar CurrentLevel = 0;\nvar lastPeak = context.get('lastPeak');\n\n// Set random level\nif(msg.payload === \"CO2\"){\n CurrentLevel = Math.floor(Math.random() * (100000 - 1 + 1) + 1);\n}\n\n\n// Formulate output message\nvar newMsg = {\n payload: {\n \"CarbonDioxideLevel\" : CurrentLevel\n }\n};\n\n// Set new peak level\nif(CurrentLevel > lastPeak){\n lastPeak = CurrentLevel;\n context.set('lastPeak',CurrentLevel);\n newMsg.payload.CarbonDioxidePeakLevel = CurrentLevel;\n}\n\nreturn newMsg;",
83
- "outputs": 1,
84
- "noerr": 0,
85
- "initialize": "// Code added here will be run once\n// whenever the node is deployed.\ncontext.set('lastPeak',0);",
86
- "finalize": "",
87
- "x": 380,
88
- "y": 1260,
89
- "wires": [["2e6738a6.ef5dd8"]]
90
- },
91
- {
92
- "id": "7f53465b.356a68",
93
- "type": "function",
94
- "z": "60b06629.a2ebd",
95
- "g": "6eaa9b9e.282734",
96
- "name": "Carbon MONoxide",
97
- "func": "// Reset all values to 0 if 0ppm input\nif(msg.payload === 0){\n context.set('lastPeak',0);\n newMsg = {\n payload: {\n \"CarbonMonoxideLevel\":0,\n \"CarbonMonoxidePeakLevel\":0,\n \"CarbonMonoxideDetected\":0\n }\n };\n return newMsg;\n}\n\n// Initialize vars\nvar CurrentLevel = 0;\nvar lastPeak = context.get('lastPeak');\n\n// Set random Low or Dangerous levels\nif(msg.payload === \"Low\"){\n CurrentLevel = Math.floor(Math.random() * (35 - 1 + 1) + 1);\n}\nif(msg.payload === \"Danger\"){\n CurrentLevel = Math.floor(Math.random() * (5000 - 35 + 1) + 35);\n}\n\n// Formulate output message\nvar newMsg = {\n payload: {\n \"CarbonMonoxideLevel\" : CurrentLevel,\n \"CarbonMonoxideDetected\" : 0\n }\n};\n\n// Set new peak level\nif(CurrentLevel > lastPeak){\n lastPeak = CurrentLevel;\n context.set('lastPeak',CurrentLevel);\n newMsg.payload.CarbonMonoxidePeakLevel = CurrentLevel;\n}\n\n// Set warning if dangerous\nif (CurrentLevel >= 35) {\n newMsg.payload.CarbonMonoxideDetected = 1;\n} \n\nreturn newMsg;",
98
- "outputs": 1,
99
- "noerr": 0,
100
- "initialize": "",
101
- "finalize": "",
102
- "x": 390,
103
- "y": 1140,
104
- "wires": [["2e6738a6.ef5dd8"]]
105
- },
106
- {
107
- "id": "97aff586.786ff8",
108
- "type": "inject",
109
- "z": "60b06629.a2ebd",
110
- "g": "6eaa9b9e.282734",
111
- "name": "NO RESPONSE",
112
- "props": [
113
- {
114
- "p": "payload"
115
- },
116
- {
117
- "p": "topic",
118
- "vt": "str"
119
- }
120
- ],
121
- "repeat": "",
122
- "crontab": "",
123
- "once": false,
124
- "onceDelay": 0.1,
125
- "topic": "",
126
- "payload": "{\"CarbonMonoxideLevel\":\"NO_RESPONSE\"}",
127
- "payloadType": "json",
128
- "x": 400,
129
- "y": 1100,
130
- "wires": [["2e6738a6.ef5dd8"]]
131
- },
132
- {
133
- "id": "659ff3da.236404",
134
- "type": "inject",
135
- "z": "60b06629.a2ebd",
136
- "g": "6eaa9b9e.282734",
137
- "name": "Clear CO2 Peak",
138
- "props": [
139
- {
140
- "p": "payload"
141
- }
142
- ],
143
- "repeat": "",
144
- "crontab": "",
145
- "once": false,
146
- "onceDelay": 0.1,
147
- "topic": "",
148
- "payload": "0",
149
- "payloadType": "num",
150
- "x": 140,
151
- "y": 1260,
152
- "wires": [["79889759.8219c"]]
153
- },
154
- {
155
- "id": "e6105066.f8911",
156
- "type": "inject",
157
- "z": "60b06629.a2ebd",
158
- "g": "6eaa9b9e.282734",
159
- "name": "0 ppm",
160
- "repeat": "",
161
- "crontab": "",
162
- "once": false,
163
- "onceDelay": 0.1,
164
- "topic": "",
165
- "payload": "0",
166
- "payloadType": "num",
167
- "x": 130,
168
- "y": 1100,
169
- "wires": [["7f53465b.356a68"]]
170
- },
171
- {
172
- "id": "b433a780.665a7",
173
- "type": "inject",
174
- "z": "60b06629.a2ebd",
175
- "g": "6eaa9b9e.282734",
176
- "name": "CO2 Level",
177
- "props": [
178
- {
179
- "p": "payload"
180
- }
181
- ],
182
- "repeat": "",
183
- "crontab": "",
184
- "once": false,
185
- "onceDelay": 0.1,
186
- "topic": "",
187
- "payload": "CO2",
188
- "payloadType": "str",
189
- "x": 120,
190
- "y": 1300,
191
- "wires": [["79889759.8219c"]]
192
- },
193
- {
194
- "id": "d4b30334.a19e58",
195
- "type": "inject",
196
- "z": "60b06629.a2ebd",
197
- "g": "6eaa9b9e.282734",
198
- "name": "Low level",
199
- "props": [
200
- {
201
- "p": "payload"
202
- }
203
- ],
204
- "repeat": "",
205
- "crontab": "",
206
- "once": false,
207
- "onceDelay": 0.1,
208
- "topic": "",
209
- "payload": "Low",
210
- "payloadType": "str",
211
- "x": 140,
212
- "y": 1140,
213
- "wires": [["7f53465b.356a68"]]
214
- },
215
- {
216
- "id": "b0eeeb34.2dde8",
217
- "type": "inject",
218
- "z": "60b06629.a2ebd",
219
- "g": "6eaa9b9e.282734",
220
- "name": "Danger level",
221
- "props": [
222
- {
223
- "p": "payload"
224
- }
225
- ],
226
- "repeat": "",
227
- "crontab": "",
228
- "once": false,
229
- "onceDelay": 0.1,
230
- "topic": "",
231
- "payload": "Danger",
232
- "payloadType": "str",
233
- "x": 150,
234
- "y": 1180,
235
- "wires": [["7f53465b.356a68"]]
236
- },
237
- {
238
- "id": "409001a1.3e7a78",
239
- "type": "homekit-bridge",
240
- "z": "",
241
- "bridgeName": "Demo 1",
242
- "pinCode": "153-10-538",
243
- "port": "",
244
- "allowInsecureRequest": false,
245
- "manufacturer": "NRCHKB",
246
- "model": "Demo",
247
- "serialNo": "1.1.2",
248
- "customMdnsConfig": false,
249
- "mdnsMulticast": true,
250
- "mdnsInterface": "",
251
- "mdnsPort": "",
252
- "mdnsIp": "",
253
- "mdnsTtl": "",
254
- "mdnsLoopback": true,
255
- "mdnsReuseAddr": true,
256
- "allowMessagePassthrough": true
257
- }
31
+ {
32
+ "id": "2e6738a6.ef5dd8",
33
+ "type": "homekit-service",
34
+ "z": "60b06629.a2ebd",
35
+ "g": "6eaa9b9e.282734",
36
+ "isParent": true,
37
+ "bridge": "409001a1.3e7a78",
38
+ "parentService": "",
39
+ "name": "CO detector",
40
+ "serviceName": "CarbonMonoxideSensor",
41
+ "topic": "",
42
+ "filter": false,
43
+ "manufacturer": "MONOxide",
44
+ "model": "1",
45
+ "serialNo": "2",
46
+ "firmwareRev": "2",
47
+ "hardwareRev": "2",
48
+ "softwareRev": "1.0.0",
49
+ "cameraConfigVideoProcessor": "ffmpeg",
50
+ "cameraConfigSource": "",
51
+ "cameraConfigStillImageSource": "",
52
+ "cameraConfigMaxStreams": 2,
53
+ "cameraConfigMaxWidth": 1280,
54
+ "cameraConfigMaxHeight": 720,
55
+ "cameraConfigMaxFPS": 10,
56
+ "cameraConfigMaxBitrate": 300,
57
+ "cameraConfigVideoCodec": "libx264",
58
+ "cameraConfigAudioCodec": "libfdk_aac",
59
+ "cameraConfigAudio": false,
60
+ "cameraConfigPacketSize": 1316,
61
+ "cameraConfigVerticalFlip": false,
62
+ "cameraConfigHorizontalFlip": false,
63
+ "cameraConfigMapVideo": "0:0",
64
+ "cameraConfigMapAudio": "0:1",
65
+ "cameraConfigVideoFilter": "scale=1280:720",
66
+ "cameraConfigAdditionalCommandLine": "-tune zerolatency",
67
+ "cameraConfigDebug": false,
68
+ "cameraConfigSnapshotOutput": "disabled",
69
+ "cameraConfigInterfaceName": "",
70
+ "characteristicProperties": "{\n \"CarbonMonoxideLevel\":{\n \"maxValue\":5000\n },\n \"CarbonMonoxidePeakLevel\":{\n \"maxValue\":5000\n },\n \"CarbonDioxideLevel\":true,\n \"CarbonDioxidePeakLevel\":true\n}",
71
+ "outputs": 2,
72
+ "x": 670,
73
+ "y": 1100,
74
+ "wires": [[], []]
75
+ },
76
+ {
77
+ "id": "79889759.8219c",
78
+ "type": "function",
79
+ "z": "60b06629.a2ebd",
80
+ "g": "6eaa9b9e.282734",
81
+ "name": "Carbon DIoxide",
82
+ "func": "if(msg.payload === 0){\n context.set('lastPeak',0);\n newMsg = {\n payload: {\n \"CarbonDioxideLevel\":0\n }\n }\n return newMsg;\n}\n\n// Initialize vars\nvar CurrentLevel = 0;\nvar lastPeak = context.get('lastPeak');\n\n// Set random level\nif(msg.payload === \"CO2\"){\n CurrentLevel = Math.floor(Math.random() * (100000 - 1 + 1) + 1);\n}\n\n\n// Formulate output message\nvar newMsg = {\n payload: {\n \"CarbonDioxideLevel\" : CurrentLevel\n }\n};\n\n// Set new peak level\nif(CurrentLevel > lastPeak){\n lastPeak = CurrentLevel;\n context.set('lastPeak',CurrentLevel);\n newMsg.payload.CarbonDioxidePeakLevel = CurrentLevel;\n}\n\nreturn newMsg;",
83
+ "outputs": 1,
84
+ "noerr": 0,
85
+ "initialize": "// Code added here will be run once\n// whenever the node is deployed.\ncontext.set('lastPeak',0);",
86
+ "finalize": "",
87
+ "x": 380,
88
+ "y": 1260,
89
+ "wires": [["2e6738a6.ef5dd8"]]
90
+ },
91
+ {
92
+ "id": "7f53465b.356a68",
93
+ "type": "function",
94
+ "z": "60b06629.a2ebd",
95
+ "g": "6eaa9b9e.282734",
96
+ "name": "Carbon MONoxide",
97
+ "func": "// Reset all values to 0 if 0ppm input\nif(msg.payload === 0){\n context.set('lastPeak',0);\n newMsg = {\n payload: {\n \"CarbonMonoxideLevel\":0,\n \"CarbonMonoxidePeakLevel\":0,\n \"CarbonMonoxideDetected\":0\n }\n };\n return newMsg;\n}\n\n// Initialize vars\nvar CurrentLevel = 0;\nvar lastPeak = context.get('lastPeak');\n\n// Set random Low or Dangerous levels\nif(msg.payload === \"Low\"){\n CurrentLevel = Math.floor(Math.random() * (35 - 1 + 1) + 1);\n}\nif(msg.payload === \"Danger\"){\n CurrentLevel = Math.floor(Math.random() * (5000 - 35 + 1) + 35);\n}\n\n// Formulate output message\nvar newMsg = {\n payload: {\n \"CarbonMonoxideLevel\" : CurrentLevel,\n \"CarbonMonoxideDetected\" : 0\n }\n};\n\n// Set new peak level\nif(CurrentLevel > lastPeak){\n lastPeak = CurrentLevel;\n context.set('lastPeak',CurrentLevel);\n newMsg.payload.CarbonMonoxidePeakLevel = CurrentLevel;\n}\n\n// Set warning if dangerous\nif (CurrentLevel >= 35) {\n newMsg.payload.CarbonMonoxideDetected = 1;\n} \n\nreturn newMsg;",
98
+ "outputs": 1,
99
+ "noerr": 0,
100
+ "initialize": "",
101
+ "finalize": "",
102
+ "x": 390,
103
+ "y": 1140,
104
+ "wires": [["2e6738a6.ef5dd8"]]
105
+ },
106
+ {
107
+ "id": "97aff586.786ff8",
108
+ "type": "inject",
109
+ "z": "60b06629.a2ebd",
110
+ "g": "6eaa9b9e.282734",
111
+ "name": "NO RESPONSE",
112
+ "props": [
113
+ {
114
+ "p": "payload"
115
+ },
116
+ {
117
+ "p": "topic",
118
+ "vt": "str"
119
+ }
120
+ ],
121
+ "repeat": "",
122
+ "crontab": "",
123
+ "once": false,
124
+ "onceDelay": 0.1,
125
+ "topic": "",
126
+ "payload": "{\"CarbonMonoxideLevel\":\"NO_RESPONSE\"}",
127
+ "payloadType": "json",
128
+ "x": 400,
129
+ "y": 1100,
130
+ "wires": [["2e6738a6.ef5dd8"]]
131
+ },
132
+ {
133
+ "id": "659ff3da.236404",
134
+ "type": "inject",
135
+ "z": "60b06629.a2ebd",
136
+ "g": "6eaa9b9e.282734",
137
+ "name": "Clear CO2 Peak",
138
+ "props": [
139
+ {
140
+ "p": "payload"
141
+ }
142
+ ],
143
+ "repeat": "",
144
+ "crontab": "",
145
+ "once": false,
146
+ "onceDelay": 0.1,
147
+ "topic": "",
148
+ "payload": "0",
149
+ "payloadType": "num",
150
+ "x": 140,
151
+ "y": 1260,
152
+ "wires": [["79889759.8219c"]]
153
+ },
154
+ {
155
+ "id": "e6105066.f8911",
156
+ "type": "inject",
157
+ "z": "60b06629.a2ebd",
158
+ "g": "6eaa9b9e.282734",
159
+ "name": "0 ppm",
160
+ "repeat": "",
161
+ "crontab": "",
162
+ "once": false,
163
+ "onceDelay": 0.1,
164
+ "topic": "",
165
+ "payload": "0",
166
+ "payloadType": "num",
167
+ "x": 130,
168
+ "y": 1100,
169
+ "wires": [["7f53465b.356a68"]]
170
+ },
171
+ {
172
+ "id": "b433a780.665a7",
173
+ "type": "inject",
174
+ "z": "60b06629.a2ebd",
175
+ "g": "6eaa9b9e.282734",
176
+ "name": "CO2 Level",
177
+ "props": [
178
+ {
179
+ "p": "payload"
180
+ }
181
+ ],
182
+ "repeat": "",
183
+ "crontab": "",
184
+ "once": false,
185
+ "onceDelay": 0.1,
186
+ "topic": "",
187
+ "payload": "CO2",
188
+ "payloadType": "str",
189
+ "x": 120,
190
+ "y": 1300,
191
+ "wires": [["79889759.8219c"]]
192
+ },
193
+ {
194
+ "id": "d4b30334.a19e58",
195
+ "type": "inject",
196
+ "z": "60b06629.a2ebd",
197
+ "g": "6eaa9b9e.282734",
198
+ "name": "Low level",
199
+ "props": [
200
+ {
201
+ "p": "payload"
202
+ }
203
+ ],
204
+ "repeat": "",
205
+ "crontab": "",
206
+ "once": false,
207
+ "onceDelay": 0.1,
208
+ "topic": "",
209
+ "payload": "Low",
210
+ "payloadType": "str",
211
+ "x": 140,
212
+ "y": 1140,
213
+ "wires": [["7f53465b.356a68"]]
214
+ },
215
+ {
216
+ "id": "b0eeeb34.2dde8",
217
+ "type": "inject",
218
+ "z": "60b06629.a2ebd",
219
+ "g": "6eaa9b9e.282734",
220
+ "name": "Danger level",
221
+ "props": [
222
+ {
223
+ "p": "payload"
224
+ }
225
+ ],
226
+ "repeat": "",
227
+ "crontab": "",
228
+ "once": false,
229
+ "onceDelay": 0.1,
230
+ "topic": "",
231
+ "payload": "Danger",
232
+ "payloadType": "str",
233
+ "x": 150,
234
+ "y": 1180,
235
+ "wires": [["7f53465b.356a68"]]
236
+ },
237
+ {
238
+ "id": "409001a1.3e7a78",
239
+ "type": "homekit-bridge",
240
+ "z": "",
241
+ "bridgeName": "Demo 1",
242
+ "pinCode": "153-10-538",
243
+ "port": "",
244
+ "allowInsecureRequest": false,
245
+ "manufacturer": "NRCHKB",
246
+ "model": "Demo",
247
+ "serialNo": "1.1.2",
248
+ "customMdnsConfig": false,
249
+ "mdnsMulticast": true,
250
+ "mdnsInterface": "",
251
+ "mdnsPort": "",
252
+ "mdnsIp": "",
253
+ "mdnsTtl": "",
254
+ "mdnsLoopback": true,
255
+ "mdnsReuseAddr": true,
256
+ "allowMessagePassthrough": true
257
+ }
258
258
  ]