nodejs-poolcontroller 8.3.0 → 8.4.1

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 (107) hide show
  1. package/.eslintrc.json +36 -36
  2. package/.github/ISSUE_TEMPLATE/1-bug-report.yml +84 -84
  3. package/.github/ISSUE_TEMPLATE/2-docs.md +12 -12
  4. package/.github/ISSUE_TEMPLATE/3-proposal.md +28 -28
  5. package/.github/ISSUE_TEMPLATE/config.yml +8 -8
  6. package/.github/copilot-instructions.md +63 -63
  7. package/.github/workflows/ghcr-publish.yml +67 -67
  8. package/157_issues.md +101 -0
  9. package/AGENTS.md +613 -0
  10. package/CONTRIBUTING.md +74 -74
  11. package/Changelog +292 -284
  12. package/Dockerfile +62 -62
  13. package/Gruntfile.js +40 -40
  14. package/LICENSE +661 -661
  15. package/README.md +329 -309
  16. package/anslq25/MessagesMock.ts +221 -221
  17. package/anslq25/boards/MockBoardFactory.ts +49 -49
  18. package/anslq25/boards/MockEasyTouchBoard.ts +696 -696
  19. package/anslq25/boards/MockSystemBoard.ts +216 -216
  20. package/anslq25/chemistry/MockChlorinator.ts +98 -98
  21. package/anslq25/pumps/MockPump.ts +83 -83
  22. package/app.ts +115 -115
  23. package/config/Config.ts +0 -0
  24. package/config/VersionCheck.ts +0 -0
  25. package/controller/Constants.ts +809 -805
  26. package/controller/Equipment.ts +2737 -2664
  27. package/controller/Errors.ts +181 -181
  28. package/controller/Lockouts.ts +549 -549
  29. package/controller/State.ts +3746 -3701
  30. package/controller/boards/AquaLinkBoard.ts +1175 -1003
  31. package/controller/boards/BoardFactory.ts +53 -53
  32. package/controller/boards/EasyTouchBoard.ts +3246 -3202
  33. package/controller/boards/IntelliCenterBoard.ts +4581 -3899
  34. package/controller/boards/IntelliComBoard.ts +69 -69
  35. package/controller/boards/IntelliTouchBoard.ts +382 -382
  36. package/controller/boards/NixieBoard.ts +1947 -1944
  37. package/controller/boards/SunTouchBoard.ts +401 -400
  38. package/controller/boards/SystemBoard.ts +5303 -5268
  39. package/controller/comms/Comms.ts +1278 -1255
  40. package/controller/comms/ScreenLogic.ts +1665 -1665
  41. package/controller/comms/messages/Messages.ts +1627 -1406
  42. package/controller/comms/messages/config/ChlorinatorMessage.ts +5 -0
  43. package/controller/comms/messages/config/CircuitGroupMessage.ts +0 -0
  44. package/controller/comms/messages/config/CircuitMessage.ts +0 -0
  45. package/controller/comms/messages/config/ConfigMessage.ts +6 -0
  46. package/controller/comms/messages/config/CoverMessage.ts +0 -0
  47. package/controller/comms/messages/config/CustomNameMessage.ts +31 -31
  48. package/controller/comms/messages/config/EquipmentMessage.ts +250 -210
  49. package/controller/comms/messages/config/ExternalMessage.ts +1051 -903
  50. package/controller/comms/messages/config/FeatureMessage.ts +0 -0
  51. package/controller/comms/messages/config/GeneralMessage.ts +65 -0
  52. package/controller/comms/messages/config/HeaterMessage.ts +0 -0
  53. package/controller/comms/messages/config/IntellichemMessage.ts +0 -0
  54. package/controller/comms/messages/config/OptionsMessage.ts +207 -174
  55. package/controller/comms/messages/config/PumpMessage.ts +427 -421
  56. package/controller/comms/messages/config/RemoteMessage.ts +0 -0
  57. package/controller/comms/messages/config/ScheduleMessage.ts +401 -390
  58. package/controller/comms/messages/config/SecurityMessage.ts +37 -13
  59. package/controller/comms/messages/config/ValveMessage.ts +0 -0
  60. package/controller/comms/messages/status/ChlorinatorStateMessage.ts +0 -0
  61. package/controller/comms/messages/status/EquipmentStateMessage.ts +940 -822
  62. package/controller/comms/messages/status/HeaterStateMessage.ts +147 -135
  63. package/controller/comms/messages/status/IntelliChemStateMessage.ts +448 -448
  64. package/controller/comms/messages/status/IntelliValveStateMessage.ts +36 -36
  65. package/controller/comms/messages/status/NeptuneModbusStateMessage.ts +217 -0
  66. package/controller/comms/messages/status/PumpStateMessage.ts +0 -0
  67. package/controller/comms/messages/status/RegalModbusStateMessage.ts +410 -410
  68. package/controller/comms/messages/status/VersionMessage.ts +152 -41
  69. package/controller/nixie/Nixie.ts +173 -173
  70. package/controller/nixie/NixieEquipment.ts +104 -104
  71. package/controller/nixie/bodies/Body.ts +120 -120
  72. package/controller/nixie/bodies/Filter.ts +135 -135
  73. package/controller/nixie/chemistry/ChemController.ts +2756 -2724
  74. package/controller/nixie/chemistry/ChemDoser.ts +806 -806
  75. package/controller/nixie/chemistry/Chlorinator.ts +367 -367
  76. package/controller/nixie/circuits/Circuit.ts +478 -478
  77. package/controller/nixie/heaters/Heater.ts +843 -834
  78. package/controller/nixie/pumps/Pump.ts +1336 -1193
  79. package/controller/nixie/schedules/Schedule.ts +401 -401
  80. package/controller/nixie/valves/Valve.ts +170 -170
  81. package/defaultConfig.json +352 -352
  82. package/docker-compose.yml +32 -31
  83. package/logger/DataLogger.ts +448 -448
  84. package/logger/Logger.ts +459 -436
  85. package/package.json +58 -58
  86. package/sendSocket.js +32 -32
  87. package/tsconfig.json +26 -25
  88. package/types/express-multer.d.ts +32 -32
  89. package/web/Server.ts +1939 -1927
  90. package/web/bindings/aqualinkD.json +559 -559
  91. package/web/bindings/influxDB.json +1066 -1066
  92. package/web/bindings/mqtt.json +721 -721
  93. package/web/bindings/mqttAlt.json +746 -746
  94. package/web/bindings/rulesManager.json +54 -54
  95. package/web/bindings/smartThings-Hubitat.json +31 -31
  96. package/web/bindings/valveRelays.json +20 -20
  97. package/web/bindings/vera.json +25 -25
  98. package/web/interfaces/baseInterface.ts +188 -188
  99. package/web/interfaces/httpInterface.ts +148 -148
  100. package/web/interfaces/influxInterface.ts +283 -283
  101. package/web/interfaces/mqttInterface.ts +695 -695
  102. package/web/interfaces/ruleInterface.ts +101 -87
  103. package/web/services/config/Config.ts +1212 -1053
  104. package/web/services/config/ConfigSocket.ts +0 -0
  105. package/web/services/state/State.ts +21 -0
  106. package/web/services/state/StateSocket.ts +28 -0
  107. package/web/services/utilities/Utilities.ts +233 -233
