nodejs-poolcontroller 8.1.2 → 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.
Files changed (106) hide show
  1. package/.eslintrc.json +36 -36
  2. package/.github/ISSUE_TEMPLATE/1-bug-report.yml +84 -84
  3. package/.github/ISSUE_TEMPLATE/2-docs.md +12 -12
  4. package/.github/ISSUE_TEMPLATE/3-proposal.md +28 -28
  5. package/.github/ISSUE_TEMPLATE/config.yml +8 -8
  6. package/.github/copilot-instructions.md +63 -0
  7. package/.github/workflows/ghcr-publish.yml +67 -0
  8. package/AGENTS.md +597 -0
  9. package/CONTRIBUTING.md +74 -74
  10. package/Changelog +292 -257
  11. package/Dockerfile +62 -19
  12. package/Gruntfile.js +40 -40
  13. package/LICENSE +661 -661
  14. package/README.md +318 -191
  15. package/anslq25/MessagesMock.ts +221 -221
  16. package/anslq25/boards/MockBoardFactory.ts +49 -49
  17. package/anslq25/boards/MockEasyTouchBoard.ts +696 -696
  18. package/anslq25/boards/MockSystemBoard.ts +216 -216
  19. package/anslq25/chemistry/MockChlorinator.ts +98 -98
  20. package/anslq25/pumps/MockPump.ts +83 -83
  21. package/app.ts +115 -115
  22. package/config/Config.ts +57 -7
  23. package/config/VersionCheck.ts +63 -35
  24. package/controller/Constants.ts +809 -805
  25. package/controller/Equipment.ts +2688 -2664
  26. package/controller/Errors.ts +181 -181
  27. package/controller/Lockouts.ts +549 -549
  28. package/controller/State.ts +3738 -3690
  29. package/controller/boards/AquaLinkBoard.ts +1003 -1003
  30. package/controller/boards/BoardFactory.ts +53 -53
  31. package/controller/boards/EasyTouchBoard.ts +3202 -3202
  32. package/controller/boards/IntelliCenterBoard.ts +4393 -3899
  33. package/controller/boards/IntelliComBoard.ts +69 -69
  34. package/controller/boards/IntelliTouchBoard.ts +382 -382
  35. package/controller/boards/NixieBoard.ts +1944 -1929
  36. package/controller/boards/SunTouchBoard.ts +400 -400
  37. package/controller/boards/SystemBoard.ts +5268 -5268
  38. package/controller/comms/Comms.ts +1272 -1214
  39. package/controller/comms/ScreenLogic.ts +1665 -1665
  40. package/controller/comms/messages/Messages.ts +1433 -1243
  41. package/controller/comms/messages/config/ChlorinatorMessage.ts +5 -0
  42. package/controller/comms/messages/config/CircuitGroupMessage.ts +0 -0
  43. package/controller/comms/messages/config/CircuitMessage.ts +0 -0
  44. package/controller/comms/messages/config/ConfigMessage.ts +6 -0
  45. package/controller/comms/messages/config/CoverMessage.ts +0 -0
  46. package/controller/comms/messages/config/CustomNameMessage.ts +31 -31
  47. package/controller/comms/messages/config/EquipmentMessage.ts +216 -210
  48. package/controller/comms/messages/config/ExternalMessage.ts +96 -10
  49. package/controller/comms/messages/config/FeatureMessage.ts +0 -0
  50. package/controller/comms/messages/config/GeneralMessage.ts +0 -0
  51. package/controller/comms/messages/config/HeaterMessage.ts +0 -0
  52. package/controller/comms/messages/config/IntellichemMessage.ts +0 -0
  53. package/controller/comms/messages/config/OptionsMessage.ts +194 -174
  54. package/controller/comms/messages/config/PumpMessage.ts +0 -0
  55. package/controller/comms/messages/config/RemoteMessage.ts +0 -0
  56. package/controller/comms/messages/config/ScheduleMessage.ts +401 -390
  57. package/controller/comms/messages/config/SecurityMessage.ts +0 -0
  58. package/controller/comms/messages/config/ValveMessage.ts +0 -0
  59. package/controller/comms/messages/status/ChlorinatorStateMessage.ts +0 -0
  60. package/controller/comms/messages/status/EquipmentStateMessage.ts +1158 -822
  61. package/controller/comms/messages/status/HeaterStateMessage.ts +135 -135
  62. package/controller/comms/messages/status/IntelliChemStateMessage.ts +448 -448
  63. package/controller/comms/messages/status/IntelliValveStateMessage.ts +36 -36
  64. package/controller/comms/messages/status/PumpStateMessage.ts +0 -0
  65. package/controller/comms/messages/status/RegalModbusStateMessage.ts +411 -0
  66. package/controller/comms/messages/status/VersionMessage.ts +103 -41
  67. package/controller/nixie/Nixie.ts +173 -173
  68. package/controller/nixie/NixieEquipment.ts +104 -104
  69. package/controller/nixie/bodies/Body.ts +120 -120
  70. package/controller/nixie/bodies/Filter.ts +135 -135
  71. package/controller/nixie/chemistry/ChemController.ts +2724 -2724
  72. package/controller/nixie/chemistry/ChemDoser.ts +806 -806
  73. package/controller/nixie/chemistry/Chlorinator.ts +367 -367
  74. package/controller/nixie/circuits/Circuit.ts +478 -478
  75. package/controller/nixie/heaters/Heater.ts +834 -834
  76. package/controller/nixie/pumps/Pump.ts +1194 -996
  77. package/controller/nixie/schedules/Schedule.ts +401 -401
  78. package/controller/nixie/valves/Valve.ts +170 -170
  79. package/defaultConfig.json +352 -347
  80. package/docker-compose.yml +32 -0
  81. package/logger/DataLogger.ts +448 -448
  82. package/logger/Logger.ts +448 -436
  83. package/package.json +58 -60
  84. package/sendSocket.js +32 -32
  85. package/tsconfig.json +25 -25
  86. package/types/express-multer.d.ts +32 -0
  87. package/web/Server.ts +1937 -1927
  88. package/web/bindings/aqualinkD.json +559 -559
  89. package/web/bindings/influxDB.json +1066 -1066
  90. package/web/bindings/mqtt.json +721 -721
  91. package/web/bindings/mqttAlt.json +746 -746
  92. package/web/bindings/rulesManager.json +54 -54
  93. package/web/bindings/smartThings-Hubitat.json +31 -31
  94. package/web/bindings/valveRelays.json +20 -20
  95. package/web/bindings/vera.json +25 -25
  96. package/web/interfaces/baseInterface.ts +188 -188
  97. package/web/interfaces/httpInterface.ts +148 -148
  98. package/web/interfaces/influxInterface.ts +283 -283
  99. package/web/interfaces/mqttInterface.ts +695 -695
  100. package/web/interfaces/ruleInterface.ts +101 -87
  101. package/web/services/config/Config.ts +1063 -1053
  102. package/web/services/config/ConfigSocket.ts +0 -0
  103. package/web/services/state/State.ts +0 -0
  104. package/web/services/state/StateSocket.ts +0 -0
  105. package/web/services/utilities/Utilities.ts +233 -233
  106. package/.github/workflows/docker-publish-njsPC-linux.yml +0 -50
