nodejs-poolcontroller 7.6.1 → 7.7.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 +44 -44
- package/.github/ISSUE_TEMPLATE/1-bug-report.yml +84 -0
- package/.github/ISSUE_TEMPLATE/2-docs.md +12 -0
- package/.github/ISSUE_TEMPLATE/3-proposal.md +28 -0
- package/.github/ISSUE_TEMPLATE/config.yml +8 -0
- package/CONTRIBUTING.md +74 -74
- package/Changelog +220 -215
- package/Dockerfile +17 -17
- package/Gruntfile.js +40 -40
- package/LICENSE +661 -661
- package/README.md +191 -191
- package/app.ts +1 -1
- package/config/Config.ts +14 -0
- package/config/VersionCheck.ts +2 -2
- package/controller/Constants.ts +2 -1
- package/controller/Equipment.ts +2484 -2459
- package/controller/Errors.ts +180 -180
- package/controller/Lockouts.ts +502 -436
- package/controller/State.ts +106 -30
- package/controller/boards/AquaLinkBoard.ts +1000 -0
- package/controller/boards/BoardFactory.ts +49 -45
- package/controller/boards/EasyTouchBoard.ts +2859 -2653
- package/controller/boards/IntelliCenterBoard.ts +4198 -4230
- package/controller/boards/IntelliComBoard.ts +63 -63
- package/controller/boards/IntelliTouchBoard.ts +273 -241
- package/controller/boards/NixieBoard.ts +1728 -1675
- package/controller/boards/SystemBoard.ts +4925 -4697
- package/controller/comms/Comms.ts +442 -479
- package/controller/comms/messages/Messages.ts +171 -25
- package/controller/comms/messages/config/ChlorinatorMessage.ts +5 -2
- package/controller/comms/messages/config/CircuitGroupMessage.ts +0 -0
- package/controller/comms/messages/config/CircuitMessage.ts +1 -0
- package/controller/comms/messages/config/ConfigMessage.ts +0 -0
- package/controller/comms/messages/config/CoverMessage.ts +0 -0
- package/controller/comms/messages/config/CustomNameMessage.ts +30 -30
- package/controller/comms/messages/config/EquipmentMessage.ts +0 -0
- package/controller/comms/messages/config/ExternalMessage.ts +0 -0
- 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 +142 -10
- package/controller/comms/messages/config/IntellichemMessage.ts +0 -0
- package/controller/comms/messages/config/OptionsMessage.ts +4 -21
- package/controller/comms/messages/config/PumpMessage.ts +53 -35
- package/controller/comms/messages/config/RemoteMessage.ts +0 -0
- package/controller/comms/messages/config/ScheduleMessage.ts +350 -347
- package/controller/comms/messages/config/SecurityMessage.ts +0 -0
- package/controller/comms/messages/config/ValveMessage.ts +1 -1
- package/controller/comms/messages/status/ChlorinatorStateMessage.ts +38 -86
- package/controller/comms/messages/status/EquipmentStateMessage.ts +58 -22
- package/controller/comms/messages/status/HeaterStateMessage.ts +116 -86
- package/controller/comms/messages/status/IntelliChemStateMessage.ts +445 -445
- package/controller/comms/messages/status/IntelliValveStateMessage.ts +35 -35
- package/controller/comms/messages/status/PumpStateMessage.ts +23 -1
- package/controller/comms/messages/status/VersionMessage.ts +0 -0
- package/controller/nixie/Nixie.ts +162 -162
- package/controller/nixie/NixieEquipment.ts +103 -103
- package/controller/nixie/bodies/Body.ts +120 -120
- package/controller/nixie/bodies/Filter.ts +135 -135
- package/controller/nixie/chemistry/ChemController.ts +2511 -2498
- package/controller/nixie/chemistry/Chlorinator.ts +363 -314
- package/controller/nixie/circuits/Circuit.ts +261 -248
- package/controller/nixie/heaters/Heater.ts +650 -648
- package/controller/nixie/pumps/Pump.ts +906 -661
- package/controller/nixie/schedules/Schedule.ts +313 -257
- package/controller/nixie/valves/Valve.ts +170 -170
- package/defaultConfig.json +306 -286
- package/logger/DataLogger.ts +448 -448
- package/logger/Logger.ts +0 -0
- package/package.json +56 -56
- package/tsconfig.json +25 -25
- package/web/Server.ts +92 -47
- package/web/bindings/aqualinkD.json +505 -0
- package/web/bindings/influxDB.json +1051 -1021
- package/web/bindings/mqtt.json +702 -654
- package/web/bindings/mqttAlt.json +731 -684
- 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 +137 -136
- package/web/interfaces/httpInterface.ts +145 -124
- package/web/interfaces/influxInterface.ts +276 -245
- package/web/interfaces/mqttInterface.ts +535 -475
- package/web/services/config/Config.ts +39 -18
- package/web/services/config/ConfigSocket.ts +0 -0
- package/web/services/state/State.ts +10 -0
- package/web/services/state/StateSocket.ts +4 -4
- package/web/services/utilities/Utilities.ts +44 -42
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -52
- package/config copy.json +0 -300
- package/issue_template.md +0 -52
|
@@ -1,242 +1,274 @@
|
|
|
1
|
-
/* nodejs-poolController. An application to control pool equipment.
|
|
2
|
-
Copyright (C) 2016, 2017, 2018, 2019, 2020. Russell Goldin, tagyoureit. russ.goldin@gmail.com
|
|
3
|
-
|
|
4
|
-
This program is free software: you can redistribute it and/or modify
|
|
5
|
-
it under the terms of the GNU Affero General Public License as
|
|
6
|
-
published by the Free Software Foundation, either version 3 of the
|
|
7
|
-
License, or (at your option) any later version.
|
|
8
|
-
|
|
9
|
-
This program is distributed in the hope that it will be useful,
|
|
10
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
GNU Affero General Public License for more details.
|
|
13
|
-
|
|
14
|
-
You should have received a copy of the GNU Affero General Public License
|
|
15
|
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
-
*/
|
|
17
|
-
import { byteValueMap } from './SystemBoard';
|
|
18
|
-
import { logger } from '../../logger/Logger';
|
|
19
|
-
import { EasyTouchBoard, TouchConfigQueue, GetTouchConfigCategories, TouchCircuitCommands } from './EasyTouchBoard';
|
|
20
|
-
import { state, ICircuitGroupState } from '../State';
|
|
21
|
-
import { PoolSystem, sys, ExpansionPanel, Equipment } from '../Equipment';
|
|
22
|
-
|
|
23
|
-
import { conn } from '../comms/Comms';
|
|
24
|
-
import { InvalidEquipmentDataError } from '../Errors';
|
|
25
|
-
|
|
26
|
-
export class IntelliTouchBoard extends EasyTouchBoard {
|
|
27
|
-
constructor(system: PoolSystem) {
|
|
28
|
-
super(system);
|
|
29
|
-
this.equipmentIds.features.start = 41;
|
|
30
|
-
this.equipmentIds.features.end = 50;
|
|
31
|
-
this._configQueue = new ITTouchConfigQueue();
|
|
32
|
-
this.valueMaps.expansionBoards = new byteValueMap([
|
|
33
|
-
[0, { name: 'IT5', part: 'i5+3', desc: 'IntelliTouch i5+3', circuits: 6, shared: true }],
|
|
34
|
-
[1, { name: 'IT7', part: 'i7+3', desc: 'IntelliTouch i7+3', circuits: 8, shared: true }],
|
|
35
|
-
[2, { name: 'IT9', part: 'i9+3', desc: 'IntelliTouch i9+3', circuits: 10, shared: true }],
|
|
36
|
-
[3, { name: 'IT5S', part: 'i5+3S', desc: 'IntelliTouch i5+3S', circuits: 5, shared: false, bodies:
|
|
37
|
-
[4, { name: 'IT9S', part: 'i9+3S', desc: 'IntelliTouch i9+3S', circuits: 9, shared: false, bodies:
|
|
38
|
-
[5, { name: 'IT10D', part: 'i10D', desc: 'IntelliTouch i10D', circuits: 10, shared: false, dual: true }],
|
|
39
|
-
[32, { name: 'IT5X', part: 'i5X', desc: 'IntelliTouch i5X', circuits: 5 }],
|
|
40
|
-
[33, { name: 'IT10X', part: 'i10X', desc: 'IntelliTouch i10X', circuits: 10 }]
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
let
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
eq
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
eq.
|
|
61
|
-
eq.
|
|
62
|
-
eq.
|
|
63
|
-
eq.
|
|
64
|
-
eq.
|
|
65
|
-
eq.
|
|
66
|
-
eq.
|
|
67
|
-
eq.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
//
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
//
|
|
82
|
-
|
|
83
|
-
if (
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
let
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
state.
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
let
|
|
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
|
-
if (
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
this.
|
|
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
|
-
|
|
1
|
+
/* nodejs-poolController. An application to control pool equipment.
|
|
2
|
+
Copyright (C) 2016, 2017, 2018, 2019, 2020. Russell Goldin, tagyoureit. russ.goldin@gmail.com
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU Affero General Public License as
|
|
6
|
+
published by the Free Software Foundation, either version 3 of the
|
|
7
|
+
License, or (at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU Affero General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
import { byteValueMap } from './SystemBoard';
|
|
18
|
+
import { logger } from '../../logger/Logger';
|
|
19
|
+
import { EasyTouchBoard, TouchConfigQueue, GetTouchConfigCategories, TouchCircuitCommands } from './EasyTouchBoard';
|
|
20
|
+
import { state, ICircuitGroupState } from '../State';
|
|
21
|
+
import { PoolSystem, sys, ExpansionPanel, Equipment } from '../Equipment';
|
|
22
|
+
|
|
23
|
+
import { conn } from '../comms/Comms';
|
|
24
|
+
import { InvalidEquipmentDataError } from '../Errors';
|
|
25
|
+
|
|
26
|
+
export class IntelliTouchBoard extends EasyTouchBoard {
|
|
27
|
+
constructor(system: PoolSystem) {
|
|
28
|
+
super(system);
|
|
29
|
+
this.equipmentIds.features.start = 41;
|
|
30
|
+
this.equipmentIds.features.end = 50;
|
|
31
|
+
this._configQueue = new ITTouchConfigQueue();
|
|
32
|
+
this.valueMaps.expansionBoards = new byteValueMap([
|
|
33
|
+
[0, { name: 'IT5', part: 'i5+3', desc: 'IntelliTouch i5+3', circuits: 6, shared: true }],
|
|
34
|
+
[1, { name: 'IT7', part: 'i7+3', desc: 'IntelliTouch i7+3', circuits: 8, shared: true }],
|
|
35
|
+
[2, { name: 'IT9', part: 'i9+3', desc: 'IntelliTouch i9+3', circuits: 10, shared: true }],
|
|
36
|
+
[3, { name: 'IT5S', part: 'i5+3S', desc: 'IntelliTouch i5+3S', circuits: 5, shared: false, bodies: 2, intakeReturnValves: false }],
|
|
37
|
+
[4, { name: 'IT9S', part: 'i9+3S', desc: 'IntelliTouch i9+3S', circuits: 9, shared: false, bodies: 2, intakeReturnValves: false }],
|
|
38
|
+
[5, { name: 'IT10D', part: 'i10D', desc: 'IntelliTouch i10D', circuits: 10, shared: false, dual: true }],
|
|
39
|
+
[32, { name: 'IT5X', part: 'i5X', desc: 'IntelliTouch i5X', circuits: 5 }],
|
|
40
|
+
[33, { name: 'IT10X', part: 'i10X', desc: 'IntelliTouch i10X', circuits: 10 }],
|
|
41
|
+
[64, { name: 'Valve Exp', part: '520285', desc: 'Valve Expansion Module', valves: 3 }]
|
|
42
|
+
]);
|
|
43
|
+
}
|
|
44
|
+
public initExpansionModules(byte1: number, byte2: number) {
|
|
45
|
+
console.log(`Pentair IntelliTouch System Detected!`);
|
|
46
|
+
// For i9+3S with valve expansion the bytes are 4, 32 the expectation is
|
|
47
|
+
// that the 32 contains the indicator that there is a valve expansion module.
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
// Initialize the installed personality board.
|
|
51
|
+
let mt = this.valueMaps.expansionBoards.transform(byte1);
|
|
52
|
+
let mod = sys.equipment.modules.getItemById(0, true);
|
|
53
|
+
mod.name = mt.name;
|
|
54
|
+
mod.desc = mt.desc;
|
|
55
|
+
mod.type = byte1;
|
|
56
|
+
mod.part = mt.part;
|
|
57
|
+
let eq = sys.equipment;
|
|
58
|
+
let md = mod.get();
|
|
59
|
+
|
|
60
|
+
eq.maxBodies = md.bodies = typeof mt.bodies !== 'undefined' ? mt.bodies : mt.shared || mt.dual ? 2 : 1;
|
|
61
|
+
eq.maxCircuits = md.circuits = typeof mt.circuits !== 'undefined' ? mt.circuits : 6;
|
|
62
|
+
eq.maxFeatures = md.features = typeof mt.features !== 'undefined' ? mt.features : 8;
|
|
63
|
+
eq.maxValves = md.valves = typeof mt.valves !== 'undefined' ? mt.valves : mt.shared ? 4 : 2;
|
|
64
|
+
eq.maxPumps = md.maxPumps = typeof mt.pumps !== 'undefined' ? mt.pumps : 8;
|
|
65
|
+
eq.shared = mt.shared;
|
|
66
|
+
eq.dual = typeof mt.dual !== 'undefined' ? mt.dual : false;
|
|
67
|
+
eq.intakeReturnValves = md.intakeReturnValves = typeof mt.intakeReturnValves !== 'undefined' ? mt.intakeReturnValves : false;
|
|
68
|
+
eq.maxChlorinators = md.chlorinators = 1;
|
|
69
|
+
eq.maxChemControllers = md.chemControllers = 1;
|
|
70
|
+
eq.maxCustomNames = 20;
|
|
71
|
+
eq.maxCircuitGroups = 10; // Not sure why this is 10 other than to allow for those that we are in control of.
|
|
72
|
+
if (!eq.shared && !eq.dual) {
|
|
73
|
+
// Replace the body types with Hi-Temp and Lo-Temp
|
|
74
|
+
sys.board.valueMaps.bodyTypes.merge([[0, { name: 'pool', desc: 'Lo-Temp' }],
|
|
75
|
+
[1, { name: 'spa', desc: 'Hi-Temp' }]]);
|
|
76
|
+
}
|
|
77
|
+
// Calculate out the invalid ids.
|
|
78
|
+
// sys.board.equipmentIds.invalidIds.set([]);
|
|
79
|
+
// Add in all the invalid ids from the base personality board.
|
|
80
|
+
sys.board.equipmentIds.invalidIds.set([16, 17, 18]); // These appear to alway be invalid in IntelliTouch.
|
|
81
|
+
// RGS 10-7-21: Since single bodies have hi-temp/lo-temp we will always want ID 1.
|
|
82
|
+
// if (!eq.shared) sys.board.equipmentIds.invalidIds.merge([1]);
|
|
83
|
+
//if (eq.maxCircuits < 9) sys.board.equipmentIds.invalidIds.merge([9]);
|
|
84
|
+
for (let i = 7; i <= 10; i++) {
|
|
85
|
+
// This will add all the invalid ids between 7 and 10 that are omitted for IntelliTouch models.
|
|
86
|
+
// For instance an i7+3 can have up to 8 circuits since 1 and 6 are shared but an i7+3S will only have 7.
|
|
87
|
+
if (i > eq.maxCircuits) sys.board.equipmentIds.invalidIds.merge([i]);
|
|
88
|
+
}
|
|
89
|
+
// This code should be repeated if we ever see a panel with more than one expansion panel.
|
|
90
|
+
let pnl1: ExpansionPanel;
|
|
91
|
+
if ((byte2 & 0x40) === 64) {
|
|
92
|
+
// 64 indicates one expansion panel; SL defaults to i10x but it could also be i5x until we know better
|
|
93
|
+
pnl1 = sys.equipment.expansions.getItemById(1, true);
|
|
94
|
+
pnl1.type = 32;
|
|
95
|
+
let emt = this.valueMaps.expansionBoards.transform(pnl1.type);
|
|
96
|
+
pnl1.name = emt.desc;
|
|
97
|
+
pnl1.isActive = true;
|
|
98
|
+
eq.maxCircuits += emt.circuits;
|
|
99
|
+
}
|
|
100
|
+
else sys.equipment.expansions.removeItemById(1);
|
|
101
|
+
let pnl2: ExpansionPanel;
|
|
102
|
+
if ((byte2 & 0x80) === 128) {
|
|
103
|
+
// SL defaults to i5x but it could also be i10x until we know better
|
|
104
|
+
pnl2 = sys.equipment.expansions.getItemById(2, true);
|
|
105
|
+
pnl2.type = 32;
|
|
106
|
+
let emt = this.valueMaps.expansionBoards.transform(pnl2.type);
|
|
107
|
+
pnl2.name = emt.desc;
|
|
108
|
+
pnl2.isActive = true;
|
|
109
|
+
eq.maxCircuits += emt.circuits;
|
|
110
|
+
}
|
|
111
|
+
else sys.equipment.expansions.removeItemById(2);
|
|
112
|
+
let pnl3: ExpansionPanel;
|
|
113
|
+
if ((byte2 & 0xC0) === 192) {
|
|
114
|
+
// SL defaults to i5x but it could also be i10x until we know better
|
|
115
|
+
pnl3 = sys.equipment.expansions.getItemById(3, true);
|
|
116
|
+
pnl3.type = 32;
|
|
117
|
+
let emt = this.valueMaps.expansionBoards.transform(pnl3.type);
|
|
118
|
+
pnl3.name = emt.desc;
|
|
119
|
+
pnl3.isActive = true;
|
|
120
|
+
eq.maxCircuits += emt.circuits;
|
|
121
|
+
}
|
|
122
|
+
else sys.equipment.expansions.removeItemById(3);
|
|
123
|
+
// Detect the valve expansion module.
|
|
124
|
+
if ((byte2 & 0x20) === 20) {
|
|
125
|
+
// The valve expansion module is installed so this should add 3 valves.
|
|
126
|
+
eq.maxValves += 3;
|
|
127
|
+
let vexp = eq.modules.getItemById(1, true);
|
|
128
|
+
vexp.isActive = true;
|
|
129
|
+
let mt = this.valueMaps.expansionBoards.transform(64);
|
|
130
|
+
vexp.name = mt.name;
|
|
131
|
+
vexp.desc = mt.desc;
|
|
132
|
+
vexp.type = byte1;
|
|
133
|
+
vexp.part = mt.part;
|
|
134
|
+
}
|
|
135
|
+
else eq.modules.removeItemById(1);
|
|
136
|
+
if (byte1 !== 14) sys.board.equipmentIds.invalidIds.merge([10, 19]);
|
|
137
|
+
state.equipment.model = sys.equipment.model = mt.desc;
|
|
138
|
+
state.equipment.controllerType = 'intellitouch';
|
|
139
|
+
sys.equipment.shared ? sys.board.equipmentIds.circuits.start = 1 : sys.board.equipmentIds.circuits.start = 2;
|
|
140
|
+
this.initBodyDefaults();
|
|
141
|
+
this.initHeaterDefaults();
|
|
142
|
+
(async () => {
|
|
143
|
+
try { sys.board.bodies.initFilters(); } catch (err) {
|
|
144
|
+
logger.error(`Error initializing IntelliTouch Filters`);
|
|
145
|
+
}
|
|
146
|
+
})();
|
|
147
|
+
for (let i = 0; i < sys.circuits.length; i++) {
|
|
148
|
+
let c = sys.circuits.getItemByIndex(i);
|
|
149
|
+
if (c.id <= 40) c.master = 0;
|
|
150
|
+
}
|
|
151
|
+
for (let i = 0; i < sys.valves.length; i++) {
|
|
152
|
+
let v = sys.valves.getItemByIndex(i);
|
|
153
|
+
if (v.id < 50) v.master = 0;
|
|
154
|
+
}
|
|
155
|
+
for (let i = 0; i < sys.bodies.length; i++) {
|
|
156
|
+
let b = sys.bodies.getItemByIndex(i);
|
|
157
|
+
b.master = 0;
|
|
158
|
+
}
|
|
159
|
+
state.equipment.maxBodies = sys.equipment.maxBodies;
|
|
160
|
+
state.equipment.maxCircuitGroups = sys.equipment.maxCircuitGroups;
|
|
161
|
+
state.equipment.maxCircuits = sys.equipment.maxCircuits;
|
|
162
|
+
state.equipment.maxFeatures = sys.equipment.maxFeatures;
|
|
163
|
+
state.equipment.maxHeaters = sys.equipment.maxHeaters;
|
|
164
|
+
state.equipment.maxLightGroups = sys.equipment.maxLightGroups;
|
|
165
|
+
state.equipment.maxPumps = sys.equipment.maxPumps;
|
|
166
|
+
state.equipment.maxSchedules = sys.equipment.maxSchedules;
|
|
167
|
+
state.equipment.maxValves = sys.equipment.maxValves;
|
|
168
|
+
state.equipment.shared = sys.equipment.shared;
|
|
169
|
+
state.equipment.dual = sys.equipment.dual;
|
|
170
|
+
state.emitControllerChange();
|
|
171
|
+
}
|
|
172
|
+
public circuits: ITTouchCircuitCommands = new ITTouchCircuitCommands(this);
|
|
173
|
+
public async setControllerType(obj): Promise<Equipment> {
|
|
174
|
+
try {
|
|
175
|
+
if (obj.controllerType !== sys.controllerType) {
|
|
176
|
+
return Promise.reject(new InvalidEquipmentDataError(`You may not change the controller type data for ${sys.controllerType} controllers`, 'controllerType', obj.controllerType));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
let mod = sys.equipment.modules.getItemById(0);
|
|
180
|
+
let mt = this.valueMaps.expansionBoards.get(mod.type);
|
|
181
|
+
let _circuits = mt.circuits;
|
|
182
|
+
let pnl1 = sys.equipment.expansions.getItemById(1);
|
|
183
|
+
if (typeof obj.expansion1 !== 'undefined' && obj.expansion1 !== pnl1.type) {
|
|
184
|
+
let emt = this.valueMaps.expansionBoards.transform(obj.expansion1);
|
|
185
|
+
logger.info(`Changing expansion 1 to ${emt.desc}.`);
|
|
186
|
+
pnl1.type = emt.val;
|
|
187
|
+
pnl1.name = emt.desc;
|
|
188
|
+
pnl1.isActive = true;
|
|
189
|
+
}
|
|
190
|
+
let pnl2 = sys.equipment.expansions.getItemById(2);
|
|
191
|
+
if (typeof obj.expansion2 !== 'undefined' && obj.expansion2 !== pnl2.type) {
|
|
192
|
+
let emt = this.valueMaps.expansionBoards.transform(obj.expansion2);
|
|
193
|
+
logger.info(`Changing expansion 2 to ${emt.desc}.`);
|
|
194
|
+
pnl2.type = emt.val;
|
|
195
|
+
pnl2.name = emt.desc;
|
|
196
|
+
pnl2.isActive = true;
|
|
197
|
+
}
|
|
198
|
+
let pnl3 = sys.equipment.expansions.getItemById(3);
|
|
199
|
+
if (typeof obj.expansion3 !== 'undefined' && obj.expansion3 !== pnl3.type) {
|
|
200
|
+
let emt = this.valueMaps.expansionBoards.transform(obj.expansion3);
|
|
201
|
+
logger.info(`Changing expansion 3 to ${emt.desc}.`);
|
|
202
|
+
pnl3.type = emt.val;
|
|
203
|
+
pnl3.name = emt.desc;
|
|
204
|
+
pnl3.isActive = true;
|
|
205
|
+
}
|
|
206
|
+
let prevMaxCircuits = sys.equipment.maxCircuits;
|
|
207
|
+
if (pnl1.isActive) _circuits += this.valueMaps.expansionBoards.get(pnl1.type).circuits;
|
|
208
|
+
if (pnl2.isActive) _circuits += this.valueMaps.expansionBoards.get(pnl2.type).circuits;
|
|
209
|
+
if (pnl3.isActive) _circuits += this.valueMaps.expansionBoards.get(pnl3.type).circuits;
|
|
210
|
+
if (_circuits < prevMaxCircuits) {
|
|
211
|
+
// if we downsize expansions, remove circuits
|
|
212
|
+
for (let i = _circuits + 1; i <= prevMaxCircuits; i++) {
|
|
213
|
+
sys.circuits.removeItemById(i);
|
|
214
|
+
state.circuits.removeItemById(i);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
else if (_circuits > prevMaxCircuits) {
|
|
218
|
+
this._configQueue.queueChanges();
|
|
219
|
+
}
|
|
220
|
+
sys.equipment.maxCircuits = _circuits;
|
|
221
|
+
return sys.equipment;
|
|
222
|
+
} catch (err) {
|
|
223
|
+
logger.error(`Error setting expansion panels: ${err.message}`);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
class ITTouchConfigQueue extends TouchConfigQueue {
|
|
228
|
+
public queueChanges() {
|
|
229
|
+
this.reset();
|
|
230
|
+
if (conn.mockPort) {
|
|
231
|
+
logger.info(`Skipping configuration request from OCP because MockPort enabled.`);
|
|
232
|
+
} else {
|
|
233
|
+
logger.info(`Requesting ${sys.controllerType} configuration`);
|
|
234
|
+
this.queueItems(GetTouchConfigCategories.dateTime, [0]);
|
|
235
|
+
this.queueItems(GetTouchConfigCategories.heatTemperature, [0]);
|
|
236
|
+
this.queueItems(GetTouchConfigCategories.solarHeatPump, [0]);
|
|
237
|
+
this.queueRange(GetTouchConfigCategories.customNames, 0, sys.equipment.maxCustomNames - 1);
|
|
238
|
+
this.queueRange(GetTouchConfigCategories.circuits, 1, sys.equipment.maxCircuits); // circuits
|
|
239
|
+
this.queueRange(GetTouchConfigCategories.circuits, 41, 41 + sys.equipment.maxFeatures); // features
|
|
240
|
+
this.queueRange(GetTouchConfigCategories.schedules, 1, sys.equipment.maxSchedules);
|
|
241
|
+
this.queueItems(GetTouchConfigCategories.delays, [0]);
|
|
242
|
+
this.queueItems(GetTouchConfigCategories.settings, [0]);
|
|
243
|
+
this.queueItems(GetTouchConfigCategories.intellifloSpaSideRemotes, [0]);
|
|
244
|
+
this.queueItems(GetTouchConfigCategories.is4is10, [0]);
|
|
245
|
+
this.queueItems(GetTouchConfigCategories.spaSideRemote, [0]);
|
|
246
|
+
this.queueItems(GetTouchConfigCategories.valves, [0]);
|
|
247
|
+
this.queueItems(GetTouchConfigCategories.lightGroupPositions);
|
|
248
|
+
this.queueItems(GetTouchConfigCategories.highSpeedCircuits, [0]);
|
|
249
|
+
this.queueRange(GetTouchConfigCategories.pumpConfig, 1, sys.equipment.maxPumps);
|
|
250
|
+
this.queueRange(GetTouchConfigCategories.circuitGroups, 0, sys.equipment.maxFeatures - 1);
|
|
251
|
+
// items not required by ScreenLogic
|
|
252
|
+
if (sys.chlorinators.getItemById(1).isActive)
|
|
253
|
+
this.queueItems(GetTouchConfigCategories.intellichlor, [0]);
|
|
254
|
+
}
|
|
255
|
+
if (this.remainingItems > 0) {
|
|
256
|
+
var self = this;
|
|
257
|
+
setTimeout(() => { self.processNext(); }, 50);
|
|
258
|
+
} else state.status = 1;
|
|
259
|
+
state.emitControllerChange();
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
class ITTouchCircuitCommands extends TouchCircuitCommands {
|
|
263
|
+
public async setCircuitGroupStateAsync(id: number, val: boolean): Promise<ICircuitGroupState> {
|
|
264
|
+
// intellitouch supports groups/macros with id's 41-50 with a macro flag
|
|
265
|
+
let grp = sys.circuitGroups.getItemById(id, false, { isActive: false });
|
|
266
|
+
return new Promise<ICircuitGroupState>(async (resolve, reject) => {
|
|
267
|
+
try {
|
|
268
|
+
await sys.board.circuits.setCircuitStateAsync(id, val);
|
|
269
|
+
resolve(state.circuitGroups.getInterfaceById(id));
|
|
270
|
+
}
|
|
271
|
+
catch (err) { reject(err); }
|
|
272
|
+
});
|
|
273
|
+
}
|
|
242
274
|
}
|