@@ -1,560 +1,560 @@
1
- {
2
- "context": {
3
- "name": "AqualinkD",
4
- "options": {
5
- "formatter": [
6
- {
7
- "transform": ".toLowerCase()"
8
- },
9
- {
10
- "regexkey": "[\\s+\\/\\+\\$\\#]",
11
- "replace": "-",
12
- "description": "Remove [whitespace,/,+,$,#]"
13
- }
14
- ],
15
- "rootTopic-DIRECTIONS": "You can override the root topic by renaming _rootTopic to rootTopic",
16
- "_rootTopic": "@bind=(state.equipment.alias).replace(' ','-').replace('/','').toLowerCase();",
17
- "clientId": "@bind=`aqualinkd_njsPC_${webApp.mac().replace(/:/g, '_'}-${webApp.httpPort()}`;"
18
- },
19
- "vars": {
20
- "tempPrecision": 2,
21
- "tempUnits": "@bind=sys.board.valueMaps.tempUnits.getName(state.temps.units);"
22
- }
23
- },
24
- "subscriptions": [
25
- {
26
- "topic": "Aux_1",
27
- "description": "State of the Aux_1 circuit on AqualinkD",
28
- "processor": [
29
- "let val = parseInt(value, 10);",
30
- "if(!isNaN(val)) sys.board.circuits.setCircuitStateAsync(2, parseInt(value, 10) === 1);"
31
-
32
- ]
33
- },
34
- {
35
- "topic": "Aux_2",
36
- "description": "State of the Aux_2 circuit on AqualinkD",
37
- "processor": [
38
- "let val = parseInt(value, 10);",
39
- "if(!isNaN(val)) sys.board.circuits.setCircuitStateAsync(3, val === 1);"
40
- ]
41
- },
42
- {
43
- "topic": "Aux_3",
44
- "description": "State of the Aux_3 circuit on AqualinkD",
45
- "processor": [
46
- "let val = parseInt(value, 10);",
47
- "if(!isNaN(val)) sys.board.circuits.setCircuitStateAsync(4, val === 1);"
48
- ]
49
- },
50
- {
51
- "topic": "Aux_4",
52
- "description": "State of the Aux_4 circuit on AqualinkD",
53
- "processor": [
54
- "let val = parseInt(value, 10);",
55
- "if(!isNaN(val)) sys.board.circuits.setCircuitStateAsync(5, val === 1);"
56
- ]
57
- },
58
- {
59
- "topic": "Aux_5",
60
- "description": "State of the Aux_5 circuit on AqualinkD",
61
- "processor": [
62
- "let val = parseInt(value, 10);",
63
- "if(!isNaN(val)) sys.board.circuits.setCircuitStateAsync(7, val === 1);"
64
- ]
65
- },
66
- {
67
- "topic": "Aux_6",
68
- "description": "State of the Aux_1 circuit on AqualinkD",
69
- "processor": [
70
- "let val = parseInt(value, 10);",
71
- "if(!isNaN(val)) sys.board.circuits.setCircuitStateAsync(8, val === 1);"
72
- ]
73
- },
74
- {
75
- "topic": "Aux_7",
76
- "description": "State of the Aux_7 circuit on AqualinkD",
77
- "processor": [
78
- "let val = parseInt(value, 10);",
79
- "if(!isNaN(val)) sys.board.circuits.setCircuitStateAsync(9, val === 1);"
80
- ]
81
- },
82
- {
83
- "topic": "Aux_8",
84
- "description": "State of the Aux_8 circuit on AqualinkD",
85
- "processor": [
86
- "let val = parseInt(value, 10);",
87
- "if(!isNaN(val)) sys.board.circuits.setCircuitStateAsync(10, val === 1);"
88
- ]
89
- },
90
- {
91
- "topic": "Aux_B1",
92
- "description": "State of the Aux_B1 feature on AqualinkD",
93
- "processor": [
94
- "let val = parseInt(value, 10);",
95
- "if(!isNaN(val)) sys.board.features.setFeatureStateAsync(129, val === 1);"
96
- ]
97
- },
98
- {
99
- "topic": "Aux_B2",
100
- "description": "State of the Aux_B2 feature on AqualinkD",
101
- "processor": [
102
- "let val = parseInt(value, 10);",
103
- "if(!isNaN(val)) sys.board.features.setFeatureStateAsync(130, val === 1);"
104
- ]
105
- },
106
- {
107
- "topic": "Aux_B3",
108
- "description": "State of the Aux_B3 feature on AqualinkD",
109
- "processor": [
110
- "let val = parseInt(value, 10);",
111
- "if(!isNaN(val)) sys.board.features.setFeatureStateAsync(131, val === 1);"
112
- ]
113
- },
114
- {
115
- "topic": "Aux_B4",
116
- "description": "State of the Aux_B4 feature on AqualinkD",
117
- "processor": [
118
- "let val = parseInt(value, 10);",
119
- "if(!isNaN(val)) sys.board.features.setFeatureStateAsync(132, val === 1);"
120
- ]
121
- },
122
- {
123
- "topic": "Aux_B5",
124
- "description": "State of the Aux_B5 feature on AqualinkD",
125
- "processor": [
126
- "let val = parseInt(value, 10);",
127
- "if(!isNaN(val)) sys.board.features.setFeatureStateAsync(133, val === 1);"
128
- ]
129
- },
130
- {
131
- "topic": "Aux_B6",
132
- "description": "State of the Aux_B6 feature on AqualinkD",
133
- "processor": [
134
- "let val = parseInt(value, 10);",
135
- "if(!isNaN(val)) sys.board.features.setFeatureStateAsync(134, val === 1);"
136
- ]
137
- },
138
- {
139
- "topic": "Aux_B7",
140
- "description": "State of the Aux_B7 feature on AqualinkD",
141
- "processor": [
142
- "let val = parseInt(value, 10);",
143
- "if(!isNaN(val)) sys.board.features.setFeatureStateAsync(135, val === 1);"
144
- ]
145
- },
146
- {
147
- "topic": "Aux_B8",
148
- "description": "State of the Aux_B8 feature on AqualinkD",
149
- "processor": [
150
- "let val = parseInt(value, 10);",
151
- "if(!isNaN(val)) sys.board.features.setFeatureStateAsync(136, val === 1);"
152
- ]
153
- },
154
- {
155
- "topic": "Filter_Pump",
156
- "description": "State of the Filter_Pump on AqualinkD",
157
- "processor": [
158
- "if(isNaN(parseInt(value, 10))) return;",
159
- "if(state.circuits.getItemById(1).isOn === false) ",
160
- " sys.board.circuits.setCircuitStateAsync(6, parseInt(value, 10) === 1);",
161
- "else sys.board.circuits.setCircuitStateAsync(1, parseInt(value, 10) === 1);"
162
- ]
163
- },
164
- {
165
- "topic": "Spa_Mode",
166
- "description": "The body mode for the controller. If 1 then we are in spa mode otherwise we are in pool mode.",
167
- "processor": [
168
- "if(isNaN(parseInt(value, 10))) return;",
169
- "sys.board.circuits.setCircuitStateAsync(1, parseInt(value, 10) === 1);"
170
- ]
171
- },
172
- {
173
- "topic": "Temperature/Pool",
174
- "description": "The current temperature emitted by the controller for the pool. However, we only want to set this when the pool circuit is on.",
175
- "processor": [
176
- "if(isNaN(parseFloat(value))) return;",
177
- "let temp = ctx.util.convert.temperature.convertUnits(parseFloat(value), ctx.vars.tempUnits, sys.board.valueMaps.tempUnits.getName(state.temps.units));",
178
- "state.temps.bodies.getItemById(1).temp = temp;",
179
- "if(state.circuits.getItemById(6).isOn) sys.board.system.setTempsAsync({ waterSensor1: temp });"
180
- ]
181
- },
182
- {
183
- "topic": "Temperature/Spa",
184
- "description": "The current temperature emitted by the controller for the spa. However, we only want to set this when the spa circuit is on.",
185
- "processor": [
186
- "if(isNaN(parseFloat(value))) return;",
187
- "let temp = ctx.util.convert.temperature.convertUnits(parseFloat(value), ctx.vars.tempUnits, sys.board.valueMaps.tempUnits.getName(state.temps.units));",
188
- "state.temps.bodies.getItemById(2).temp = temp;",
189
- "if(state.circuits.getItemById(1).isOn) sys.board.system.setTempsAsync({ waterSensor1: temp });"
190
- ]
191
- },
192
- {
193
- "topic": "Temperature/Air",
194
- "description": "The current temperature emitted by the controller for air temperature.",
195
- "processor": [
196
- "if(isNaN(parseFloat(value))) return;",
197
- "let temp = ctx.util.convert.temperature.convertUnits(parseFloat(value), ctx.vars.tempUnits, sys.board.valueMaps.tempUnits.getName(state.temps.units));",
198
- "sys.board.system.setTempsAsync({ air: temp });"
199
- ]
200
- },
201
- {
202
- "topic": "Temperature/Solar",
203
- "description": "The current temperature emitted by the controller for solar.",
204
- "processor": [
205
- "if(isNaN(parseFloat(value))) return;",
206
- "let temp = ctx.util.convert.temperature.convertUnits(parseFloat(value), ctx.vars.tempUnits, sys.board.valueMaps.tempUnits.getName(state.temps.units));",
207
- "sys.board.system.setTempsAsync({ solarSensor1: temp });"
208
- ]
209
- },
210
- {
211
- "topic": "Filter_Pump/RPM",
212
- "description": "The RPM for the first pump",
213
- "processor": [ "state.pumps.getPumpByAddress(96).rpm = parseInt(value, 10);" ]
214
- },
215
- {
216
- "topic": "Filter_Pump/Watts",
217
- "description": "The Watts for the first pump",
218
- "processor": [ "state.pumps.getPumpByAddress(96).watts = parseInt(value, 10);" ]
219
- },
220
- {
221
- "topic": "Filter_Pump/GPM",
222
- "description": "The flow for the first pump",
223
- "processor": [ "state.pumps.getPumpByAddress(96).flow = parseInt(value, 10);" ]
224
- },
225
- {
226
- "topic": "Pump_1/RPM",
227
- "description": "The RPM for aux the pump",
228
- "processor": [ "state.pumps.getPumpByAddress(97).rpm = parseInt(value, 10);" ]
229
- },
230
- {
231
- "topic": "Pump_1/Watts",
232
- "description": "The Watts for aux the pump",
233
- "processor": [ "state.pumps.getPumpByAddress(97).watts = parseInt(value, 10);" ]
234
- },
235
- {
236
- "topic": "Pump_1/GPM",
237
- "description": "The flow for the aux pump",
238
- "processor": [ "state.pumps.getPumpByAddress(97).flow = parseInt(value, 10);" ]
239
- },
240
- {
241
- "topic": "Pump_2/RPM",
242
- "description": "The RPM for aux the pump",
243
- "processor": [ "state.pumps.getPumpByAddress(98).rpm = parseInt(value, 10);" ]
244
- },
245
- {
246
- "topic": "Pump_2/Watts",
247
- "description": "The Watts for aux the pump",
248
- "processor": [ "state.pumps.getPumpByAddress(98).watts = parseInt(value, 10);" ]
249
- },
250
- {
251
- "topic": "Pump_2/GPM",
252
- "description": "The flow for the aux pump",
253
- "processor": [ "state.pumps.getPumpByAddress(98).flow = parseInt(value, 10);" ]
254
- },
255
- {
256
- "topic": "Pump_3/RPM",
257
- "description": "The RPM for aux the pump",
258
- "processor": [ "state.pumps.getPumpByAddress(99).rpm = parseInt(value, 10);" ]
259
- },
260
- {
261
- "topic": "Pump_3/Watts",
262
- "description": "The Watts for aux the pump",
263
- "processor": [ "state.pumps.getPumpByAddress(99).watts = parseInt(value, 10);" ]
264
- },
265
- {
266
- "topic": "Pump_3/GPM",
267
- "description": "The flow for the aux pump",
268
- "processor": [ "state.pumps.getPumpByAddress(99).flow = parseInt(value, 10);" ]
269
- },
270
- {
271
- "topic": "Pump_4/RPM",
272
- "description": "The RPM for aux the pump",
273
- "processor": [ "state.pumps.getPumpByAddress(100).rpm = parseInt(value, 10);" ]
274
- },
275
- {
276
- "topic": "Pump_4/Watts",
277
- "description": "The Watts for aux the pump",
278
- "processor": [ "state.pumps.getPumpByAddress(100).watts = parseInt(value, 10);" ]
279
- },
280
- {
281
- "topic": "Pump_4/GPM",
282
- "description": "The flow for the aux pump",
283
- "processor": [ "state.pumps.getPumpByAddress(100).flow = parseInt(value, 10);" ]
284
- },
285
- {
286
- "topic": "Pump_5/RPM",
287
- "description": "The RPM for aux the pump",
288
- "processor": [ "state.pumps.getPumpByAddress(101).rpm = parseInt(value, 10);" ]
289
- },
290
- {
291
- "topic": "Pump_5/Watts",
292
- "description": "The Watts for aux the pump",
293
- "processor": [ "state.pumps.getPumpByAddress(101).watts = parseInt(value, 10);" ]
294
- },
295
- {
296
- "topic": "Pump_5/GPM",
297
- "description": "The flow for the aux pump",
298
- "processor": [ "state.pumps.getPumpByAddress(101).flow = parseInt(value, 10);" ]
299
- },
300
- {
301
- "topic": "Pump_6/RPM",
302
- "description": "The RPM for aux the pump",
303
- "processor": [ "state.pumps.getPumpByAddress(102).rpm = parseInt(value, 10);" ]
304
- },
305
- {
306
- "topic": "Pump_6/Watts",
307
- "description": "The Watts for aux the pump",
308
- "processor": [ "state.pumps.getPumpByAddress(102).watts = parseInt(value, 10);" ]
309
- },
310
- {
311
- "topic": "Pump_6/GPM",
312
- "description": "The flow for the aux pump",
313
- "processor": [ "state.pumps.getPumpByAddress(102).flow = parseInt(value, 10);" ]
314
- },
315
- {
316
- "topic": "Pump_7/RPM",
317
- "description": "The RPM for aux the pump",
318
- "processor": [ "state.pumps.getPumpByAddress(103).rpm = parseInt(value, 10);" ]
319
- },
320
- {
321
- "topic": "Pump_7/Watts",
322
- "description": "The Watts for aux the pump",
323
- "processor": [ "state.pumps.getPumpByAddress(103).watts = parseInt(value, 10);" ]
324
- },
325
- {
326
- "topic": "Pump_7/GPM",
327
- "description": "The flow for the aux pump",
328
- "processor": [ "state.pumps.getPumpByAddress(103).flow = parseInt(value, 10);" ]
329
- },
330
- {
331
- "topic": "SWG/PPM",
332
- "description": "The salt level for the chlorinator",
333
- "processor": [ "state.chlorinators.getItemById(1).saltLevel = parseInt(value, 10);" ]
334
- },
335
- {
336
- "topic": "SWG/fullstatus",
337
- "description": "The current status for the chlorinator",
338
- "processor": [
339
- "switch(parseInt(value, 10)) {",
340
- "case 8: state.chlorinators.getItemById(1).status = 5;",
341
- "case 9: state.chlorinators.getItemById(1).status = 0;",
342
- "case 16: state.chlorinators.getItemById(1).status = 4;",
343
- "case 32: state.chlorinators.getItemById(1).status = 6;",
344
- "case 64: state.chlorinators.getItemById(1).status = 7;",
345
- "case 128: state.chlorinators.getItemById(1).status = 8;",
346
- "case 255: state.chlorinators.getItemById(1).status = 128;",
347
- "default: state.chlorinators.getItemById(1).status = parseInt(value, 10); }"
348
- ]
349
- },
350
- {
351
- "topic": "Pool_Heater/enabled",
352
- "description": "The current heat mode for the pool heater",
353
- "processor": [
354
- "if(isNaN(parseInt(value, 10))) return;",
355
- "sys.bodies.getItemById(1).heatMode = state.temps.bodies.getItemById(1).heatMode = parseInt(value, 10) === 1 ? 2 : 1;"
356
- ]
357
- },
358
- {
359
- "topic": "Spa_Heater/enabled",
360
- "description": "The current heat mode for the spa heater",
361
- "processor": [
362
- "if(isNaN(parseInt(value, 10))) return;",
363
- "sys.bodies.getItemById(2).heatMode = state.temps.bodies.getItemById(2).heatMode = parseInt(value, 10) === 1 ? 2 : 1;"
364
- ]
365
- },
366
- {
367
- "topic": "Pool_Heater/setpoint",
368
- "description": "The setpoint for the pool body",
369
- "processor": [
370
- "if(isNaN(parseFloat(value))) return;",
371
- "let temp = ctx.util.convert.temperature.convertUnits(parseFloat(value), ctx.vars.tempUnits, sys.board.valueMaps.tempUnits.getName(state.temps.units));",
372
- "let body = sys.bodies.getItemById(1); sys.board.bodies.setHeatSetpointAsync(body, parseInt(temp, 10));"
373
- ]
374
- },
375
- {
376
- "topic": "Spa_Heater/setpoint",
377
- "description": "The setpoint for the spa body",
378
- "processor": [
379
- "if(isNaN(parseFloat(value))) return;",
380
- "let temp = ctx.util.convert.temperature.convertUnits(parseFloat(value), ctx.vars.tempUnits, sys.board.valueMaps.tempUnits.getName(state.temps.units));",
381
- "let body = sys.bodies.getItemById(2); sys.board.bodies.setHeatSetpointAsync(body, parseInt(temp, 10));"
382
- ]
383
- },
384
- {
385
- "topic": "Pool_Heater",
386
- "description": "The heat status for the pool heater",
387
- "processor": [ "let body = state.temps.bodies.getItemById(1); body.heatStatus = parseInt(value, 10);" ]
388
- },
389
- {
390
- "topic": "Spa_Heater",
391
- "description": "The heat status for the spa heater",
392
- "processor": [ "let body = state.temps.bodies.getItemById(2); body.heatStatus = parseInt(value, 10);" ]
393
- },
394
-
395
- {
396
- "topic": "SWG/Percent",
397
- "description": "The current status for the chlorinator",
398
- "processor": [ "sys.chlorinators.getItemById(1).poolSetpoint = state.chlorinators.getItemById(1).poolSetpoint = parseInt(value, 10);" ]
399
- },
400
- {
401
- "topic": "Freeze_Protect/setpoint",
402
- "description": "The current freeze protection setpoint",
403
- "processor": [
404
- "let temp = ctx.util.temperature.convertUnits(parseFloat(value), ctx.vars.tempUnits, sys.board.valueMaps.tempUnits.getName(state.temps.units));",
405
- "sys.general.options.freezeThreshold = parseInt(Math.round(temp), 10);"
406
- ]
407
- },
408
- {
409
- "topic": "Freeze_Protect",
410
- "description": "The current freeze protection setpoint",
411
- "processor": [ "state.freeze = parseInt(value, 10) === 1;" ]
412
- }
413
- ],
414
- "events": [
415
- {
416
- "name": "config",
417
- "description": "Don't flood the MQTT bus.",
418
- "enabled": false
419
- },
420
- {
421
- "name": "circuit",
422
- "description": "Populate the circuits topics",
423
- "topics": [
424
- {
425
- "topic": "Filter_Pump/set",
426
- "message": "@bind=data.isOn ? 1 : 0;",
427
- "description": "Bind the state",
428
- "filter": "@bind=data.id; === 6;"
429
- },
430
- {
431
- "topic": "Spa_Mode/set",
432
- "message": "@bind=data.isOn ? 1 : 0;",
433
- "description": "Bind the state",
434
- "filter": "@bind=data.id; === 1;"
435
- },
436
- {
437
- "topic": "Aux_1/set",
438
- "message": "@bind=data.isOn ? 1 : 0;",
439
- "description": "Bind the state",
440
- "filter": "@bind=data.id; === 2;"
441
- },
442
- {
443
- "topic": "Aux_2/set",
444
- "message": "@bind=data.isOn ? 1 : 0;",
445
- "description": "Bind the state",
446
- "filter": "@bind=data.id; === 3;"
447
- },
448
- {
449
- "topic": "Aux_3/set",
450
- "message": "@bind=data.isOn ? 1 : 0;",
451
- "description": "Bind the state",
452
- "filter": "@bind=data.id; === 4;"
453
- },
454
- {
455
- "topic": "Aux_4/set",
456
- "message": "@bind=data.isOn ? 1 : 0;",
457
- "description": "Bind the state",
458
- "filter": "@bind=data.id; === 5;"
459
- },
460
- {
461
- "topic": "Aux_5/set",
462
- "message": "@bind=data.isOn ? 1 : 0;",
463
- "description": "Bind the state",
464
- "filter": "@bind=data.id; === 7;"
465
- },
466
- {
467
- "topic": "Aux_6/set",
468
- "message": "@bind=data.isOn ? 1 : 0;",
469
- "description": "Bind the state",
470
- "filter": "@bind=data.id; === 8;"
471
- },
472
- {
473
- "topic": "Aux_7/set",
474
- "message": "@bind=data.isOn ? 1 : 0;",
475
- "description": "Bind the state",
476
- "filter": "@bind=data.id; === 9;"
477
- },
478
- {
479
- "topic": "Aux_8/set",
480
- "message": "@bind=data.isOn; ? 1 : 0;",
481
- "description": "Bind the state",
482
- "filter": "@bind=data.id === 10;"
483
- }
484
- ]
485
- },
486
- {
487
- "name": "feature",
488
- "description": "Populate the features topics",
489
- "topics": [
490
- {
491
- "topic": "Aux_B@bind=data.id - 128;/set",
492
- "message": "@bind=data.isOn ? 1 : 0;",
493
- "description": "Bind the state"
494
- }
495
- ]
496
- },
497
- {
498
- "name": "body",
499
- "description": "Populate the body topic",
500
- "filter": "@bind=data.isActive;",
501
- "topics": [
502
- {
503
- "topic": "Pool_Heater/setpoint/set",
504
- "message": "@bind=data.setPoint;",
505
- "description": "Set the heat setpoint for the pool",
506
- "filter": "@bind=data.id === 1;",
507
- "processor": [
508
- "let units = sys.board.valueMaps.tempUnits.getName(state.temps.units);",
509
- "return ctx.util.roundNumber(ctx.util.convert.temperature.convertUnits(data.setPoint, units, ctx.vars.tempUnits), ctx.vars.tempPrecision);"
510
- ]
511
- },
512
- {
513
- "topic": "Spa_Heater/setpoint/set",
514
- "message": "@bind=data.setPoint;",
515
- "description": "Set the heat setpoint for the spa",
516
- "filter": "@bind=data.id === 2;",
517
- "processor": [
518
- "let units = sys.board.valueMaps.tempUnits.getName(state.temps.units);",
519
- "return ctx.util.roundNumber(ctx.util.convert.temperature.convertUnits(data.setPoint, units, ctx.vars.tempUnits), ctx.vars.tempPrecision);"
520
- ]
521
- },
522
- {
523
- "topic": "Pool_Heater/set",
524
- "message": "@bind=data.heatMode.val; === 2 ? 1 : 0",
525
- "description": "Bind the state",
526
- "filter": "@bind=data.id === 1;",
527
- "processor": [
528
- "return typeof data.heatMode !== 'undefined' && data.heatMode.val === 2 ? 1 : 0;"
529
- ]
530
- },
531
- {
532
- "topic": "Spa_Heater/set",
533
- "message": "@bind=data.heatMode.val; === 2 ? 1 : 0",
534
- "description": "Bind the state",
535
- "filter": "@bind=data.id === 2;",
536
- "processor": [
537
- "return typeof data.heatMode !== 'undefined' && data.heatMode.val === 2 ? 1 : 0;"
538
- ]
539
- }
540
-
541
- ]
542
- },
543
- {
544
- "name": "chlorinator",
545
- "description": "Populate the chlorinator topic",
546
- "topics": [
547
- {
548
- "topic": "SWG/Percent/set",
549
- "message": "@bind=data.superChlor ? 100 : data.disabled ? 0 : data.poolSetpoint;",
550
- "description": "Bind the setpoint topic. Unfortunately aqualink only supports one setpoint."
551
- }
552
- ]
553
- },
554
- {
555
- "name": "pump",
556
- "description": "Populate the pumps topic. We will need to figure this one out. Perhaps if the RS485 comm port is disabled we don't try to send anything.",
557
- "topics": []
558
- }
559
- ]
1
+ {
2
+ "context": {
3
+ "name": "AqualinkD",
4
+ "options": {
5
+ "formatter": [
6
+ {
7
+ "transform": ".toLowerCase()"
8
+ },
9
+ {
10
+ "regexkey": "[\\s+\\/\\+\\$\\#]",
11
+ "replace": "-",
12
+ "description": "Remove [whitespace,/,+,$,#]"
13
+ }
14
+ ],
15
+ "rootTopic-DIRECTIONS": "You can override the root topic by renaming _rootTopic to rootTopic",
16
+ "_rootTopic": "@bind=(state.equipment.alias).replace(' ','-').replace('/','').toLowerCase();",
17
+ "clientId": "@bind=`aqualinkd_njsPC_${webApp.mac().replace(/:/g, '_'}-${webApp.httpPort()}`;"
18
+ },
19
+ "vars": {
20
+ "tempPrecision": 2,
21
+ "tempUnits": "@bind=sys.board.valueMaps.tempUnits.getName(state.temps.units);"
22
+ }
23
+ },
24
+ "subscriptions": [
25
+ {
26
+ "topic": "Aux_1",
27
+ "description": "State of the Aux_1 circuit on AqualinkD",
28
+ "processor": [
29
+ "let val = parseInt(value, 10);",
30
+ "if(!isNaN(val)) sys.board.circuits.setCircuitStateAsync(2, parseInt(value, 10) === 1);"
31
+
32
+ ]
33
+ },
34
+ {
35
+ "topic": "Aux_2",
36
+ "description": "State of the Aux_2 circuit on AqualinkD",
37
+ "processor": [
38
+ "let val = parseInt(value, 10);",
39
+ "if(!isNaN(val)) sys.board.circuits.setCircuitStateAsync(3, val === 1);"
40
+ ]
41
+ },
42
+ {
43
+ "topic": "Aux_3",
44
+ "description": "State of the Aux_3 circuit on AqualinkD",
45
+ "processor": [
46
+ "let val = parseInt(value, 10);",
47
+ "if(!isNaN(val)) sys.board.circuits.setCircuitStateAsync(4, val === 1);"
48
+ ]
49
+ },
50
+ {
51
+ "topic": "Aux_4",
52
+ "description": "State of the Aux_4 circuit on AqualinkD",
53
+ "processor": [
54
+ "let val = parseInt(value, 10);",
55
+ "if(!isNaN(val)) sys.board.circuits.setCircuitStateAsync(5, val === 1);"
56
+ ]
57
+ },
58
+ {
59
+ "topic": "Aux_5",
60
+ "description": "State of the Aux_5 circuit on AqualinkD",
61
+ "processor": [
62
+ "let val = parseInt(value, 10);",
63
+ "if(!isNaN(val)) sys.board.circuits.setCircuitStateAsync(7, val === 1);"
64
+ ]
65
+ },
66
+ {
67
+ "topic": "Aux_6",
68
+ "description": "State of the Aux_1 circuit on AqualinkD",
69
+ "processor": [
70
+ "let val = parseInt(value, 10);",
71
+ "if(!isNaN(val)) sys.board.circuits.setCircuitStateAsync(8, val === 1);"
72
+ ]
73
+ },
74
+ {
75
+ "topic": "Aux_7",
76
+ "description": "State of the Aux_7 circuit on AqualinkD",
77
+ "processor": [
78
+ "let val = parseInt(value, 10);",
79
+ "if(!isNaN(val)) sys.board.circuits.setCircuitStateAsync(9, val === 1);"
80
+ ]
81
+ },
82
+ {
83
+ "topic": "Aux_8",
84
+ "description": "State of the Aux_8 circuit on AqualinkD",
85
+ "processor": [
86
+ "let val = parseInt(value, 10);",
87
+ "if(!isNaN(val)) sys.board.circuits.setCircuitStateAsync(10, val === 1);"
88
+ ]
89
+ },
90
+ {
91
+ "topic": "Aux_B1",
92
+ "description": "State of the Aux_B1 feature on AqualinkD",
93
+ "processor": [
94
+ "let val = parseInt(value, 10);",
95
+ "if(!isNaN(val)) sys.board.features.setFeatureStateAsync(129, val === 1);"
96
+ ]
97
+ },
98
+ {
99
+ "topic": "Aux_B2",
100
+ "description": "State of the Aux_B2 feature on AqualinkD",
101
+ "processor": [
102
+ "let val = parseInt(value, 10);",
103
+ "if(!isNaN(val)) sys.board.features.setFeatureStateAsync(130, val === 1);"
104
+ ]
105
+ },
106
+ {
107
+ "topic": "Aux_B3",
108
+ "description": "State of the Aux_B3 feature on AqualinkD",
109
+ "processor": [
110
+ "let val = parseInt(value, 10);",
111
+ "if(!isNaN(val)) sys.board.features.setFeatureStateAsync(131, val === 1);"
112
+ ]
113
+ },
114
+ {
115
+ "topic": "Aux_B4",
116
+ "description": "State of the Aux_B4 feature on AqualinkD",
117
+ "processor": [
118
+ "let val = parseInt(value, 10);",
119
+ "if(!isNaN(val)) sys.board.features.setFeatureStateAsync(132, val === 1);"
120
+ ]
121
+ },
122
+ {
123
+ "topic": "Aux_B5",
124
+ "description": "State of the Aux_B5 feature on AqualinkD",
125
+ "processor": [
126
+ "let val = parseInt(value, 10);",
127
+ "if(!isNaN(val)) sys.board.features.setFeatureStateAsync(133, val === 1);"
128
+ ]
129
+ },
130
+ {
131
+ "topic": "Aux_B6",
132
+ "description": "State of the Aux_B6 feature on AqualinkD",
133
+ "processor": [
134
+ "let val = parseInt(value, 10);",
135
+ "if(!isNaN(val)) sys.board.features.setFeatureStateAsync(134, val === 1);"
136
+ ]
137
+ },
138
+ {
139
+ "topic": "Aux_B7",
140
+ "description": "State of the Aux_B7 feature on AqualinkD",
141
+ "processor": [
142
+ "let val = parseInt(value, 10);",
143
+ "if(!isNaN(val)) sys.board.features.setFeatureStateAsync(135, val === 1);"
144
+ ]
145
+ },
146
+ {
147
+ "topic": "Aux_B8",
148
+ "description": "State of the Aux_B8 feature on AqualinkD",
149
+ "processor": [
150
+ "let val = parseInt(value, 10);",
151
+ "if(!isNaN(val)) sys.board.features.setFeatureStateAsync(136, val === 1);"
152
+ ]
153
+ },
154
+ {
155
+ "topic": "Filter_Pump",
156
+ "description": "State of the Filter_Pump on AqualinkD",
157
+ "processor": [
158
+ "if(isNaN(parseInt(value, 10))) return;",
159
+ "if(state.circuits.getItemById(1).isOn === false) ",
160
+ " sys.board.circuits.setCircuitStateAsync(6, parseInt(value, 10) === 1);",
161
+ "else sys.board.circuits.setCircuitStateAsync(1, parseInt(value, 10) === 1);"
162
+ ]
163
+ },
164
+ {
165
+ "topic": "Spa_Mode",
166
+ "description": "The body mode for the controller. If 1 then we are in spa mode otherwise we are in pool mode.",
167
+ "processor": [
168
+ "if(isNaN(parseInt(value, 10))) return;",
169
+ "sys.board.circuits.setCircuitStateAsync(1, parseInt(value, 10) === 1);"
170
+ ]
171
+ },
172
+ {
173
+ "topic": "Temperature/Pool",
174
+ "description": "The current temperature emitted by the controller for the pool. However, we only want to set this when the pool circuit is on.",
175
+ "processor": [
176
+ "if(isNaN(parseFloat(value))) return;",
177
+ "let temp = ctx.util.convert.temperature.convertUnits(parseFloat(value), ctx.vars.tempUnits, sys.board.valueMaps.tempUnits.getName(state.temps.units));",
178
+ "state.temps.bodies.getItemById(1).temp = temp;",
179
+ "if(state.circuits.getItemById(6).isOn) sys.board.system.setTempsAsync({ waterSensor1: temp });"
180
+ ]
181
+ },
182
+ {
183
+ "topic": "Temperature/Spa",
184
+ "description": "The current temperature emitted by the controller for the spa. However, we only want to set this when the spa circuit is on.",
185
+ "processor": [
186
+ "if(isNaN(parseFloat(value))) return;",
187
+ "let temp = ctx.util.convert.temperature.convertUnits(parseFloat(value), ctx.vars.tempUnits, sys.board.valueMaps.tempUnits.getName(state.temps.units));",
188
+ "state.temps.bodies.getItemById(2).temp = temp;",
189
+ "if(state.circuits.getItemById(1).isOn) sys.board.system.setTempsAsync({ waterSensor1: temp });"
190
+ ]
191
+ },
192
+ {
193
+ "topic": "Temperature/Air",
194
+ "description": "The current temperature emitted by the controller for air temperature.",
195
+ "processor": [
196
+ "if(isNaN(parseFloat(value))) return;",
197
+ "let temp = ctx.util.convert.temperature.convertUnits(parseFloat(value), ctx.vars.tempUnits, sys.board.valueMaps.tempUnits.getName(state.temps.units));",
198
+ "sys.board.system.setTempsAsync({ air: temp });"
199
+ ]
200
+ },
201
+ {
202
+ "topic": "Temperature/Solar",
203
+ "description": "The current temperature emitted by the controller for solar.",
204
+ "processor": [
205
+ "if(isNaN(parseFloat(value))) return;",
206
+ "let temp = ctx.util.convert.temperature.convertUnits(parseFloat(value), ctx.vars.tempUnits, sys.board.valueMaps.tempUnits.getName(state.temps.units));",
207
+ "sys.board.system.setTempsAsync({ solarSensor1: temp });"
208
+ ]
209
+ },
210
+ {
211
+ "topic": "Filter_Pump/RPM",
212
+ "description": "The RPM for the first pump",
213
+ "processor": [ "state.pumps.getPumpByAddress(96).rpm = parseInt(value, 10);" ]
214
+ },
215
+ {
216
+ "topic": "Filter_Pump/Watts",
217
+ "description": "The Watts for the first pump",
218
+ "processor": [ "state.pumps.getPumpByAddress(96).watts = parseInt(value, 10);" ]
219
+ },
220
+ {
221
+ "topic": "Filter_Pump/GPM",
222
+ "description": "The flow for the first pump",
223
+ "processor": [ "state.pumps.getPumpByAddress(96).flow = parseInt(value, 10);" ]
224
+ },
225
+ {
226
+ "topic": "Pump_1/RPM",
227
+ "description": "The RPM for aux the pump",
228
+ "processor": [ "state.pumps.getPumpByAddress(97).rpm = parseInt(value, 10);" ]
229
+ },
230
+ {
231
+ "topic": "Pump_1/Watts",
232
+ "description": "The Watts for aux the pump",
233
+ "processor": [ "state.pumps.getPumpByAddress(97).watts = parseInt(value, 10);" ]
234
+ },
235
+ {
236
+ "topic": "Pump_1/GPM",
237
+ "description": "The flow for the aux pump",
238
+ "processor": [ "state.pumps.getPumpByAddress(97).flow = parseInt(value, 10);" ]
239
+ },
240
+ {
241
+ "topic": "Pump_2/RPM",
242
+ "description": "The RPM for aux the pump",
243
+ "processor": [ "state.pumps.getPumpByAddress(98).rpm = parseInt(value, 10);" ]
244
+ },
245
+ {
246
+ "topic": "Pump_2/Watts",
247
+ "description": "The Watts for aux the pump",
248
+ "processor": [ "state.pumps.getPumpByAddress(98).watts = parseInt(value, 10);" ]
249
+ },
250
+ {
251
+ "topic": "Pump_2/GPM",
252
+ "description": "The flow for the aux pump",
253
+ "processor": [ "state.pumps.getPumpByAddress(98).flow = parseInt(value, 10);" ]
254
+ },
255
+ {
256
+ "topic": "Pump_3/RPM",
257
+ "description": "The RPM for aux the pump",
258
+ "processor": [ "state.pumps.getPumpByAddress(99).rpm = parseInt(value, 10);" ]
259
+ },
260
+ {
261
+ "topic": "Pump_3/Watts",
262
+ "description": "The Watts for aux the pump",
263
+ "processor": [ "state.pumps.getPumpByAddress(99).watts = parseInt(value, 10);" ]
264
+ },
265
+ {
266
+ "topic": "Pump_3/GPM",
267
+ "description": "The flow for the aux pump",
268
+ "processor": [ "state.pumps.getPumpByAddress(99).flow = parseInt(value, 10);" ]
269
+ },
270
+ {
271
+ "topic": "Pump_4/RPM",
272
+ "description": "The RPM for aux the pump",
273
+ "processor": [ "state.pumps.getPumpByAddress(100).rpm = parseInt(value, 10);" ]
274
+ },
275
+ {
276
+ "topic": "Pump_4/Watts",
277
+ "description": "The Watts for aux the pump",
278
+ "processor": [ "state.pumps.getPumpByAddress(100).watts = parseInt(value, 10);" ]
279
+ },
280
+ {
281
+ "topic": "Pump_4/GPM",
282
+ "description": "The flow for the aux pump",
283
+ "processor": [ "state.pumps.getPumpByAddress(100).flow = parseInt(value, 10);" ]
284
+ },
285
+ {
286
+ "topic": "Pump_5/RPM",
287
+ "description": "The RPM for aux the pump",
288
+ "processor": [ "state.pumps.getPumpByAddress(101).rpm = parseInt(value, 10);" ]
289
+ },
290
+ {
291
+ "topic": "Pump_5/Watts",
292
+ "description": "The Watts for aux the pump",
293
+ "processor": [ "state.pumps.getPumpByAddress(101).watts = parseInt(value, 10);" ]
294
+ },
295
+ {
296
+ "topic": "Pump_5/GPM",
297
+ "description": "The flow for the aux pump",
298
+ "processor": [ "state.pumps.getPumpByAddress(101).flow = parseInt(value, 10);" ]
299
+ },
300
+ {
301
+ "topic": "Pump_6/RPM",
302
+ "description": "The RPM for aux the pump",
303
+ "processor": [ "state.pumps.getPumpByAddress(102).rpm = parseInt(value, 10);" ]
304
+ },
305
+ {
306
+ "topic": "Pump_6/Watts",
307
+ "description": "The Watts for aux the pump",
308
+ "processor": [ "state.pumps.getPumpByAddress(102).watts = parseInt(value, 10);" ]
309
+ },
310
+ {
311
+ "topic": "Pump_6/GPM",
312
+ "description": "The flow for the aux pump",
313
+ "processor": [ "state.pumps.getPumpByAddress(102).flow = parseInt(value, 10);" ]
314
+ },
315
+ {
316
+ "topic": "Pump_7/RPM",
317
+ "description": "The RPM for aux the pump",
318
+ "processor": [ "state.pumps.getPumpByAddress(103).rpm = parseInt(value, 10);" ]
319
+ },
320
+ {
321
+ "topic": "Pump_7/Watts",
322
+ "description": "The Watts for aux the pump",
323
+ "processor": [ "state.pumps.getPumpByAddress(103).watts = parseInt(value, 10);" ]
324
+ },
325
+ {
326
+ "topic": "Pump_7/GPM",
327
+ "description": "The flow for the aux pump",
328
+ "processor": [ "state.pumps.getPumpByAddress(103).flow = parseInt(value, 10);" ]
329
+ },
330
+ {
331
+ "topic": "SWG/PPM",
332
+ "description": "The salt level for the chlorinator",
333
+ "processor": [ "state.chlorinators.getItemById(1).saltLevel = parseInt(value, 10);" ]
334
+ },
335
+ {
336
+ "topic": "SWG/fullstatus",
337
+ "description": "The current status for the chlorinator",
338
+ "processor": [
339
+ "switch(parseInt(value, 10)) {",
340
+ "case 8: state.chlorinators.getItemById(1).status = 5;",
341
+ "case 9: state.chlorinators.getItemById(1).status = 0;",
342
+ "case 16: state.chlorinators.getItemById(1).status = 4;",
343
+ "case 32: state.chlorinators.getItemById(1).status = 6;",
344
+ "case 64: state.chlorinators.getItemById(1).status = 7;",
345
+ "case 128: state.chlorinators.getItemById(1).status = 8;",
346
+ "case 255: state.chlorinators.getItemById(1).status = 128;",
347
+ "default: state.chlorinators.getItemById(1).status = parseInt(value, 10); }"
348
+ ]
349
+ },
350
+ {
351
+ "topic": "Pool_Heater/enabled",
352
+ "description": "The current heat mode for the pool heater",
353
+ "processor": [
354
+ "if(isNaN(parseInt(value, 10))) return;",
355
+ "sys.bodies.getItemById(1).heatMode = state.temps.bodies.getItemById(1).heatMode = parseInt(value, 10) === 1 ? 2 : 1;"
356
+ ]
357
+ },
358
+ {
359
+ "topic": "Spa_Heater/enabled",
360
+ "description": "The current heat mode for the spa heater",
361
+ "processor": [
362
+ "if(isNaN(parseInt(value, 10))) return;",
363
+ "sys.bodies.getItemById(2).heatMode = state.temps.bodies.getItemById(2).heatMode = parseInt(value, 10) === 1 ? 2 : 1;"
364
+ ]
365
+ },
366
+ {
367
+ "topic": "Pool_Heater/setpoint",
368
+ "description": "The setpoint for the pool body",
369
+ "processor": [
370
+ "if(isNaN(parseFloat(value))) return;",
371
+ "let temp = ctx.util.convert.temperature.convertUnits(parseFloat(value), ctx.vars.tempUnits, sys.board.valueMaps.tempUnits.getName(state.temps.units));",
372
+ "let body = sys.bodies.getItemById(1); sys.board.bodies.setHeatSetpointAsync(body, parseInt(temp, 10));"
373
+ ]
374
+ },
375
+ {
376
+ "topic": "Spa_Heater/setpoint",
377
+ "description": "The setpoint for the spa body",
378
+ "processor": [
379
+ "if(isNaN(parseFloat(value))) return;",
380
+ "let temp = ctx.util.convert.temperature.convertUnits(parseFloat(value), ctx.vars.tempUnits, sys.board.valueMaps.tempUnits.getName(state.temps.units));",
381
+ "let body = sys.bodies.getItemById(2); sys.board.bodies.setHeatSetpointAsync(body, parseInt(temp, 10));"
382
+ ]
383
+ },
384
+ {
385
+ "topic": "Pool_Heater",
386
+ "description": "The heat status for the pool heater",
387
+ "processor": [ "let body = state.temps.bodies.getItemById(1); body.heatStatus = parseInt(value, 10);" ]
388
+ },
389
+ {
390
+ "topic": "Spa_Heater",
391
+ "description": "The heat status for the spa heater",
392
+ "processor": [ "let body = state.temps.bodies.getItemById(2); body.heatStatus = parseInt(value, 10);" ]
393
+ },
394
+
395
+ {
396
+ "topic": "SWG/Percent",
397
+ "description": "The current status for the chlorinator",
398
+ "processor": [ "sys.chlorinators.getItemById(1).poolSetpoint = state.chlorinators.getItemById(1).poolSetpoint = parseInt(value, 10);" ]
399
+ },
400
+ {
401
+ "topic": "Freeze_Protect/setpoint",
402
+ "description": "The current freeze protection setpoint",
403
+ "processor": [
404
+ "let temp = ctx.util.temperature.convertUnits(parseFloat(value), ctx.vars.tempUnits, sys.board.valueMaps.tempUnits.getName(state.temps.units));",
405
+ "sys.general.options.freezeThreshold = parseInt(Math.round(temp), 10);"
406
+ ]
407
+ },
408
+ {
409
+ "topic": "Freeze_Protect",
410
+ "description": "The current freeze protection setpoint",
411
+ "processor": [ "state.freeze = parseInt(value, 10) === 1;" ]
412
+ }
413
+ ],
414
+ "events": [
415
+ {
416
+ "name": "config",
417
+ "description": "Don't flood the MQTT bus.",
418
+ "enabled": false
419
+ },
420
+ {
421
+ "name": "circuit",
422
+ "description": "Populate the circuits topics",
423
+ "topics": [
424
+ {
425
+ "topic": "Filter_Pump/set",
426
+ "message": "@bind=data.isOn ? 1 : 0;",
427
+ "description": "Bind the state",
428
+ "filter": "@bind=data.id; === 6;"
429
+ },
430
+ {
431
+ "topic": "Spa_Mode/set",
432
+ "message": "@bind=data.isOn ? 1 : 0;",
433
+ "description": "Bind the state",
434
+ "filter": "@bind=data.id; === 1;"
435
+ },
436
+ {
437
+ "topic": "Aux_1/set",
438
+ "message": "@bind=data.isOn ? 1 : 0;",
439
+ "description": "Bind the state",
440
+ "filter": "@bind=data.id; === 2;"
441
+ },
442
+ {
443
+ "topic": "Aux_2/set",
444
+ "message": "@bind=data.isOn ? 1 : 0;",
445
+ "description": "Bind the state",
446
+ "filter": "@bind=data.id; === 3;"
447
+ },
448
+ {
449
+ "topic": "Aux_3/set",
450
+ "message": "@bind=data.isOn ? 1 : 0;",
451
+ "description": "Bind the state",
452
+ "filter": "@bind=data.id; === 4;"
453
+ },
454
+ {
455
+ "topic": "Aux_4/set",
456
+ "message": "@bind=data.isOn ? 1 : 0;",
457
+ "description": "Bind the state",
458
+ "filter": "@bind=data.id; === 5;"
459
+ },
460
+ {
461
+ "topic": "Aux_5/set",
462
+ "message": "@bind=data.isOn ? 1 : 0;",
463
+ "description": "Bind the state",
464
+ "filter": "@bind=data.id; === 7;"
465
+ },
466
+ {
467
+ "topic": "Aux_6/set",
468
+ "message": "@bind=data.isOn ? 1 : 0;",
469
+ "description": "Bind the state",
470
+ "filter": "@bind=data.id; === 8;"
471
+ },
472
+ {
473
+ "topic": "Aux_7/set",
474
+ "message": "@bind=data.isOn ? 1 : 0;",
475
+ "description": "Bind the state",
476
+ "filter": "@bind=data.id; === 9;"
477
+ },
478
+ {
479
+ "topic": "Aux_8/set",
480
+ "message": "@bind=data.isOn; ? 1 : 0;",
481
+ "description": "Bind the state",
482
+ "filter": "@bind=data.id === 10;"
483
+ }
484
+ ]
485
+ },
486
+ {
487
+ "name": "feature",
488
+ "description": "Populate the features topics",
489
+ "topics": [
490
+ {
491
+ "topic": "Aux_B@bind=data.id - 128;/set",
492
+ "message": "@bind=data.isOn ? 1 : 0;",
493
+ "description": "Bind the state"
494
+ }
495
+ ]
496
+ },
497
+ {
498
+ "name": "body",
499
+ "description": "Populate the body topic",
500
+ "filter": "@bind=data.isActive;",
501
+ "topics": [
502
+ {
503
+ "topic": "Pool_Heater/setpoint/set",
504
+ "message": "@bind=data.setPoint;",
505
+ "description": "Set the heat setpoint for the pool",
506
+ "filter": "@bind=data.id === 1;",
507
+ "processor": [
508
+ "let units = sys.board.valueMaps.tempUnits.getName(state.temps.units);",
509
+ "return ctx.util.roundNumber(ctx.util.convert.temperature.convertUnits(data.setPoint, units, ctx.vars.tempUnits), ctx.vars.tempPrecision);"
510
+ ]
511
+ },
512
+ {
513
+ "topic": "Spa_Heater/setpoint/set",
514
+ "message": "@bind=data.setPoint;",
515
+ "description": "Set the heat setpoint for the spa",
516
+ "filter": "@bind=data.id === 2;",
517
+ "processor": [
518
+ "let units = sys.board.valueMaps.tempUnits.getName(state.temps.units);",
519
+ "return ctx.util.roundNumber(ctx.util.convert.temperature.convertUnits(data.setPoint, units, ctx.vars.tempUnits), ctx.vars.tempPrecision);"
520
+ ]
521
+ },
522
+ {
523
+ "topic": "Pool_Heater/set",
524
+ "message": "@bind=data.heatMode.val; === 2 ? 1 : 0",
525
+ "description": "Bind the state",
526
+ "filter": "@bind=data.id === 1;",
527
+ "processor": [
528
+ "return typeof data.heatMode !== 'undefined' && data.heatMode.val === 2 ? 1 : 0;"
529
+ ]
530
+ },
531
+ {
532
+ "topic": "Spa_Heater/set",
533
+ "message": "@bind=data.heatMode.val; === 2 ? 1 : 0",
534
+ "description": "Bind the state",
535
+ "filter": "@bind=data.id === 2;",
536
+ "processor": [
537
+ "return typeof data.heatMode !== 'undefined' && data.heatMode.val === 2 ? 1 : 0;"
538
+ ]
539
+ }
540
+
541
+ ]
542
+ },
543
+ {
544
+ "name": "chlorinator",
545
+ "description": "Populate the chlorinator topic",
546
+ "topics": [
547
+ {
548
+ "topic": "SWG/Percent/set",
549
+ "message": "@bind=data.superChlor ? 100 : data.disabled ? 0 : data.poolSetpoint;",
550
+ "description": "Bind the setpoint topic. Unfortunately aqualink only supports one setpoint."
551
+ }
552
+ ]
553
+ },
554
+ {
555
+ "name": "pump",
556
+ "description": "Populate the pumps topic. We will need to figure this one out. Perhaps if the RS485 comm port is disabled we don't try to send anything.",
557
+ "topics": []
558
+ }
559
+ ]
560
560
  }