@@ -1,136 +1,136 @@
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
- export class HeaterStateMessage {
23
- public static process(msg: Inbound) {
24
- if (msg.protocol === Protocol.Heater) {
25
- switch (msg.action) {
26
- case 112: // This is a message from a master controlling MasterTemp or UltraTemp ETi
27
- break;
28
- case 114: // This is a message from a master controlling UltraTemp
29
- msg.isProcessed = true;
30
- break;
31
- case 113:
32
- HeaterStateMessage.processHybridStatus(msg);
33
- break;
34
- case 116:
35
- HeaterStateMessage.processMasterTempStatus(msg);
36
- break;
37
- case 115:
38
- HeaterStateMessage.processUltraTempStatus(msg);
39
- break;
40
- }
41
- }
42
- }
43
- public static processHeaterCommand(msg: Inbound) {
44
- let heater: Heater = sys.heaters.getItemByAddress(msg.source);
45
- // At this point there is no other configuration data for ET
46
- if (sys.controllerType === ControllerType.EasyTouch) {
47
- let htype = sys.board.valueMaps.heaterTypes.transform(heater.type);
48
- switch (htype.name) {
49
- case 'hybrid':
50
- heater.economyTime = msg.extractPayloadByte(3);
51
- heater.maxBoostTemp = msg.extractPayloadByte(4);
52
- break;
53
- }
54
- }
55
- }
56
- public static processHybridStatus(msg: Inbound) {
57
- //[165, 0, 16, 112, 113, 10][1, 1, 0, 0, 0, 0, 0, 0, 0, 0][1, 162]
58
- let heater: Heater = sys.heaters.getItemByAddress(msg.source);
59
- let sheater = state.heaters.getItemById(heater.id);
60
- sheater.isOn = msg.extractPayloadByte(0) > 0;
61
- if (heater.master > 0) {
62
- let sbody = sheater.bodyId > 0 ? state.temps.bodies.getItemById(sheater.bodyId) : undefined;
63
- if (typeof sbody !== 'undefined') {
64
- switch (msg.extractPayloadByte(1)) {
65
- case 1:
66
- sbody.heatStatus = sys.board.valueMaps.heatStatus.getValue('hpheat');
67
- break;
68
- case 2:
69
- sbody.heatStatus = sys.board.valueMaps.heatStatus.getValue('heater');
70
- break;
71
- case 3:
72
- sbody.heatStatus = sys.board.valueMaps.heatStatus.getValue('dual');
73
- break;
74
- case 4:
75
- sbody.heatStatus = sys.board.valueMaps.heatStatus.getValue('dual');
76
- break;
77
- default:
78
- sbody.heatStatus = sys.board.valueMaps.heatStatus.getValue('off');
79
- break;
80
- }
81
- }
82
- }
83
- sheater.commStatus = 0;
84
- state.equipment.messages.removeItemByCode(`heater:${heater.id}:comms`);
85
- msg.isProcessed = true;
86
- }
87
- public static processUltraTempStatus(msg: Inbound) {
88
- // RKS: 07-03-21 - We only know byte 2 at this point for Ultratemp for the 115 message we are processing here. The
89
- // byte description
90
- // ------------------------------------------------
91
- // 0 Unknown (always seems to be 160 for response)
92
- // 1 Unknown (always 1)
93
- // 2 Current heater status 0=off, 1=heat, 2=cool
94
- // 3-9 Unknown
95
-
96
- // 114 message - outbound response
97
- //[165, 0, 112, 16, 114, 10][144, 0, 0, 0, 0, 0, 0, 0, 0, 0][2, 49] // OCP to Heater
98
- // byte description
99
- // ------------------------------------------------
100
- // 0 Unknown (always seems to be 144 for request)
101
- // 1 Current heater status 0=off, 1=heat, 2=cool
102
- // 3 Believed to be ofset temp
103
- // 4-9 Unknown
104
-
105
- // byto 0: always seems to be 144 for outbound
106
- // byte 1: Sets heater mode to 0 = Off 1 = Heat 2 = Cool
107
- //[165, 0, 16, 112, 115, 10][160, 1, 0, 3, 0, 0, 0, 0, 0, 0][2, 70] // Heater Reply
108
- let heater: Heater = sys.heaters.getItemByAddress(msg.source);
109
- let sheater = state.heaters.getItemById(heater.id);
110
- let byte = msg.extractPayloadByte(2);
111
- sheater.isOn = byte >= 1;
112
- sheater.isCooling = byte === 2;
113
- sheater.commStatus = 0;
114
- state.equipment.messages.removeItemByCode(`heater:${heater.id}:comms`);
115
- msg.isProcessed = true;
116
- }
117
- public static processMasterTempStatus(msg: Inbound) {
118
- //[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]
119
- // Byte 1 is the indicator to which setpoint it is heating to.
120
- // Byte 8 increments over time when the heater is on.
121
- // Byte 13 looks like the mode the heater is in for instance it is in cooldown mode.
122
- // 0 = Normal
123
- // 2 = ??????
124
- // 6 = Cooldown
125
- // Byte 14 looks like the cooldown delay in minutes.
126
- let heater: Heater = sys.heaters.getItemByAddress(msg.source);
127
- let sheater = state.heaters.getItemById(heater.id);
128
- let byte = msg.extractPayloadByte(1);
129
- sheater.isOn = byte >= 1;
130
- sheater.isCooling = false;
131
- sheater.commStatus = 0;
132
- state.equipment.messages.removeItemByCode(`heater:${heater.id}:comms`);
133
- msg.isProcessed = true;
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
+
22
+ export class HeaterStateMessage {
23
+ public static process(msg: Inbound) {
24
+ if (msg.protocol === Protocol.Heater) {
25
+ switch (msg.action) {
26
+ case 112: // This is a message from a master controlling MasterTemp or UltraTemp ETi
27
+ break;
28
+ case 114: // This is a message from a master controlling UltraTemp
29
+ msg.isProcessed = true;
30
+ break;
31
+ case 113:
32
+ HeaterStateMessage.processHybridStatus(msg);
33
+ break;
34
+ case 116:
35
+ HeaterStateMessage.processMasterTempStatus(msg);
36
+ break;
37
+ case 115:
38
+ HeaterStateMessage.processUltraTempStatus(msg);
39
+ break;
40
+ }
41
+ }
42
+ }
43
+ public static processHeaterCommand(msg: Inbound) {
44
+ let heater: Heater = sys.heaters.getItemByAddress(msg.source);
45
+ // At this point there is no other configuration data for ET
46
+ if (sys.controllerType === ControllerType.EasyTouch) {
47
+ let htype = sys.board.valueMaps.heaterTypes.transform(heater.type);
48
+ switch (htype.name) {
49
+ case 'hybrid':
50
+ heater.economyTime = msg.extractPayloadByte(3);
51
+ heater.maxBoostTemp = msg.extractPayloadByte(4);
52
+ break;
53
+ }
54
+ }
55
+ }
56
+ public static processHybridStatus(msg: Inbound) {
57
+ //[165, 0, 16, 112, 113, 10][1, 1, 0, 0, 0, 0, 0, 0, 0, 0][1, 162]
58
+ let heater: Heater = sys.heaters.getItemByAddress(msg.source);
59
+ let sheater = state.heaters.getItemById(heater.id);
60
+ sheater.isOn = msg.extractPayloadByte(0) > 0;
61
+ if (heater.master > 0) {
62
+ let sbody = sheater.bodyId > 0 ? state.temps.bodies.getItemById(sheater.bodyId) : undefined;
63
+ if (typeof sbody !== 'undefined') {
64
+ switch (msg.extractPayloadByte(1)) {
65
+ case 1:
66
+ sbody.heatStatus = sys.board.valueMaps.heatStatus.getValue('hpheat');
67
+ break;
68
+ case 2:
69
+ sbody.heatStatus = sys.board.valueMaps.heatStatus.getValue('heater');
70
+ break;
71
+ case 3:
72
+ sbody.heatStatus = sys.board.valueMaps.heatStatus.getValue('dual');
73
+ break;
74
+ case 4:
75
+ sbody.heatStatus = sys.board.valueMaps.heatStatus.getValue('dual');
76
+ break;
77
+ default:
78
+ sbody.heatStatus = sys.board.valueMaps.heatStatus.getValue('off');
79
+ break;
80
+ }
81
+ }
82
+ }
83
+ sheater.commStatus = 0;
84
+ state.equipment.messages.removeItemByCode(`heater:${heater.id}:comms`);
85
+ msg.isProcessed = true;
86
+ }
87
+ public static processUltraTempStatus(msg: Inbound) {
88
+ // RKS: 07-03-21 - We only know byte 2 at this point for Ultratemp for the 115 message we are processing here. The
89
+ // byte description
90
+ // ------------------------------------------------
91
+ // 0 Unknown (always seems to be 160 for response)
92
+ // 1 Unknown (always 1)
93
+ // 2 Current heater status 0=off, 1=heat, 2=cool
94
+ // 3-9 Unknown
95
+
96
+ // 114 message - outbound response
97
+ //[165, 0, 112, 16, 114, 10][144, 0, 0, 0, 0, 0, 0, 0, 0, 0][2, 49] // OCP to Heater
98
+ // byte description
99
+ // ------------------------------------------------
100
+ // 0 Unknown (always seems to be 144 for request)
101
+ // 1 Current heater status 0=off, 1=heat, 2=cool
102
+ // 3 Believed to be ofset temp
103
+ // 4-9 Unknown
104
+
105
+ // byto 0: always seems to be 144 for outbound
106
+ // byte 1: Sets heater mode to 0 = Off 1 = Heat 2 = Cool
107
+ //[165, 0, 16, 112, 115, 10][160, 1, 0, 3, 0, 0, 0, 0, 0, 0][2, 70] // Heater Reply
108
+ let heater: Heater = sys.heaters.getItemByAddress(msg.source);
109
+ let sheater = state.heaters.getItemById(heater.id);
110
+ let byte = msg.extractPayloadByte(2);
111
+ sheater.isOn = byte >= 1;
112
+ sheater.isCooling = byte === 2;
113
+ sheater.commStatus = 0;
114
+ state.equipment.messages.removeItemByCode(`heater:${heater.id}:comms`);
115
+ msg.isProcessed = true;
116
+ }
117
+ public static processMasterTempStatus(msg: Inbound) {
118
+ //[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]
119
+ // Byte 1 is the indicator to which setpoint it is heating to.
120
+ // Byte 8 increments over time when the heater is on.
121
+ // Byte 13 looks like the mode the heater is in for instance it is in cooldown mode.
122
+ // 0 = Normal
123
+ // 2 = ??????
124
+ // 6 = Cooldown
125
+ // Byte 14 looks like the cooldown delay in minutes.
126
+ let heater: Heater = sys.heaters.getItemByAddress(msg.source);
127
+ let sheater = state.heaters.getItemById(heater.id);
128
+ let byte = msg.extractPayloadByte(1);
129
+ sheater.isOn = byte >= 1;
130
+ sheater.isCooling = false;
131
+ sheater.commStatus = 0;
132
+ state.equipment.messages.removeItemByCode(`heater:${heater.id}:comms`);
133
+ msg.isProcessed = true;
134
+ }
135
+
136
136
  }