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.
- package/.eslintrc.json +36 -36
- package/.github/ISSUE_TEMPLATE/1-bug-report.yml +84 -84
- package/.github/ISSUE_TEMPLATE/2-docs.md +12 -12
- package/.github/ISSUE_TEMPLATE/3-proposal.md +28 -28
- package/.github/ISSUE_TEMPLATE/config.yml +8 -8
- package/.github/copilot-instructions.md +63 -63
- package/.github/workflows/ghcr-publish.yml +67 -67
- package/157_issues.md +101 -0
- package/AGENTS.md +613 -0
- package/CONTRIBUTING.md +74 -74
- package/Changelog +292 -284
- package/Dockerfile +62 -62
- package/Gruntfile.js +40 -40
- package/LICENSE +661 -661
- package/README.md +329 -309
- package/anslq25/MessagesMock.ts +221 -221
- package/anslq25/boards/MockBoardFactory.ts +49 -49
- package/anslq25/boards/MockEasyTouchBoard.ts +696 -696
- package/anslq25/boards/MockSystemBoard.ts +216 -216
- package/anslq25/chemistry/MockChlorinator.ts +98 -98
- package/anslq25/pumps/MockPump.ts +83 -83
- package/app.ts +115 -115
- package/config/Config.ts +0 -0
- package/config/VersionCheck.ts +0 -0
- package/controller/Constants.ts +809 -805
- package/controller/Equipment.ts +2737 -2664
- package/controller/Errors.ts +181 -181
- package/controller/Lockouts.ts +549 -549
- package/controller/State.ts +3746 -3701
- package/controller/boards/AquaLinkBoard.ts +1175 -1003
- package/controller/boards/BoardFactory.ts +53 -53
- package/controller/boards/EasyTouchBoard.ts +3246 -3202
- package/controller/boards/IntelliCenterBoard.ts +4581 -3899
- package/controller/boards/IntelliComBoard.ts +69 -69
- package/controller/boards/IntelliTouchBoard.ts +382 -382
- package/controller/boards/NixieBoard.ts +1947 -1944
- package/controller/boards/SunTouchBoard.ts +401 -400
- package/controller/boards/SystemBoard.ts +5303 -5268
- package/controller/comms/Comms.ts +1278 -1255
- package/controller/comms/ScreenLogic.ts +1665 -1665
- package/controller/comms/messages/Messages.ts +1627 -1406
- package/controller/comms/messages/config/ChlorinatorMessage.ts +5 -0
- package/controller/comms/messages/config/CircuitGroupMessage.ts +0 -0
- package/controller/comms/messages/config/CircuitMessage.ts +0 -0
- package/controller/comms/messages/config/ConfigMessage.ts +6 -0
- package/controller/comms/messages/config/CoverMessage.ts +0 -0
- package/controller/comms/messages/config/CustomNameMessage.ts +31 -31
- package/controller/comms/messages/config/EquipmentMessage.ts +250 -210
- package/controller/comms/messages/config/ExternalMessage.ts +1051 -903
- package/controller/comms/messages/config/FeatureMessage.ts +0 -0
- package/controller/comms/messages/config/GeneralMessage.ts +65 -0
- package/controller/comms/messages/config/HeaterMessage.ts +0 -0
- package/controller/comms/messages/config/IntellichemMessage.ts +0 -0
- package/controller/comms/messages/config/OptionsMessage.ts +207 -174
- package/controller/comms/messages/config/PumpMessage.ts +427 -421
- package/controller/comms/messages/config/RemoteMessage.ts +0 -0
- package/controller/comms/messages/config/ScheduleMessage.ts +401 -390
- package/controller/comms/messages/config/SecurityMessage.ts +37 -13
- package/controller/comms/messages/config/ValveMessage.ts +0 -0
- package/controller/comms/messages/status/ChlorinatorStateMessage.ts +0 -0
- package/controller/comms/messages/status/EquipmentStateMessage.ts +940 -822
- package/controller/comms/messages/status/HeaterStateMessage.ts +147 -135
- package/controller/comms/messages/status/IntelliChemStateMessage.ts +448 -448
- package/controller/comms/messages/status/IntelliValveStateMessage.ts +36 -36
- package/controller/comms/messages/status/NeptuneModbusStateMessage.ts +217 -0
- package/controller/comms/messages/status/PumpStateMessage.ts +0 -0
- package/controller/comms/messages/status/RegalModbusStateMessage.ts +410 -410
- package/controller/comms/messages/status/VersionMessage.ts +152 -41
- package/controller/nixie/Nixie.ts +173 -173
- package/controller/nixie/NixieEquipment.ts +104 -104
- package/controller/nixie/bodies/Body.ts +120 -120
- package/controller/nixie/bodies/Filter.ts +135 -135
- package/controller/nixie/chemistry/ChemController.ts +2756 -2724
- package/controller/nixie/chemistry/ChemDoser.ts +806 -806
- package/controller/nixie/chemistry/Chlorinator.ts +367 -367
- package/controller/nixie/circuits/Circuit.ts +478 -478
- package/controller/nixie/heaters/Heater.ts +843 -834
- package/controller/nixie/pumps/Pump.ts +1336 -1193
- package/controller/nixie/schedules/Schedule.ts +401 -401
- package/controller/nixie/valves/Valve.ts +170 -170
- package/defaultConfig.json +352 -352
- package/docker-compose.yml +32 -31
- package/logger/DataLogger.ts +448 -448
- package/logger/Logger.ts +459 -436
- package/package.json +58 -58
- package/sendSocket.js +32 -32
- package/tsconfig.json +26 -25
- package/types/express-multer.d.ts +32 -32
- package/web/Server.ts +1939 -1927
- package/web/bindings/aqualinkD.json +559 -559
- package/web/bindings/influxDB.json +1066 -1066
- package/web/bindings/mqtt.json +721 -721
- package/web/bindings/mqttAlt.json +746 -746
- package/web/bindings/rulesManager.json +54 -54
- package/web/bindings/smartThings-Hubitat.json +31 -31
- package/web/bindings/valveRelays.json +20 -20
- package/web/bindings/vera.json +25 -25
- package/web/interfaces/baseInterface.ts +188 -188
- package/web/interfaces/httpInterface.ts +148 -148
- package/web/interfaces/influxInterface.ts +283 -283
- package/web/interfaces/mqttInterface.ts +695 -695
- package/web/interfaces/ruleInterface.ts +101 -87
- package/web/services/config/Config.ts +1212 -1053
- package/web/services/config/ConfigSocket.ts +0 -0
- package/web/services/state/State.ts +21 -0
- package/web/services/state/StateSocket.ts +28 -0
- package/web/services/utilities/Utilities.ts +233 -233
|
@@ -1,421 +1,427 @@
|
|
|
1
|
-
/* nodejs-poolController. An application to control pool equipment.
|
|
2
|
-
Copyright (C) 2016, 2017, 2018, 2019, 2020, 2021, 2022.
|
|
3
|
-
Russell Goldin, tagyoureit. russ.goldin@gmail.com
|
|
4
|
-
|
|
5
|
-
This program is free software: you can redistribute it and/or modify
|
|
6
|
-
it under the terms of the GNU Affero General Public License as
|
|
7
|
-
published by the Free Software Foundation, either version 3 of the
|
|
8
|
-
License, or (at your option) any later version.
|
|
9
|
-
|
|
10
|
-
This program is distributed in the hope that it will be useful,
|
|
11
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
GNU Affero General Public License for more details.
|
|
14
|
-
|
|
15
|
-
You should have received a copy of the GNU Affero General Public License
|
|
16
|
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
-
*/
|
|
18
|
-
import {Inbound} from "../Messages";
|
|
19
|
-
import {sys, Pump, PumpCircuit} from "../../../Equipment";
|
|
20
|
-
import {state, CircuitState} from "../../../State";
|
|
21
|
-
import {ControllerType} from "../../../Constants";
|
|
22
|
-
import { logger } from "../../../../logger/Logger";
|
|
23
|
-
export class PumpMessage {
|
|
24
|
-
public static process(msg: Inbound): void {
|
|
25
|
-
switch (sys.controllerType) {
|
|
26
|
-
case ControllerType.IntelliCenter:
|
|
27
|
-
PumpMessage.processIntelliCenterPump(msg);
|
|
28
|
-
break;
|
|
29
|
-
case ControllerType.SunTouch:
|
|
30
|
-
case ControllerType.IntelliCom:
|
|
31
|
-
case ControllerType.EasyTouch:
|
|
32
|
-
case ControllerType.IntelliTouch:
|
|
33
|
-
PumpMessage.processPumpConfig_IT(msg);
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
public static processPumpConfig_IT(msg: Inbound) {
|
|
38
|
-
// packet 24/27/152/155 - Pump Config: IntelliTouch. These will always be addressable pumps ds & ss are not included.
|
|
39
|
-
const pumpId = msg.extractPayloadByte(0);
|
|
40
|
-
let type = msg.extractPayloadByte(1); // Avoid setting this then setting it back if we are mapping to a different value.
|
|
41
|
-
let isActive = type !== 0 && pumpId <= sys.equipment.maxPumps;
|
|
42
|
-
// RKS: 04-14-21 - Only create the pump if it is available. If the pump was previously defined as another type
|
|
43
|
-
// then it will be removed and recreated.
|
|
44
|
-
// RKS: 05-06-23 - The original code did not search for the pump by its address. This is not correct.
|
|
45
|
-
let pump: Pump = sys.pumps.getPumpByAddress(95 + pumpId, isActive);
|
|
46
|
-
if(isActive) {
|
|
47
|
-
// Remap the combination pump types.
|
|
48
|
-
switch (type) {
|
|
49
|
-
case 0:
|
|
50
|
-
case 64:
|
|
51
|
-
case 169:
|
|
52
|
-
break;
|
|
53
|
-
case 255:
|
|
54
|
-
case 128:
|
|
55
|
-
case 134:
|
|
56
|
-
type = 128;
|
|
57
|
-
break;
|
|
58
|
-
default:
|
|
59
|
-
type = 1;
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
if (pump.type !== type) {
|
|
63
|
-
sys.pumps.removePumpByAddress(95 + pumpId);
|
|
64
|
-
if (isActive) pump = sys.pumps.getPumpByAddress(95 + pumpId, isActive);
|
|
65
|
-
}
|
|
66
|
-
pump.address = pumpId + 95;
|
|
67
|
-
pump.master = 0;
|
|
68
|
-
switch (type) {
|
|
69
|
-
case 0: // none
|
|
70
|
-
pump.type = 0;
|
|
71
|
-
pump.isActive = false;
|
|
72
|
-
break;
|
|
73
|
-
case 64: // vsf
|
|
74
|
-
pump.type = type;
|
|
75
|
-
pump.isActive = true;
|
|
76
|
-
PumpMessage.processVSF_IT(msg);
|
|
77
|
-
break;
|
|
78
|
-
case 255: // vs 3050 on old panels.
|
|
79
|
-
case 128: // vs
|
|
80
|
-
case 134: // vs Ultra Efficiency
|
|
81
|
-
pump.type = 128;
|
|
82
|
-
pump.isActive = true;
|
|
83
|
-
PumpMessage.processVS_IT(msg);
|
|
84
|
-
break;
|
|
85
|
-
case 169: // vs+svrs
|
|
86
|
-
pump.type = 169;
|
|
87
|
-
pump.isActive = true;
|
|
88
|
-
PumpMessage.processVS_IT(msg);
|
|
89
|
-
break;
|
|
90
|
-
default: // vf - type is the background circuit
|
|
91
|
-
pump.type = 1; // force to type 1?
|
|
92
|
-
pump.isActive = true;
|
|
93
|
-
PumpMessage.processVF_IT(msg);
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
if (typeof pump.name === 'undefined') pump.name = sys.board.valueMaps.pumpTypes.get(pump.type).desc;
|
|
97
|
-
const spump = state.pumps.getItemById(pump.id, true);
|
|
98
|
-
spump.name = pump.name;
|
|
99
|
-
spump.type = pump.type;
|
|
100
|
-
spump.isActive = pump.isActive;
|
|
101
|
-
spump.status = 0;
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
// RKS: Remove any pump that is not defined in the system.
|
|
105
|
-
sys.pumps.removeItemById(pumpId);
|
|
106
|
-
state.pumps.removeItemById(pumpId);
|
|
107
|
-
}
|
|
108
|
-
msg.isProcessed = true;
|
|
109
|
-
}
|
|
110
|
-
private static processIntelliCenterPump(msg: Inbound) {
|
|
111
|
-
let pumpId: number;
|
|
112
|
-
let pump: Pump;
|
|
113
|
-
let msgId: number = msg.extractPayloadByte(1);
|
|
114
|
-
//
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
circuit.
|
|
147
|
-
circuit.
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
case
|
|
161
|
-
|
|
162
|
-
break;
|
|
163
|
-
case
|
|
164
|
-
PumpMessage.
|
|
165
|
-
break;
|
|
166
|
-
case
|
|
167
|
-
PumpMessage.
|
|
168
|
-
break;
|
|
169
|
-
case
|
|
170
|
-
PumpMessage.
|
|
171
|
-
break;
|
|
172
|
-
case
|
|
173
|
-
PumpMessage.
|
|
174
|
-
break;
|
|
175
|
-
case
|
|
176
|
-
PumpMessage.
|
|
177
|
-
break;
|
|
178
|
-
case
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
case
|
|
182
|
-
case
|
|
183
|
-
case
|
|
184
|
-
case
|
|
185
|
-
case
|
|
186
|
-
|
|
187
|
-
case
|
|
188
|
-
|
|
189
|
-
break;
|
|
190
|
-
case
|
|
191
|
-
PumpMessage.
|
|
192
|
-
break;
|
|
193
|
-
case
|
|
194
|
-
PumpMessage.
|
|
195
|
-
break;
|
|
196
|
-
case
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
case
|
|
200
|
-
case
|
|
201
|
-
case
|
|
202
|
-
case
|
|
203
|
-
case
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
break;
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
let
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
if (pumpId <= sys.equipment.maxPumps) {
|
|
302
|
-
let pump = sys.pumps.getItemById(pumpId);
|
|
303
|
-
pump.name = msg.extractPayloadString(
|
|
304
|
-
if (pump.isActive) state.pumps.getItemById(pumpId).name = pump.name;
|
|
305
|
-
pumpId++;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
//
|
|
316
|
-
// 1
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
//
|
|
320
|
-
//
|
|
321
|
-
//
|
|
322
|
-
//
|
|
323
|
-
//
|
|
324
|
-
//
|
|
325
|
-
//
|
|
326
|
-
//
|
|
327
|
-
//
|
|
328
|
-
//
|
|
329
|
-
//
|
|
330
|
-
//
|
|
331
|
-
//
|
|
332
|
-
//
|
|
333
|
-
//
|
|
334
|
-
//
|
|
335
|
-
//
|
|
336
|
-
//
|
|
337
|
-
//
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
pump.circuits.
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
pump.
|
|
384
|
-
pump.
|
|
385
|
-
pump.
|
|
386
|
-
pump.
|
|
387
|
-
pump.
|
|
388
|
-
pump.
|
|
389
|
-
pump.
|
|
390
|
-
pump.
|
|
391
|
-
pump.
|
|
392
|
-
pump.
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
1
|
+
/* nodejs-poolController. An application to control pool equipment.
|
|
2
|
+
Copyright (C) 2016, 2017, 2018, 2019, 2020, 2021, 2022.
|
|
3
|
+
Russell Goldin, tagyoureit. russ.goldin@gmail.com
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify
|
|
6
|
+
it under the terms of the GNU Affero General Public License as
|
|
7
|
+
published by the Free Software Foundation, either version 3 of the
|
|
8
|
+
License, or (at your option) any later version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU Affero General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import {Inbound} from "../Messages";
|
|
19
|
+
import {sys, Pump, PumpCircuit} from "../../../Equipment";
|
|
20
|
+
import {state, CircuitState} from "../../../State";
|
|
21
|
+
import {ControllerType} from "../../../Constants";
|
|
22
|
+
import { logger } from "../../../../logger/Logger";
|
|
23
|
+
export class PumpMessage {
|
|
24
|
+
public static process(msg: Inbound): void {
|
|
25
|
+
switch (sys.controllerType) {
|
|
26
|
+
case ControllerType.IntelliCenter:
|
|
27
|
+
PumpMessage.processIntelliCenterPump(msg);
|
|
28
|
+
break;
|
|
29
|
+
case ControllerType.SunTouch:
|
|
30
|
+
case ControllerType.IntelliCom:
|
|
31
|
+
case ControllerType.EasyTouch:
|
|
32
|
+
case ControllerType.IntelliTouch:
|
|
33
|
+
PumpMessage.processPumpConfig_IT(msg);
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
public static processPumpConfig_IT(msg: Inbound) {
|
|
38
|
+
// packet 24/27/152/155 - Pump Config: IntelliTouch. These will always be addressable pumps ds & ss are not included.
|
|
39
|
+
const pumpId = msg.extractPayloadByte(0);
|
|
40
|
+
let type = msg.extractPayloadByte(1); // Avoid setting this then setting it back if we are mapping to a different value.
|
|
41
|
+
let isActive = type !== 0 && pumpId <= sys.equipment.maxPumps;
|
|
42
|
+
// RKS: 04-14-21 - Only create the pump if it is available. If the pump was previously defined as another type
|
|
43
|
+
// then it will be removed and recreated.
|
|
44
|
+
// RKS: 05-06-23 - The original code did not search for the pump by its address. This is not correct.
|
|
45
|
+
let pump: Pump = sys.pumps.getPumpByAddress(95 + pumpId, isActive);
|
|
46
|
+
if(isActive) {
|
|
47
|
+
// Remap the combination pump types.
|
|
48
|
+
switch (type) {
|
|
49
|
+
case 0:
|
|
50
|
+
case 64:
|
|
51
|
+
case 169:
|
|
52
|
+
break;
|
|
53
|
+
case 255:
|
|
54
|
+
case 128:
|
|
55
|
+
case 134:
|
|
56
|
+
type = 128;
|
|
57
|
+
break;
|
|
58
|
+
default:
|
|
59
|
+
type = 1;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
if (pump.type !== type) {
|
|
63
|
+
sys.pumps.removePumpByAddress(95 + pumpId);
|
|
64
|
+
if (isActive) pump = sys.pumps.getPumpByAddress(95 + pumpId, isActive);
|
|
65
|
+
}
|
|
66
|
+
pump.address = pumpId + 95;
|
|
67
|
+
pump.master = 0;
|
|
68
|
+
switch (type) {
|
|
69
|
+
case 0: // none
|
|
70
|
+
pump.type = 0;
|
|
71
|
+
pump.isActive = false;
|
|
72
|
+
break;
|
|
73
|
+
case 64: // vsf
|
|
74
|
+
pump.type = type;
|
|
75
|
+
pump.isActive = true;
|
|
76
|
+
PumpMessage.processVSF_IT(msg);
|
|
77
|
+
break;
|
|
78
|
+
case 255: // vs 3050 on old panels.
|
|
79
|
+
case 128: // vs
|
|
80
|
+
case 134: // vs Ultra Efficiency
|
|
81
|
+
pump.type = 128;
|
|
82
|
+
pump.isActive = true;
|
|
83
|
+
PumpMessage.processVS_IT(msg);
|
|
84
|
+
break;
|
|
85
|
+
case 169: // vs+svrs
|
|
86
|
+
pump.type = 169;
|
|
87
|
+
pump.isActive = true;
|
|
88
|
+
PumpMessage.processVS_IT(msg);
|
|
89
|
+
break;
|
|
90
|
+
default: // vf - type is the background circuit
|
|
91
|
+
pump.type = 1; // force to type 1?
|
|
92
|
+
pump.isActive = true;
|
|
93
|
+
PumpMessage.processVF_IT(msg);
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
if (typeof pump.name === 'undefined') pump.name = sys.board.valueMaps.pumpTypes.get(pump.type).desc;
|
|
97
|
+
const spump = state.pumps.getItemById(pump.id, true);
|
|
98
|
+
spump.name = pump.name;
|
|
99
|
+
spump.type = pump.type;
|
|
100
|
+
spump.isActive = pump.isActive;
|
|
101
|
+
spump.status = 0;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
// RKS: Remove any pump that is not defined in the system.
|
|
105
|
+
sys.pumps.removeItemById(pumpId);
|
|
106
|
+
state.pumps.removeItemById(pumpId);
|
|
107
|
+
}
|
|
108
|
+
msg.isProcessed = true;
|
|
109
|
+
}
|
|
110
|
+
private static processIntelliCenterPump(msg: Inbound) {
|
|
111
|
+
let pumpId: number;
|
|
112
|
+
let pump: Pump;
|
|
113
|
+
let msgId: number = msg.extractPayloadByte(1);
|
|
114
|
+
// IntelliCenter v3 uses big-endian 16-bit values for pump speeds/flows.
|
|
115
|
+
const useBigEndian = sys.controllerType === ControllerType.IntelliCenter && sys.equipment.isIntellicenterV3;
|
|
116
|
+
const readInt = (ndx: number) => useBigEndian ? msg.extractPayloadIntBE(ndx) : msg.extractPayloadInt(ndx);
|
|
117
|
+
// First process the pump types. This will allow us to add or remove any installed pumps. All subsequent messages will not create pumps in the collection.
|
|
118
|
+
if (msgId === 4) PumpMessage.processPumpType(msg);
|
|
119
|
+
if (msgId <= 15) {
|
|
120
|
+
let circuitId = 1;
|
|
121
|
+
pumpId = msgId + 1;
|
|
122
|
+
pump = sys.pumps.getItemById(pumpId);
|
|
123
|
+
if (pump.type === 1) { // If this is a single speed pump it will have the body stored in the first circuit position. All other pumps have no
|
|
124
|
+
// reference to the body.
|
|
125
|
+
pump.body = msg.extractPayloadByte(34);
|
|
126
|
+
// Clear the circuits as there should be none.
|
|
127
|
+
pump.circuits.clear();
|
|
128
|
+
}
|
|
129
|
+
else if (pump.type !== 0 && typeof pump.type !== 'undefined') {
|
|
130
|
+
for (let i = 34; i < msg.payload.length && circuitId <= sys.board.valueMaps.pumpTypes.get(pump.type).maxCircuits; i++) {
|
|
131
|
+
let circuit = msg.extractPayloadByte(i);
|
|
132
|
+
if (circuit !== 255) pump.circuits.getItemById(circuitId++, true).circuit = circuit + 1;
|
|
133
|
+
else pump.circuits.removeItemById(circuitId++);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// Speed/Flow
|
|
137
|
+
if (pump.type > 2) {
|
|
138
|
+
// Filter out the single speed and dual speed pumps. We have no flow or speed for these.
|
|
139
|
+
circuitId = 1;
|
|
140
|
+
for (let i = 18; i < msg.payload.length && circuitId <= sys.board.valueMaps.pumpTypes.get(pump.type).maxCircuits;) {
|
|
141
|
+
let circuit: PumpCircuit = pump.circuits.getItemById(circuitId);
|
|
142
|
+
let rate = readInt(i);
|
|
143
|
+
// If the rate is < 450 then this must be a flow based value.
|
|
144
|
+
if (rate < 450) {
|
|
145
|
+
circuit.flow = rate;
|
|
146
|
+
circuit.units = 1;
|
|
147
|
+
circuit.speed = undefined;
|
|
148
|
+
} else {
|
|
149
|
+
circuit.speed = rate;
|
|
150
|
+
circuit.units = 0;
|
|
151
|
+
circuit.flow = undefined;
|
|
152
|
+
}
|
|
153
|
+
i += 2;
|
|
154
|
+
circuitId++;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
msg.isProcessed = true;
|
|
159
|
+
switch (msgId) {
|
|
160
|
+
case 0:
|
|
161
|
+
msg.isProcessed = true;
|
|
162
|
+
break;
|
|
163
|
+
case 1:
|
|
164
|
+
PumpMessage.processFlowStepSize(msg);
|
|
165
|
+
break;
|
|
166
|
+
case 2:
|
|
167
|
+
PumpMessage.processMinFlow(msg);
|
|
168
|
+
break;
|
|
169
|
+
case 3:
|
|
170
|
+
PumpMessage.processMaxFlow(msg);
|
|
171
|
+
break;
|
|
172
|
+
case 5:
|
|
173
|
+
PumpMessage.processAddress(msg);
|
|
174
|
+
break;
|
|
175
|
+
case 6:
|
|
176
|
+
PumpMessage.processPrimingTime(msg);
|
|
177
|
+
break;
|
|
178
|
+
case 7:
|
|
179
|
+
PumpMessage.processSpeedStepSize(msg);
|
|
180
|
+
break;
|
|
181
|
+
case 8: // Unknown
|
|
182
|
+
case 9:
|
|
183
|
+
case 10:
|
|
184
|
+
case 11:
|
|
185
|
+
case 12:
|
|
186
|
+
case 13:
|
|
187
|
+
case 14:
|
|
188
|
+
case 15:
|
|
189
|
+
break;
|
|
190
|
+
case 16:
|
|
191
|
+
PumpMessage.processMinSpeed(msg);
|
|
192
|
+
break;
|
|
193
|
+
case 17:
|
|
194
|
+
PumpMessage.processMaxSpeed(msg);
|
|
195
|
+
break;
|
|
196
|
+
case 18:
|
|
197
|
+
PumpMessage.processPrimingSpeed(msg);
|
|
198
|
+
break;
|
|
199
|
+
case 19: // Pump names
|
|
200
|
+
case 20:
|
|
201
|
+
case 21:
|
|
202
|
+
case 22:
|
|
203
|
+
case 23:
|
|
204
|
+
case 24:
|
|
205
|
+
case 25:
|
|
206
|
+
case 26:
|
|
207
|
+
PumpMessage.processPumpNames(msg);
|
|
208
|
+
break;
|
|
209
|
+
default:
|
|
210
|
+
logger.debug(`Unprocessed Config Message ${msg.toPacket()}`)
|
|
211
|
+
break;
|
|
212
|
+
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
private static processFlowStepSize(msg: Inbound) {
|
|
216
|
+
let pumpId = 1;
|
|
217
|
+
for (let i = 2; i < msg.payload.length && pumpId <= sys.equipment.maxPumps; i++) {
|
|
218
|
+
sys.pumps.getItemById(pumpId++).flowStepSize = msg.extractPayloadByte(i);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
private static processMinFlow(msg: Inbound) {
|
|
222
|
+
let pumpId = 1;
|
|
223
|
+
for (let i = 2; i < msg.payload.length && pumpId <= sys.equipment.maxPumps; i++) {
|
|
224
|
+
sys.pumps.getItemById(pumpId++).minFlow = msg.extractPayloadByte(i);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
private static processMaxFlow(msg: Inbound) {
|
|
228
|
+
let pumpId = 1;
|
|
229
|
+
for (let i = 2; i < msg.payload.length && pumpId <= sys.equipment.maxPumps; i++) {
|
|
230
|
+
sys.pumps.getItemById(pumpId++).maxFlow = msg.extractPayloadByte(i);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
private static processPumpType(msg: Inbound) {
|
|
234
|
+
let pumpId = 1;
|
|
235
|
+
for (let i = 2; i < msg.payload.length && pumpId <= sys.equipment.maxPumps; i++) {
|
|
236
|
+
let type = msg.extractPayloadByte(i);
|
|
237
|
+
let pump: Pump = sys.pumps.getItemById(pumpId++, type !== 0);
|
|
238
|
+
if (type === 0) {
|
|
239
|
+
sys.pumps.removeItemById(pump.id); // Remove the pump if we don't need it.
|
|
240
|
+
state.pumps.removeItemById(pump.id);
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
if (pump.type !== type) {
|
|
244
|
+
let ptype = sys.board.valueMaps.pumpTypes.transform(type);
|
|
245
|
+
if (ptype.name === 'ss') pump.circuits.clear();
|
|
246
|
+
pump.model = 0;
|
|
247
|
+
}
|
|
248
|
+
if (typeof pump.model === 'undefined') pump.model = 0;
|
|
249
|
+
pump.type = type;
|
|
250
|
+
pump.master = 0;
|
|
251
|
+
let spump = state.pumps.getItemById(pump.id, true);
|
|
252
|
+
spump.type = pump.type;
|
|
253
|
+
spump.isActive = pump.isActive = true;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
private static processAddress(msg: Inbound) {
|
|
258
|
+
let pumpId = 1;
|
|
259
|
+
for (let i = 2; i < msg.payload.length && pumpId <= sys.equipment.maxPumps; i++) {
|
|
260
|
+
sys.pumps.getItemById(pumpId++).address = msg.extractPayloadByte(i);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
private static processPrimingTime(msg: Inbound) {
|
|
264
|
+
let pumpId = 1;
|
|
265
|
+
for (let i = 2; i < msg.payload.length && pumpId <= sys.equipment.maxPumps; i++) {
|
|
266
|
+
sys.pumps.getItemById(pumpId++).primingTime = msg.extractPayloadByte(i);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
private static processSpeedStepSize(msg: Inbound) {
|
|
270
|
+
let pumpId = 1;
|
|
271
|
+
for (let i = 2; i < msg.payload.length && pumpId <= sys.equipment.maxPumps; i++) {
|
|
272
|
+
sys.pumps.getItemById(pumpId++).speedStepSize = msg.extractPayloadByte(i) * 10;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
private static processMinSpeed(msg: Inbound) {
|
|
276
|
+
let pumpId = 1;
|
|
277
|
+
const useBigEndian = sys.controllerType === ControllerType.IntelliCenter && sys.equipment.isIntellicenterV3;
|
|
278
|
+
for (let i = 2; i < msg.payload.length && pumpId <= sys.equipment.maxPumps;) {
|
|
279
|
+
sys.pumps.getItemById(pumpId++).minSpeed = useBigEndian ? msg.extractPayloadIntBE(i) : msg.extractPayloadInt(i);
|
|
280
|
+
i += 2;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
private static processMaxSpeed(msg: Inbound) {
|
|
284
|
+
let pumpId = 1;
|
|
285
|
+
const useBigEndian = sys.controllerType === ControllerType.IntelliCenter && sys.equipment.isIntellicenterV3;
|
|
286
|
+
for (let i = 2; i < msg.payload.length && pumpId <= sys.equipment.maxPumps;) {
|
|
287
|
+
sys.pumps.getItemById(pumpId++).maxSpeed = useBigEndian ? msg.extractPayloadIntBE(i) : msg.extractPayloadInt(i);
|
|
288
|
+
i += 2;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
private static processPrimingSpeed(msg: Inbound) {
|
|
292
|
+
let pumpId = 1;
|
|
293
|
+
const useBigEndian = sys.controllerType === ControllerType.IntelliCenter && sys.equipment.isIntellicenterV3;
|
|
294
|
+
for (let i = 2; i < msg.payload.length && pumpId <= sys.equipment.maxPumps;) {
|
|
295
|
+
sys.pumps.getItemById(pumpId++).primingSpeed = useBigEndian ? msg.extractPayloadIntBE(i) : msg.extractPayloadInt(i);
|
|
296
|
+
i += 2;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
private static processPumpNames(msg: Inbound) {
|
|
300
|
+
let pumpId = (msg.extractPayloadByte(1) - 19) * 2 + 1;
|
|
301
|
+
if (pumpId <= sys.equipment.maxPumps) {
|
|
302
|
+
let pump = sys.pumps.getItemById(pumpId);
|
|
303
|
+
pump.name = msg.extractPayloadString(2, 16);
|
|
304
|
+
if (pump.isActive) state.pumps.getItemById(pumpId).name = pump.name;
|
|
305
|
+
pumpId++;
|
|
306
|
+
}
|
|
307
|
+
if (pumpId <= sys.equipment.maxPumps) {
|
|
308
|
+
let pump = sys.pumps.getItemById(pumpId);
|
|
309
|
+
pump.name = msg.extractPayloadString(18, 16);
|
|
310
|
+
if (pump.isActive) state.pumps.getItemById(pumpId).name = pump.name;
|
|
311
|
+
pumpId++;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
private static processVS_IT(msg: Inbound) {
|
|
315
|
+
// Sample Packet
|
|
316
|
+
// [255, 0, 255], [165, 33, 15, 16, 27, 46], [1, 128, 1, 2, 0, 1, 6, 2, 12, 4, 9, 11, 7, 6, 7, 128, 8, 132, 3, 15, 5, 3, 234, 128, 46, 108, 58, 2, 232, 220, 232, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [8, 5]
|
|
317
|
+
const pumpId = msg.extractPayloadByte(0);
|
|
318
|
+
const pump = sys.pumps.getPumpByAddress(95 + pumpId);
|
|
319
|
+
// [1, 128, 0, 2, 0, 6, 5, 1, 5, 158, 9, 2, 10, 0, 3, 0, 3, 0, 3, 0, 3, 3, 120, 20, 146, 240, 232, 232, 232, 232, 232]
|
|
320
|
+
// byte | val |
|
|
321
|
+
// 0 | 1 | PumpId = 1
|
|
322
|
+
// 1 | 128 | Pump Type = VS
|
|
323
|
+
// 2 | 0 | Priming Time = 0
|
|
324
|
+
// 3 | 2 | Unknown
|
|
325
|
+
// 4 | 0 | Unknown
|
|
326
|
+
// 5 | 6 | Circuit Speed #1 = Pool
|
|
327
|
+
// 6 | 5 | Big endian for the speed (1400 rpm with byte(22))
|
|
328
|
+
// 7 | 1 | Circuit Speed #2 = Spa
|
|
329
|
+
// 8 | 5 | Big endian for the speed (1300 rpm with byte(23))
|
|
330
|
+
// 9 | 158 | Circuit Speed #3 = Solar
|
|
331
|
+
// 10 | 9 | Big endian for the speed (2450 rpm with byte(24))
|
|
332
|
+
// 11 | 2 | Circuit Speed #4 = Air blower (Aux-2)
|
|
333
|
+
// 12 | 10 | Big endian speed for the speed (2800 rpm with byte(25))
|
|
334
|
+
// 13 | 0 | Circuit Speed #5 = No circuit
|
|
335
|
+
// 14 | 3 | Big endian speed for the speed (1000 rpm with byte(26))
|
|
336
|
+
// 15 | 0 | Circuit speed #6 = No circuit
|
|
337
|
+
// 16 | 3 | Big endian speed for the speed (1000 rpm with byte(27))
|
|
338
|
+
// 17 | 0 | Circuit speed #7 = No circuit
|
|
339
|
+
// 18 | 3 | Big endian speed for the speed (1000 rpm with byte(28))
|
|
340
|
+
// 19 | 0 | Circuit speed #8 = No circuit
|
|
341
|
+
// 20 | 3 | Big endian speed for the speed (1000 rpm with byte(29))
|
|
342
|
+
// 21 | 3 | Big endian speed for the priming speed (1000 rpm with byte(30))
|
|
343
|
+
// All 30 bytes on this message are accounted for except for byte 3 & 4.
|
|
344
|
+
if (typeof pump.model === 'undefined') pump.model = 0;
|
|
345
|
+
for (let circuitId = 1; circuitId <= sys.board.valueMaps.pumpTypes.get(pump.type).maxCircuits; circuitId++) {
|
|
346
|
+
let _circuit = msg.extractPayloadByte(circuitId * 2 + 3);
|
|
347
|
+
if (_circuit !== 0) {
|
|
348
|
+
let circuit = pump.circuits.getItemById(circuitId, true);
|
|
349
|
+
circuit.circuit = _circuit;
|
|
350
|
+
circuit.speed =
|
|
351
|
+
msg.extractPayloadByte(circuitId * 2 + 4) * 256 +
|
|
352
|
+
msg.extractPayloadByte(circuitId + 21);
|
|
353
|
+
circuit.units = 0;
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
pump.circuits.removeItemById(circuitId);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
pump.primingSpeed = msg.extractPayloadByte(21) * 256 + msg.extractPayloadByte(30);
|
|
360
|
+
pump.primingTime = msg.extractPayloadByte(2);
|
|
361
|
+
pump.minSpeed = sys.board.valueMaps.pumpTypes.get(pump.type).minSpeed;
|
|
362
|
+
pump.maxSpeed = sys.board.valueMaps.pumpTypes.get(pump.type).maxSpeed;
|
|
363
|
+
pump.speedStepSize = sys.board.valueMaps.pumpTypes.get(pump.type).speedStepSize;
|
|
364
|
+
}
|
|
365
|
+
private static processVF_IT(msg: Inbound) {
|
|
366
|
+
// Sample Packet
|
|
367
|
+
// [255, 0, 255], [165, 33, 15, 16, 27, 46], [2, 6, 15, 2, 0, 1, 29, 11, 35, 0, 30, 0, 30, 0, 30, 0, 30, 0, 30, 0, 30, 30, 55, 5, 10, 60, 5, 1, 50, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [3, 41]
|
|
368
|
+
const pumpId = msg.extractPayloadByte(0);
|
|
369
|
+
const pump = sys.pumps.getPumpByAddress(95 + pumpId);
|
|
370
|
+
if (typeof pump.model === 'undefined') pump.model = 0;
|
|
371
|
+
for (let circuitId = 1; circuitId <= sys.board.valueMaps.pumpTypes.get(pump.type).maxCircuits; circuitId++) {
|
|
372
|
+
let _circuit = msg.extractPayloadByte(circuitId * 2 + 3);
|
|
373
|
+
if (_circuit !== 0) {
|
|
374
|
+
const circuit: PumpCircuit = pump.circuits.getItemById(circuitId, true);
|
|
375
|
+
circuit.circuit = _circuit;
|
|
376
|
+
circuit.flow = msg.extractPayloadByte(circuitId * 2 + 4);
|
|
377
|
+
circuit.units = 1;
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
pump.circuits.removeItemById(_circuit);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
pump.backgroundCircuit = msg.extractPayloadByte(1);
|
|
384
|
+
pump.filterSize = msg.extractPayloadByte(2) * 1000;
|
|
385
|
+
pump.turnovers = msg.extractPayloadByte(3);
|
|
386
|
+
pump.manualFilterGPM = msg.extractPayloadByte(21);
|
|
387
|
+
pump.primingSpeed = msg.extractPayloadByte(22);
|
|
388
|
+
pump.primingTime = (msg.extractPayloadByte(23) & 0xf);
|
|
389
|
+
pump.minFlow = sys.board.valueMaps.pumpTypes.get(pump.type).minFlow;
|
|
390
|
+
pump.maxFlow = sys.board.valueMaps.pumpTypes.get(pump.type).maxFlow;
|
|
391
|
+
pump.flowStepSize = sys.board.valueMaps.pumpTypes.get(pump.type).flowStepSize;
|
|
392
|
+
pump.maxSystemTime = msg.extractPayloadByte(23) >> 4;
|
|
393
|
+
pump.maxPressureIncrease = msg.extractPayloadByte(24);
|
|
394
|
+
pump.backwashFlow = msg.extractPayloadByte(25);
|
|
395
|
+
pump.backwashTime = msg.extractPayloadByte(26);
|
|
396
|
+
pump.rinseTime = msg.extractPayloadByte(27);
|
|
397
|
+
pump.vacuumFlow = msg.extractPayloadByte(28);
|
|
398
|
+
pump.vacuumTime = msg.extractPayloadByte(30);
|
|
399
|
+
}
|
|
400
|
+
private static processVSF_IT(msg: Inbound) {
|
|
401
|
+
// Sample packet
|
|
402
|
+
//[255, 0, 255][165, 33, 15, 16, 27, 46][2, 64, 0, 0, 2, 1, 33, 2, 4, 0, 30, 0, 30, 0, 30, 0, 30, 0, 30, 0, 30, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [2, 94]
|
|
403
|
+
//[255, 0, 255][165, 1, 15, 16, 24, 31][1, 64, 0, 0, 0, 6, 5, 2, 8, 1, 11, 7, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 220, 152, 184, 122, 0, 0, 0, 0, 0][4, 24]
|
|
404
|
+
const pumpId = msg.extractPayloadByte(0);
|
|
405
|
+
const pump = sys.pumps.getPumpByAddress(95 + pumpId);
|
|
406
|
+
if (typeof pump.model === 'undefined') pump.model = 0;
|
|
407
|
+
for (let circuitId = 1; circuitId <= sys.board.valueMaps.pumpTypes.get(pump.type).maxCircuits; circuitId++) {
|
|
408
|
+
let _circuit = msg.extractPayloadByte(circuitId * 2 + 3);
|
|
409
|
+
if (_circuit !== 0){
|
|
410
|
+
const circuit: PumpCircuit = pump.circuits.getItemById(circuitId, true);
|
|
411
|
+
circuit.circuit = _circuit;
|
|
412
|
+
circuit.units = (msg.extractPayloadByte(4) >> circuitId - 1 & 1) === 0 ? 1 : 0;
|
|
413
|
+
if (circuit.units) circuit.flow = msg.extractPayloadByte(circuitId * 2 + 4);
|
|
414
|
+
else circuit.speed = msg.extractPayloadByte(circuitId * 2 + 4) * 256 + msg.extractPayloadByte(circuitId + 21);
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
pump.circuits.removeItemById(_circuit);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
pump.speedStepSize = sys.board.valueMaps.pumpTypes.get(pump.type).speedStepSize;
|
|
421
|
+
pump.flowStepSize = sys.board.valueMaps.pumpTypes.get(pump.type).flowStepSize;
|
|
422
|
+
pump.minFlow = sys.board.valueMaps.pumpTypes.get(pump.type).minFlow;
|
|
423
|
+
pump.maxFlow = sys.board.valueMaps.pumpTypes.get(pump.type).maxFlow;
|
|
424
|
+
pump.minSpeed = sys.board.valueMaps.pumpTypes.get(pump.type).minSpeed;
|
|
425
|
+
pump.maxSpeed = sys.board.valueMaps.pumpTypes.get(pump.type).maxSpeed;
|
|
426
|
+
}
|
|
427
|
+
}
|