nodejs-poolcontroller 8.3.0 → 8.4.0
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/AGENTS.md +597 -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 +318 -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 +2688 -2664
- package/controller/Errors.ts +181 -181
- package/controller/Lockouts.ts +549 -549
- package/controller/State.ts +3738 -3701
- package/controller/boards/AquaLinkBoard.ts +1003 -1003
- package/controller/boards/BoardFactory.ts +53 -53
- package/controller/boards/EasyTouchBoard.ts +3202 -3202
- package/controller/boards/IntelliCenterBoard.ts +4393 -3899
- package/controller/boards/IntelliComBoard.ts +69 -69
- package/controller/boards/IntelliTouchBoard.ts +382 -382
- package/controller/boards/NixieBoard.ts +1944 -1944
- package/controller/boards/SunTouchBoard.ts +400 -400
- package/controller/boards/SystemBoard.ts +5268 -5268
- package/controller/comms/Comms.ts +1272 -1255
- package/controller/comms/ScreenLogic.ts +1665 -1665
- package/controller/comms/messages/Messages.ts +1433 -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 +216 -210
- package/controller/comms/messages/config/ExternalMessage.ts +96 -10
- package/controller/comms/messages/config/FeatureMessage.ts +0 -0
- package/controller/comms/messages/config/GeneralMessage.ts +0 -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 +194 -174
- package/controller/comms/messages/config/PumpMessage.ts +0 -0
- 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 +0 -0
- 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 +1158 -822
- package/controller/comms/messages/status/HeaterStateMessage.ts +135 -135
- package/controller/comms/messages/status/IntelliChemStateMessage.ts +448 -448
- package/controller/comms/messages/status/IntelliValveStateMessage.ts +36 -36
- 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 +103 -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 +2724 -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 +834 -834
- package/controller/nixie/pumps/Pump.ts +1193 -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 +31 -31
- package/logger/DataLogger.ts +448 -448
- package/logger/Logger.ts +448 -436
- package/package.json +58 -58
- package/sendSocket.js +32 -32
- package/tsconfig.json +25 -25
- package/types/express-multer.d.ts +32 -32
- package/web/Server.ts +1937 -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 +1063 -1053
- package/web/services/config/ConfigSocket.ts +0 -0
- package/web/services/state/State.ts +0 -0
- package/web/services/state/StateSocket.ts +0 -0
- package/web/services/utilities/Utilities.ts +233 -233
|
@@ -49,11 +49,16 @@ export class ChlorinatorMessage {
|
|
|
49
49
|
chlor.isActive = msg.extractPayloadByte(i + 22) === 1;
|
|
50
50
|
chlor.superChlorHours = msg.extractPayloadByte(i + 26);
|
|
51
51
|
chlor.address = 80 + i;
|
|
52
|
+
// Set a default name if not already set (name comes from chlorinator's Action 3 response)
|
|
53
|
+
if (typeof chlor.name === 'undefined' || chlor.name === '') {
|
|
54
|
+
chlor.name = `Chlorinator ${chlorId}`;
|
|
55
|
+
}
|
|
52
56
|
schlor.body = chlor.body;
|
|
53
57
|
schlor.poolSetpoint = chlor.poolSetpoint;
|
|
54
58
|
schlor.spaSetpoint = chlor.spaSetpoint;
|
|
55
59
|
schlor.type = chlor.type;
|
|
56
60
|
schlor.model = chlor.model;
|
|
61
|
+
schlor.name = chlor.name;
|
|
57
62
|
schlor.isActive = chlor.isActive;
|
|
58
63
|
schlor.superChlorHours = chlor.superChlorHours;
|
|
59
64
|
state.emitEquipmentChanges();
|
|
File without changes
|
|
File without changes
|
|
@@ -46,6 +46,12 @@ export class ConfigMessage {
|
|
|
46
46
|
public static process(msg: Inbound): void {
|
|
47
47
|
switch (sys.controllerType) {
|
|
48
48
|
case ControllerType.IntelliCenter:
|
|
49
|
+
// v3.004+ can return Action 30 with a zero-length payload for some (category,item) requests.
|
|
50
|
+
// These still unblock the config queue, but there is nothing to parse here.
|
|
51
|
+
if (msg.action === 30 && msg.payload.length === 0) {
|
|
52
|
+
msg.isProcessed = true;
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
49
55
|
switch (msg.extractPayloadByte(0)) {
|
|
50
56
|
case 0:
|
|
51
57
|
OptionsMessage.process(msg);
|
|
File without changes
|
|
@@ -1,32 +1,32 @@
|
|
|
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 } from "../../../Equipment";
|
|
20
|
-
export class CustomNameMessage
|
|
21
|
-
{
|
|
22
|
-
public static process ( msg: Inbound ): void
|
|
23
|
-
{
|
|
24
|
-
let customNameId = msg.extractPayloadByte( 0 );
|
|
25
|
-
let customName = sys.customNames.getItemById( customNameId, customNameId <= sys.equipment.maxCustomNames );
|
|
26
|
-
customName.name = msg.extractPayloadString( 1, 11 );
|
|
27
|
-
// customName.isActive = customNameId <= sys.equipment.maxCustomNames && !customName.name.includes('USERNAME-')
|
|
28
|
-
if (customNameId >= sys.equipment.maxCustomNames) sys.equipment.maxCustomNames = customNameId + 1;
|
|
29
|
-
sys.board.system.syncCustomNamesValueMap();
|
|
30
|
-
msg.isProcessed = true;
|
|
31
|
-
}
|
|
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 } from "../../../Equipment";
|
|
20
|
+
export class CustomNameMessage
|
|
21
|
+
{
|
|
22
|
+
public static process ( msg: Inbound ): void
|
|
23
|
+
{
|
|
24
|
+
let customNameId = msg.extractPayloadByte( 0 );
|
|
25
|
+
let customName = sys.customNames.getItemById( customNameId, customNameId <= sys.equipment.maxCustomNames );
|
|
26
|
+
customName.name = msg.extractPayloadString( 1, 11 );
|
|
27
|
+
// customName.isActive = customNameId <= sys.equipment.maxCustomNames && !customName.name.includes('USERNAME-')
|
|
28
|
+
if (customNameId >= sys.equipment.maxCustomNames) sys.equipment.maxCustomNames = customNameId + 1;
|
|
29
|
+
sys.board.system.syncCustomNamesValueMap();
|
|
30
|
+
msg.isProcessed = true;
|
|
31
|
+
}
|
|
32
32
|
}
|
|
@@ -1,210 +1,216 @@
|
|
|
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, Equipment, ExpansionPanel, Body } from '../../../Equipment';
|
|
20
|
-
import { state, BodyTempState } from '../../../State';
|
|
21
|
-
import { ControllerType } from '../../../Constants';
|
|
22
|
-
import { logger } from "../../../../logger/Logger";
|
|
23
|
-
export class EquipmentMessage {
|
|
24
|
-
public static process(msg: Inbound): void {
|
|
25
|
-
let pnl: ExpansionPanel;
|
|
26
|
-
let bodyId: number;
|
|
27
|
-
let body: Body;
|
|
28
|
-
let sbody: BodyTempState;
|
|
29
|
-
switch (sys.controllerType) {
|
|
30
|
-
case ControllerType.IntelliCenter:
|
|
31
|
-
switch (msg.extractPayloadByte(1)) {
|
|
32
|
-
case 0:
|
|
33
|
-
sys.equipment.name = msg.extractPayloadString(2, 16);
|
|
34
|
-
sys.equipment.type = msg.extractPayloadByte(35);
|
|
35
|
-
pnl = sys.equipment.expansions.getItemById(1, true);
|
|
36
|
-
pnl.type = msg.extractPayloadByte(36);
|
|
37
|
-
pnl.name = msg.extractPayloadString(18, 16);
|
|
38
|
-
pnl.isActive = false; //pnl.type !== 0 && pnl.type !== 255; RKS: We will have to see what a system looks like with an expansion panel installed.
|
|
39
|
-
// A system withouth any expansion panels installed has been shown to have a 1 in byte(38) i10PS.
|
|
40
|
-
pnl = sys.equipment.expansions.getItemById(2, true);
|
|
41
|
-
pnl.type = msg.extractPayloadByte(37);
|
|
42
|
-
pnl.isActive = false; //pnl.type !== 0 && pnl.type !== 255;
|
|
43
|
-
pnl = sys.equipment.expansions.getItemById(3, true);
|
|
44
|
-
pnl.type = msg.extractPayloadByte(38);
|
|
45
|
-
pnl.isActive = false; //pnl.type !== 0 && pnl.type !== 255;
|
|
46
|
-
body = sys.bodies.getItemById(1, sys.equipment.maxBodies >= 1);
|
|
47
|
-
sbody = state.temps.bodies.getItemById(1, sys.equipment.maxBodies >= 1);
|
|
48
|
-
sbody.type = body.type = msg.extractPayloadByte(39);
|
|
49
|
-
body.capacity = msg.extractPayloadByte(34) * 1000;
|
|
50
|
-
if (body.isActive && sys.equipment.maxBodies === 0) sys.bodies.removeItemById(1);
|
|
51
|
-
body.isActive = sys.equipment.maxBodies > 0;
|
|
52
|
-
msg.isProcessed = true;
|
|
53
|
-
break;
|
|
54
|
-
case 1:
|
|
55
|
-
pnl = sys.equipment.expansions.getItemById(2);
|
|
56
|
-
pnl.name = msg.extractPayloadString(2, 16);
|
|
57
|
-
bodyId = 2;
|
|
58
|
-
if (sys.equipment.maxBodies >= bodyId) {
|
|
59
|
-
body = sys.bodies.getItemById(bodyId, true);
|
|
60
|
-
sbody = state.temps.bodies.getItemById(bodyId, true);
|
|
61
|
-
sbody.type = body.type = msg.extractPayloadByte(35);
|
|
62
|
-
body.capacity = msg.extractPayloadByte(34) * 1000;
|
|
63
|
-
body.isActive = true;
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
sys.bodies.removeItemById(bodyId);
|
|
67
|
-
state.temps.bodies.removeItemById(bodyId);
|
|
68
|
-
}
|
|
69
|
-
pnl = sys.equipment.expansions.getItemById(3);
|
|
70
|
-
pnl.name = msg.extractPayloadString(18, 16);
|
|
71
|
-
msg.isProcessed = true;
|
|
72
|
-
break;
|
|
73
|
-
case 2:
|
|
74
|
-
// The first name is the first body in this packet and the second is the third. Go figure.
|
|
75
|
-
bodyId = 1;
|
|
76
|
-
body = sys.bodies.getItemById(bodyId, bodyId <= sys.equipment.maxBodies);
|
|
77
|
-
sbody = state.temps.bodies.getItemById(bodyId, bodyId <= sys.equipment.maxBodies);
|
|
78
|
-
sbody.name = body.name = msg.extractPayloadString(2, 16);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
sys.
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
body
|
|
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
|
-
state.equipment.
|
|
142
|
-
state.equipment.
|
|
143
|
-
state.equipment.
|
|
144
|
-
state.equipment.
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
//
|
|
177
|
-
// eq.
|
|
178
|
-
// eq.
|
|
179
|
-
//
|
|
180
|
-
//
|
|
181
|
-
//
|
|
182
|
-
//
|
|
183
|
-
//
|
|
184
|
-
//
|
|
185
|
-
//
|
|
186
|
-
//
|
|
187
|
-
//
|
|
188
|
-
//
|
|
189
|
-
//
|
|
190
|
-
//
|
|
191
|
-
//
|
|
192
|
-
//
|
|
193
|
-
//
|
|
194
|
-
//
|
|
195
|
-
//
|
|
196
|
-
//
|
|
197
|
-
//
|
|
198
|
-
//
|
|
199
|
-
//
|
|
200
|
-
//
|
|
201
|
-
//
|
|
202
|
-
// max
|
|
203
|
-
//
|
|
204
|
-
//
|
|
205
|
-
//
|
|
206
|
-
//
|
|
207
|
-
//
|
|
208
|
-
//
|
|
209
|
-
//
|
|
210
|
-
|
|
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, Equipment, ExpansionPanel, Body } from '../../../Equipment';
|
|
20
|
+
import { state, BodyTempState } from '../../../State';
|
|
21
|
+
import { ControllerType } from '../../../Constants';
|
|
22
|
+
import { logger } from "../../../../logger/Logger";
|
|
23
|
+
export class EquipmentMessage {
|
|
24
|
+
public static process(msg: Inbound): void {
|
|
25
|
+
let pnl: ExpansionPanel;
|
|
26
|
+
let bodyId: number;
|
|
27
|
+
let body: Body;
|
|
28
|
+
let sbody: BodyTempState;
|
|
29
|
+
switch (sys.controllerType) {
|
|
30
|
+
case ControllerType.IntelliCenter:
|
|
31
|
+
switch (msg.extractPayloadByte(1)) {
|
|
32
|
+
case 0:
|
|
33
|
+
sys.equipment.name = msg.extractPayloadString(2, 16);
|
|
34
|
+
sys.equipment.type = msg.extractPayloadByte(35);
|
|
35
|
+
pnl = sys.equipment.expansions.getItemById(1, true);
|
|
36
|
+
pnl.type = msg.extractPayloadByte(36);
|
|
37
|
+
pnl.name = msg.extractPayloadString(18, 16);
|
|
38
|
+
pnl.isActive = false; //pnl.type !== 0 && pnl.type !== 255; RKS: We will have to see what a system looks like with an expansion panel installed.
|
|
39
|
+
// A system withouth any expansion panels installed has been shown to have a 1 in byte(38) i10PS.
|
|
40
|
+
pnl = sys.equipment.expansions.getItemById(2, true);
|
|
41
|
+
pnl.type = msg.extractPayloadByte(37);
|
|
42
|
+
pnl.isActive = false; //pnl.type !== 0 && pnl.type !== 255;
|
|
43
|
+
pnl = sys.equipment.expansions.getItemById(3, true);
|
|
44
|
+
pnl.type = msg.extractPayloadByte(38);
|
|
45
|
+
pnl.isActive = false; //pnl.type !== 0 && pnl.type !== 255;
|
|
46
|
+
body = sys.bodies.getItemById(1, sys.equipment.maxBodies >= 1);
|
|
47
|
+
sbody = state.temps.bodies.getItemById(1, sys.equipment.maxBodies >= 1);
|
|
48
|
+
sbody.type = body.type = msg.extractPayloadByte(39);
|
|
49
|
+
body.capacity = msg.extractPayloadByte(34) * 1000;
|
|
50
|
+
if (body.isActive && sys.equipment.maxBodies === 0) sys.bodies.removeItemById(1);
|
|
51
|
+
body.isActive = sys.equipment.maxBodies > 0;
|
|
52
|
+
msg.isProcessed = true;
|
|
53
|
+
break;
|
|
54
|
+
case 1:
|
|
55
|
+
pnl = sys.equipment.expansions.getItemById(2);
|
|
56
|
+
pnl.name = msg.extractPayloadString(2, 16);
|
|
57
|
+
bodyId = 2;
|
|
58
|
+
if (sys.equipment.maxBodies >= bodyId) {
|
|
59
|
+
body = sys.bodies.getItemById(bodyId, true);
|
|
60
|
+
sbody = state.temps.bodies.getItemById(bodyId, true);
|
|
61
|
+
sbody.type = body.type = msg.extractPayloadByte(35);
|
|
62
|
+
body.capacity = msg.extractPayloadByte(34) * 1000;
|
|
63
|
+
body.isActive = true;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
sys.bodies.removeItemById(bodyId);
|
|
67
|
+
state.temps.bodies.removeItemById(bodyId);
|
|
68
|
+
}
|
|
69
|
+
pnl = sys.equipment.expansions.getItemById(3);
|
|
70
|
+
pnl.name = msg.extractPayloadString(18, 16);
|
|
71
|
+
msg.isProcessed = true;
|
|
72
|
+
break;
|
|
73
|
+
case 2:
|
|
74
|
+
// The first name is the first body in this packet and the second is the third. Go figure.
|
|
75
|
+
bodyId = 1;
|
|
76
|
+
body = sys.bodies.getItemById(bodyId, bodyId <= sys.equipment.maxBodies);
|
|
77
|
+
sbody = state.temps.bodies.getItemById(bodyId, bodyId <= sys.equipment.maxBodies);
|
|
78
|
+
sbody.name = body.name = msg.extractPayloadString(2, 16);
|
|
79
|
+
// IntelliCenter shared-body systems (e.g. i10PS) have Pool+Spa (Body1+Body2). In those systems,
|
|
80
|
+
// the second string in this packet is Body2 (Spa). Non-shared multi-body systems keep the legacy mapping.
|
|
81
|
+
const secondBodyId = (sys.equipment.shared === true && sys.equipment.dual !== true) ? 2 : 3;
|
|
82
|
+
if (sys.equipment.maxBodies >= secondBodyId) {
|
|
83
|
+
body = sys.bodies.getItemById(secondBodyId, secondBodyId <= sys.equipment.maxBodies);
|
|
84
|
+
sbody = state.temps.bodies.getItemById(secondBodyId, secondBodyId <= sys.equipment.maxBodies);
|
|
85
|
+
// Only body3+ packets include type/capacity bytes here; avoid corrupting 2-body systems.
|
|
86
|
+
if (secondBodyId >= 3) {
|
|
87
|
+
sbody.type = body.type = msg.extractPayloadByte(35);
|
|
88
|
+
body.capacity = msg.extractPayloadByte(34) * 1000;
|
|
89
|
+
}
|
|
90
|
+
body.isActive = secondBodyId <= sys.equipment.maxBodies;
|
|
91
|
+
sbody.name = body.name = msg.extractPayloadString(18, 16);
|
|
92
|
+
} else {
|
|
93
|
+
sys.bodies.removeItemById(secondBodyId);
|
|
94
|
+
state.temps.bodies.removeItemById(secondBodyId);
|
|
95
|
+
}
|
|
96
|
+
msg.isProcessed = true;
|
|
97
|
+
break;
|
|
98
|
+
case 3:
|
|
99
|
+
// The first name is the second body and the 2nd is the 4th. This packet also contains
|
|
100
|
+
// any additional information related to bodies 3 & 4 that were not previously included.
|
|
101
|
+
bodyId = 2;
|
|
102
|
+
if (sys.equipment.maxBodies >= bodyId) {
|
|
103
|
+
body = sys.bodies.getItemById(bodyId, bodyId <= sys.equipment.maxBodies);
|
|
104
|
+
sbody = state.temps.bodies.getItemById(bodyId, bodyId <= sys.equipment.maxBodies);
|
|
105
|
+
// On shared-body IntelliCenter (Pool+Spa), the Spa name is often in the SECOND string (offset 18),
|
|
106
|
+
// while the first string (offset 2) repeats Pool.
|
|
107
|
+
const nameOffset = (sys.equipment.shared === true && sys.equipment.dual !== true) ? 18 : 2;
|
|
108
|
+
sbody.name = body.name = msg.extractPayloadString(nameOffset, 16);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
sys.bodies.removeItemById(bodyId);
|
|
112
|
+
state.temps.bodies.removeItemById(bodyId);
|
|
113
|
+
}
|
|
114
|
+
bodyId = 4;
|
|
115
|
+
if (sys.equipment.maxBodies >= bodyId) {
|
|
116
|
+
body = sys.bodies.getItemById(bodyId, bodyId <= sys.equipment.maxBodies);
|
|
117
|
+
sbody = state.temps.bodies.getItemById(bodyId, bodyId <= sys.equipment.maxBodies);
|
|
118
|
+
sbody.name = body.name = msg.extractPayloadString(18, 16);
|
|
119
|
+
sbody.type = body.type = msg.extractPayloadByte(37);
|
|
120
|
+
body.capacity = msg.extractPayloadByte(36) * 1000;
|
|
121
|
+
if (body.isActive && bodyId > sys.equipment.maxBodies) sys.bodies.removeItemById(bodyId);
|
|
122
|
+
body.isActive = bodyId <= sys.equipment.maxBodies;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
sys.bodies.removeItemById(bodyId);
|
|
126
|
+
state.temps.bodies.removeItemById(bodyId);
|
|
127
|
+
}
|
|
128
|
+
bodyId = 3;
|
|
129
|
+
if (sys.equipment.maxBodies >= bodyId) {
|
|
130
|
+
body = sys.bodies.getItemById(bodyId, bodyId <= sys.equipment.maxBodies);
|
|
131
|
+
sbody = state.temps.bodies.getItemById(bodyId, bodyId <= sys.equipment.maxBodies);
|
|
132
|
+
sbody.type = body.type = msg.extractPayloadByte(35);
|
|
133
|
+
body.capacity = msg.extractPayloadByte(34) * 1000;
|
|
134
|
+
if (body.isActive && bodyId > sys.equipment.maxBodies) sys.bodies.removeItemById(bodyId);
|
|
135
|
+
body.isActive = bodyId <= sys.equipment.maxBodies;
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
sys.bodies.removeItemById(bodyId);
|
|
139
|
+
state.temps.bodies.removeItemById(bodyId);
|
|
140
|
+
}
|
|
141
|
+
state.equipment.single = sys.equipment.single = sys.equipment.shared == false && sys.equipment.dual === false;
|
|
142
|
+
state.equipment.shared = sys.equipment.shared;
|
|
143
|
+
state.equipment.dual = sys.equipment.dual;
|
|
144
|
+
state.equipment.model = sys.equipment.model;
|
|
145
|
+
state.equipment.controllerType = sys.controllerType;
|
|
146
|
+
state.equipment.maxBodies = sys.equipment.maxBodies;
|
|
147
|
+
state.equipment.maxCircuits = sys.equipment.maxCircuits;
|
|
148
|
+
state.equipment.maxValves = sys.equipment.maxValves;
|
|
149
|
+
state.equipment.maxSchedules = sys.equipment.maxSchedules;
|
|
150
|
+
state.equipment.maxPumps = sys.equipment.maxPumps;
|
|
151
|
+
msg.isProcessed = true;
|
|
152
|
+
break;
|
|
153
|
+
default:
|
|
154
|
+
logger.debug(`Unprocessed Config Message ${msg.toPacket()}`)
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
break;
|
|
158
|
+
case ControllerType.IntelliCom:
|
|
159
|
+
case ControllerType.EasyTouch:
|
|
160
|
+
case ControllerType.IntelliTouch:
|
|
161
|
+
case ControllerType.SunTouch:
|
|
162
|
+
switch (msg.action) {
|
|
163
|
+
case 252:
|
|
164
|
+
EquipmentMessage.processSoftwareVersion(msg);
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
private static processSoftwareVersion(msg: Inbound) {
|
|
171
|
+
// sample packet
|
|
172
|
+
// [165,33,15,16,252,17],0,{2,90},0,0,{1,10},0,0,0,0,0,0,0,0,0,0],[2,89]
|
|
173
|
+
sys.equipment.bootloaderVersion = `${msg.extractPayloadByte(5)}.${msg.extractPayloadByte(6) < 100 ? '0' + msg.extractPayloadByte(6) : msg.extractPayloadByte(6)}`;
|
|
174
|
+
sys.equipment.controllerFirmware = `${msg.extractPayloadByte(1)}.${msg.extractPayloadByte(2) < 100 ? '0' + msg.extractPayloadByte(2) : msg.extractPayloadByte(2)}`;
|
|
175
|
+
}
|
|
176
|
+
//private static calcModel(eq: Equipment) {
|
|
177
|
+
// eq.shared = (eq.type & 8) === 8;
|
|
178
|
+
// eq.maxPumps = 16;
|
|
179
|
+
// eq.maxLightGroups = 40;
|
|
180
|
+
// eq.maxCircuitGroups = 16;
|
|
181
|
+
// eq.maxValves = EquipmentMessage.calcMaxValves(eq);
|
|
182
|
+
// eq.maxCircuits = EquipmentMessage.calcMaxCircuits(eq);
|
|
183
|
+
// eq.maxBodies = EquipmentMessage.calcMaxBodies(eq);
|
|
184
|
+
// eq.model = 'IntelliCenter i' + (eq.maxCircuits + (eq.shared ? -1 : 0)).toString() + 'P' + (eq.shared ? 'S' : '');
|
|
185
|
+
//}
|
|
186
|
+
//private static calcMaxBodies(eq: Equipment): number {
|
|
187
|
+
// let max: number = eq.shared ? 2 : 1;
|
|
188
|
+
// for (let i = 0; i < eq.expansions.length; i++) {
|
|
189
|
+
// const exp: ExpansionPanel = eq.expansions.getItemById(i + 1);
|
|
190
|
+
// if (exp.type === 0) continue;
|
|
191
|
+
// max += (exp.type & 8) === 8 ? 2 : 1;
|
|
192
|
+
// }
|
|
193
|
+
// return max;
|
|
194
|
+
//}
|
|
195
|
+
//private static calcMaxValves(eq: Equipment): number {
|
|
196
|
+
// let max: number = 4;
|
|
197
|
+
// max += (eq.type & 1) === 1 ? 6 : 0;
|
|
198
|
+
// for (let i = 0; i < eq.expansions.length; i++) {
|
|
199
|
+
// const exp: ExpansionPanel = eq.expansions.getItemById(i + 1);
|
|
200
|
+
// max += (exp.type & 1) === 1 ? 6 : 0;
|
|
201
|
+
// }
|
|
202
|
+
// return max;
|
|
203
|
+
//}
|
|
204
|
+
//private static calcMaxCircuits(eq: Equipment): number {
|
|
205
|
+
// let max: number = 6;
|
|
206
|
+
// max += (eq.type & 2) === 2 ? 2 : 0;
|
|
207
|
+
// max += (eq.type & 4) === 4 ? 2 : 0;
|
|
208
|
+
// max += eq.shared ? 1 : 0;
|
|
209
|
+
// for (let i = 0; i < eq.expansions.length; i++) {
|
|
210
|
+
// const exp: ExpansionPanel = eq.expansions.getItemById(i + 1);
|
|
211
|
+
// max += (exp.type & 2) === 2 ? 5 : 0;
|
|
212
|
+
// max += (exp.type & 4) === 2 ? 5 : 0;
|
|
213
|
+
// }
|
|
214
|
+
// return max;
|
|
215
|
+
//}
|
|
216
|
+
}
|