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,136 +1,148 @@
|
|
|
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, Protocol } from "../Messages";
|
|
19
|
-
import { state, BodyTempState, HeaterState } from "../../../State";
|
|
20
|
-
import { sys, ControllerType, Heater } from "../../../Equipment";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
heater.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
let
|
|
60
|
-
sheater
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
let
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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, Protocol } from "../Messages";
|
|
19
|
+
import { state, BodyTempState, HeaterState } from "../../../State";
|
|
20
|
+
import { sys, ControllerType, Heater } from "../../../Equipment";
|
|
21
|
+
import { logger } from '../../../../logger/Logger';
|
|
22
|
+
|
|
23
|
+
export class HeaterStateMessage {
|
|
24
|
+
public static process(msg: Inbound) {
|
|
25
|
+
if (msg.protocol === Protocol.Heater) {
|
|
26
|
+
switch (msg.action) {
|
|
27
|
+
case 112: // This is a message from a master controlling MasterTemp or UltraTemp ETi
|
|
28
|
+
break;
|
|
29
|
+
case 114: // This is a message from a master controlling UltraTemp
|
|
30
|
+
msg.isProcessed = true;
|
|
31
|
+
break;
|
|
32
|
+
case 113:
|
|
33
|
+
HeaterStateMessage.processHybridStatus(msg);
|
|
34
|
+
break;
|
|
35
|
+
case 116:
|
|
36
|
+
HeaterStateMessage.processMasterTempStatus(msg);
|
|
37
|
+
break;
|
|
38
|
+
case 115:
|
|
39
|
+
HeaterStateMessage.processUltraTempStatus(msg);
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
public static processHeaterCommand(msg: Inbound) {
|
|
45
|
+
let heater: Heater = sys.heaters.getItemByAddress(msg.source);
|
|
46
|
+
// At this point there is no other configuration data for ET
|
|
47
|
+
if (sys.controllerType === ControllerType.EasyTouch) {
|
|
48
|
+
let htype = sys.board.valueMaps.heaterTypes.transform(heater.type);
|
|
49
|
+
switch (htype.name) {
|
|
50
|
+
case 'hybrid':
|
|
51
|
+
heater.economyTime = msg.extractPayloadByte(3);
|
|
52
|
+
heater.maxBoostTemp = msg.extractPayloadByte(4);
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
public static processHybridStatus(msg: Inbound) {
|
|
58
|
+
//[165, 0, 16, 112, 113, 10][1, 1, 0, 0, 0, 0, 0, 0, 0, 0][1, 162]
|
|
59
|
+
let heater: Heater = sys.heaters.getItemByAddress(msg.source);
|
|
60
|
+
let sheater = state.heaters.getItemById(heater.id);
|
|
61
|
+
sheater.isOn = msg.extractPayloadByte(0) > 0;
|
|
62
|
+
if (heater.master > 0) {
|
|
63
|
+
let sbody = sheater.bodyId > 0 ? state.temps.bodies.getItemById(sheater.bodyId) : undefined;
|
|
64
|
+
if (typeof sbody !== 'undefined') {
|
|
65
|
+
switch (msg.extractPayloadByte(1)) {
|
|
66
|
+
case 1:
|
|
67
|
+
sbody.heatStatus = sys.board.valueMaps.heatStatus.getValue('hpheat');
|
|
68
|
+
break;
|
|
69
|
+
case 2:
|
|
70
|
+
sbody.heatStatus = sys.board.valueMaps.heatStatus.getValue('heater');
|
|
71
|
+
break;
|
|
72
|
+
case 3:
|
|
73
|
+
sbody.heatStatus = sys.board.valueMaps.heatStatus.getValue('dual');
|
|
74
|
+
break;
|
|
75
|
+
case 4:
|
|
76
|
+
sbody.heatStatus = sys.board.valueMaps.heatStatus.getValue('dual');
|
|
77
|
+
break;
|
|
78
|
+
default:
|
|
79
|
+
sbody.heatStatus = sys.board.valueMaps.heatStatus.getValue('off');
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
sheater.commStatus = 0;
|
|
85
|
+
state.equipment.messages.removeItemByCode(`heater:${heater.id}:comms`);
|
|
86
|
+
msg.isProcessed = true;
|
|
87
|
+
}
|
|
88
|
+
public static processUltraTempStatus(msg: Inbound) {
|
|
89
|
+
// RKS: 07-03-21 - UltraTemp RS-485 protocol reverse engineering notes.
|
|
90
|
+
// The heat pump communicates via Action 114 (command) / 115 (response) messages.
|
|
91
|
+
//
|
|
92
|
+
// Action 115 - inbound response (heat pump -> controller, heartbeat every ~1s)
|
|
93
|
+
// [165, 0, 16, 112, 115, 10][160, 1, 0, 3, 0, 0, 0, 0, 0, 0][2, 70]
|
|
94
|
+
// byte description
|
|
95
|
+
// ------------------------------------------------
|
|
96
|
+
// 0 Always 160 for response
|
|
97
|
+
// 1 Always 1
|
|
98
|
+
// 2 Current heater status: 0=off, 1=heat, 2=cool
|
|
99
|
+
// 3 Believed to be offset temp
|
|
100
|
+
// 4-9 Unknown
|
|
101
|
+
//
|
|
102
|
+
// Action 114 - outbound command (controller -> heat pump)
|
|
103
|
+
// [165, 0, 112, 16, 114, 10][144, 0, 0, 0, 0, 0, 0, 0, 0, 0][2, 49]
|
|
104
|
+
// byte description
|
|
105
|
+
// ------------------------------------------------
|
|
106
|
+
// 0 Always 144 for request
|
|
107
|
+
// 1 Sets heater mode: 0=off, 1=heat, 2=cool
|
|
108
|
+
// 3 Believed to be offset temp
|
|
109
|
+
// 4-9 Unknown
|
|
110
|
+
let heater: Heater = sys.heaters.getItemByAddress(msg.source);
|
|
111
|
+
if (typeof heater === 'undefined' || !heater.isActive) {
|
|
112
|
+
// Heat pump not configured for this address
|
|
113
|
+
msg.isProcessed = true;
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
let sheater = state.heaters.getItemById(heater.id);
|
|
117
|
+
let byte = msg.extractPayloadByte(2);
|
|
118
|
+
let prevOn = sheater.isOn;
|
|
119
|
+
let prevCooling = sheater.isCooling;
|
|
120
|
+
sheater.isOn = byte >= 1;
|
|
121
|
+
sheater.isCooling = byte === 2;
|
|
122
|
+
sheater.commStatus = 0;
|
|
123
|
+
state.equipment.messages.removeItemByCode(`heater:${heater.id}:comms`);
|
|
124
|
+
if (prevOn !== sheater.isOn || prevCooling !== sheater.isCooling) {
|
|
125
|
+
logger.info(`UltraTemp heartbeat: src=${msg.source} status=${byte} (${byte === 0 ? 'OFF' : byte === 1 ? 'HEAT' : 'COOL'}) heater=${heater.name}`);
|
|
126
|
+
}
|
|
127
|
+
msg.isProcessed = true;
|
|
128
|
+
}
|
|
129
|
+
public static processMasterTempStatus(msg: Inbound) {
|
|
130
|
+
//[255, 0, 255][165, 0, 16, 112, 116, 23][67, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 10, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0][2, 66]
|
|
131
|
+
// Byte 1 is the indicator to which setpoint it is heating to.
|
|
132
|
+
// Byte 8 increments over time when the heater is on.
|
|
133
|
+
// Byte 13 looks like the mode the heater is in for instance it is in cooldown mode.
|
|
134
|
+
// 0 = Normal
|
|
135
|
+
// 2 = ??????
|
|
136
|
+
// 6 = Cooldown
|
|
137
|
+
// Byte 14 looks like the cooldown delay in minutes.
|
|
138
|
+
let heater: Heater = sys.heaters.getItemByAddress(msg.source);
|
|
139
|
+
let sheater = state.heaters.getItemById(heater.id);
|
|
140
|
+
let byte = msg.extractPayloadByte(1);
|
|
141
|
+
sheater.isOn = byte >= 1;
|
|
142
|
+
sheater.isCooling = false;
|
|
143
|
+
sheater.commStatus = 0;
|
|
144
|
+
state.equipment.messages.removeItemByCode(`heater:${heater.id}:comms`);
|
|
145
|
+
msg.isProcessed = true;
|
|
146
|
+
}
|
|
147
|
+
|
|
136
148
|
}
|