nodejs-poolcontroller 7.5.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.
Files changed (64) hide show
  1. package/.github/ISSUE_TEMPLATE/1-bug-report.yml +84 -0
  2. package/.github/ISSUE_TEMPLATE/2-docs.md +12 -0
  3. package/.github/ISSUE_TEMPLATE/3-proposal.md +28 -0
  4. package/.github/ISSUE_TEMPLATE/config.yml +8 -0
  5. package/Changelog +19 -0
  6. package/Dockerfile +3 -3
  7. package/README.md +13 -8
  8. package/app.ts +1 -1
  9. package/config/Config.ts +38 -2
  10. package/config/VersionCheck.ts +27 -12
  11. package/controller/Constants.ts +2 -1
  12. package/controller/Equipment.ts +193 -9
  13. package/controller/Errors.ts +10 -0
  14. package/controller/Lockouts.ts +503 -0
  15. package/controller/State.ts +269 -64
  16. package/controller/boards/AquaLinkBoard.ts +1000 -0
  17. package/controller/boards/BoardFactory.ts +4 -0
  18. package/controller/boards/EasyTouchBoard.ts +468 -144
  19. package/controller/boards/IntelliCenterBoard.ts +466 -307
  20. package/controller/boards/IntelliTouchBoard.ts +37 -5
  21. package/controller/boards/NixieBoard.ts +671 -141
  22. package/controller/boards/SystemBoard.ts +1397 -641
  23. package/controller/comms/Comms.ts +462 -362
  24. package/controller/comms/messages/Messages.ts +174 -30
  25. package/controller/comms/messages/config/ChlorinatorMessage.ts +6 -3
  26. package/controller/comms/messages/config/CircuitMessage.ts +1 -0
  27. package/controller/comms/messages/config/ExternalMessage.ts +10 -8
  28. package/controller/comms/messages/config/HeaterMessage.ts +141 -29
  29. package/controller/comms/messages/config/OptionsMessage.ts +9 -2
  30. package/controller/comms/messages/config/PumpMessage.ts +53 -35
  31. package/controller/comms/messages/config/ScheduleMessage.ts +33 -25
  32. package/controller/comms/messages/config/ValveMessage.ts +2 -2
  33. package/controller/comms/messages/status/ChlorinatorStateMessage.ts +38 -86
  34. package/controller/comms/messages/status/EquipmentStateMessage.ts +59 -23
  35. package/controller/comms/messages/status/HeaterStateMessage.ts +57 -3
  36. package/controller/comms/messages/status/IntelliChemStateMessage.ts +56 -8
  37. package/controller/comms/messages/status/PumpStateMessage.ts +23 -1
  38. package/controller/nixie/Nixie.ts +1 -1
  39. package/controller/nixie/bodies/Body.ts +3 -0
  40. package/controller/nixie/chemistry/ChemController.ts +164 -51
  41. package/controller/nixie/chemistry/Chlorinator.ts +137 -88
  42. package/controller/nixie/circuits/Circuit.ts +51 -19
  43. package/controller/nixie/heaters/Heater.ts +241 -31
  44. package/controller/nixie/pumps/Pump.ts +488 -206
  45. package/controller/nixie/schedules/Schedule.ts +91 -35
  46. package/controller/nixie/valves/Valve.ts +1 -1
  47. package/defaultConfig.json +20 -0
  48. package/package.json +21 -21
  49. package/web/Server.ts +94 -49
  50. package/web/bindings/aqualinkD.json +505 -0
  51. package/web/bindings/influxDB.json +71 -1
  52. package/web/bindings/mqtt.json +98 -39
  53. package/web/bindings/mqttAlt.json +59 -1
  54. package/web/interfaces/baseInterface.ts +1 -0
  55. package/web/interfaces/httpInterface.ts +23 -2
  56. package/web/interfaces/influxInterface.ts +45 -10
  57. package/web/interfaces/mqttInterface.ts +114 -54
  58. package/web/services/config/Config.ts +55 -132
  59. package/web/services/state/State.ts +81 -4
  60. package/web/services/state/StateSocket.ts +4 -4
  61. package/web/services/utilities/Utilities.ts +8 -6
  62. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -52
  63. package/config copy.json +0 -300
  64. package/issue_template.md +0 -52
@@ -0,0 +1,84 @@
1
+ name: "\U0001F41B Bug report"
2
+ description: Create a report to help us improve
3
+ title: '[BUG] '
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ Thank you for reporting an issue. Most issues can be more readily resolved by attaching a Packet Capture. Follow the instructions to complete a [packet capture](https://github.com/tagyoureit/nodejs-poolController/wiki/How-to-capture-all-packets-for-issue-resolution) and attach the resulting zip/log files.
9
+
10
+ If you require more general support please file an start a discussion on our discussion board https://github.com/tagyoureit/nodejs-poolController/discussions
11
+
12
+ Having trouble installing? Be sure to check out the wiki! https://github.com/tagyoureit/nodejs-poolController/wiki
13
+
14
+ Please fill in as much of the form below as you're able.
15
+ - type: input
16
+ attributes:
17
+ label: nodejs-poolController Version/commit
18
+ description: can be viewed under dashPanel. Hamburger menu => System.
19
+ validations:
20
+ required: true
21
+ - type: input
22
+ attributes:
23
+ label: nodejs-poolController-dashPanel Version/commit
24
+ description: if applicable
25
+ - type: input
26
+ attributes:
27
+ label: relayEquipmentManager Version/commit
28
+ description: if applicable
29
+ - type: input
30
+ attributes:
31
+ label: Node Version
32
+ description: Output of `node -v`
33
+ - type: input
34
+ attributes:
35
+ label: Platform
36
+ description: |
37
+ UNIX: output of `uname -a`
38
+ Windows: output of `"$([Environment]::OSVersion | ForEach-Object VersionString) $(if ([Environment]::Is64BitOperatingSystem) { "x64" } else { "x86" })"` in PowerShell console
39
+ - type: input
40
+ attributes:
41
+ label: RS485 Adapter
42
+ description: Elfin? JBTek?
43
+ - type: checkboxes
44
+ attributes:
45
+ label: Are you using Docker?
46
+ options:
47
+ - label: Yes.
48
+ - type: input
49
+ attributes:
50
+ label: OCP
51
+ description: Outdoor Control Panel. Eg EasyTouch2 8P, Intellicenter i5PS, none.
52
+ placeholder: None / Nixie (standalone setup)
53
+ - type: input
54
+ attributes:
55
+ label: Pump(s)
56
+ description: Please list all pumps. EG Intelliflo 2 VST, Intelliflo VS
57
+ placeholder: Intelliflo VS
58
+ - type: input
59
+ attributes:
60
+ label: Chlorinator(s)
61
+ description: Please list all chlorinators. EG Intellichlor IC-40, Aquarite, None
62
+ placeholder: None
63
+ - type: textarea
64
+ attributes:
65
+ label: What steps will reproduce the bug?
66
+ description: Enter details about your bug, preferably a simple code snippet that can be run using `node` directly without installing third-party dependencies.
67
+ validations:
68
+ required: true
69
+ - type: textarea
70
+ attributes:
71
+ label: What happens?
72
+ description: If possible please provide textual output instead of screenshots.
73
+ validations:
74
+ required: true
75
+ - type: textarea
76
+ attributes:
77
+ label: What should have happened?
78
+ description: If possible please provide textual output instead of screenshots.
79
+ validations:
80
+ required: true
81
+ - type: textarea
82
+ attributes:
83
+ label: Additional information
84
+ description: Tell us anything else you think we should know.
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: 📚 Documentation
3
+ about: Report an issue related to documentation
4
+ ---
5
+
6
+ ## 📚 Documentation
7
+
8
+ (A clear and concise description of how the docs could be better, with links if possible)
9
+
10
+ ### Have you read the [Contributing Guidelines on docs](https://github.com/serialport/node-serialport/blob/master/CONTRIBUTING.md#writing-documentation)?
11
+
12
+ (Write your answer here.)
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: 💥 Proposal / Feature
3
+ about: Propose a non-trivial change or new feature for SerialPort
4
+ ---
5
+
6
+ ## 💥 Proposal
7
+
8
+ ### What feature you'd like to see
9
+
10
+ (A clear and concise description of what the proposal is.)
11
+
12
+ ## Motivation
13
+
14
+ (Please outline the motivation for the proposal. It's interesting knowing what people are working on and also could help community members make suggestions for work-arounds until the feature is built)
15
+
16
+ ## Pitch
17
+
18
+ (Please explain why this feature should be implemented and how it would be used.)
19
+
20
+ <!--
21
+ What happens if you skip this step?
22
+
23
+ Someone will read your feature proposal and maybe will be able to help you,
24
+ but it’s unlikely that it will get much attention from the team. Eventually,
25
+ the issue will likely get closed in favor of issues that have better explanations
26
+
27
+ Thanks for helping us help you!
28
+ -->
@@ -0,0 +1,8 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: ⁉️ Need help with nodejs-poolController?
4
+ url: https://github.com/tagyoureit/nodejs-poolController/discussions
5
+ about: Please start a discussion before opening a bug.
6
+ - name: Gitter
7
+ url: https://gitter.im/nodejs-poolController/Lobby
8
+ about: Legacy Gitter discussion forums
package/Changelog CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 7.6.1
4
+ 1. Many bugfixes: Intellichem, Touch body capacities, Ultratemp heaters, Nixie, more...
5
+ 2. Add env variables for Docker setup: POOL_RS485_PORT, POOL_NET_CONNECT, POOL_NET_HOST, POOL_NET_PORT, SOURCE_COMMIT, SOURCE_BRANCH
6
+ 3. Update dependencies
7
+ ## 7.6
8
+ 1. MasterTemp RS485 support for Nixie and IntelliCenter
9
+ 2. Nixie Valve Rotation delay
10
+ 3. Nixie Heater Cooldown delay
11
+ 4. Nixie Cleaner Start delay
12
+ 5. Nixie Cleaner Shutdown on Solar
13
+ 6. Nixie Delay Cancel
14
+
15
+ ## 7.5.1
16
+ 1. Backup/restore fixes
17
+ 2. Egg timer expiration
18
+ 3. Bug Fixes
19
+ 4. dashPanel/messageManager Filter
20
+ 5. RS485 refactor
21
+
3
22
  ## 7.5
4
23
  1. Backup/restore
5
24
  2. Intellitouch add expansion modules
package/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
- FROM node:lts-alpine AS build
2
- RUN apk add --no-cache make gcc g++ python linux-headers udev tzdata
1
+ FROM node:lts-alpine3.12 AS build
2
+ RUN apk add --no-cache make gcc g++ python3 linux-headers udev tzdata
3
3
  WORKDIR /app
4
4
  COPY package*.json ./
5
5
  RUN npm ci
@@ -7,7 +7,7 @@ COPY . .
7
7
  RUN npm run build
8
8
  RUN npm ci --production
9
9
 
10
- FROM node:lts-alpine as prod
10
+ FROM node:lts-alpine3.12 as prod
11
11
  RUN apk add git
12
12
  RUN mkdir /app && chown node:node /app
13
13
  WORKDIR /app
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # nodejs-poolController - Version 7.5
1
+ # nodejs-poolController - Version 7.6
2
2
 
3
3
  ## What is nodejs-poolController
4
4
 
@@ -48,12 +48,10 @@ If you don't know anything about NodeJS, these directions might be helpful.
48
48
  1. Install Nodejs (v12 recommended). (https://nodejs.org/en/download/)
49
49
  1. Update NPM (https://docs.npmjs.com/getting-started/installing-node).
50
50
  1. It is recommended to clone the source code as updates are frequently pushed while releases are infrequent
51
-
52
- Download the latest [code release](https://github.com/tagyoureit/nodejs-poolController/releases)
53
- OR
54
- clone with `git clone git@github.com:tagyoureit/nodejs-poolController.git`
55
- 1. Unzip into nodejs-poolController.
56
- 1. Run 'npm install' in the new folder (where package.json exists). This will automatically install all the dependencies (serial-port, express, sockets.io, etc).
51
+ clone with `git clone https://github.com/tagyoureit/nodejs-poolController.git`
52
+ (Alternate - not recommended - Download the latest [code release](https://github.com/tagyoureit/nodejs-poolController/releases)
53
+ 1. Change directory into nodejs-poolController.
54
+ 1. Run `npm install` in the new folder (where package.json exists). This will automatically install all the dependencies (serial-port, express, sockets.io, etc).
57
55
  1. Run the app with `npm start`.
58
56
  * `npm start` will compile the Typescript code. You should use this every time you download/clone/pull the latest code.
59
57
  * `npm run start:cached` will run the app without compiling the code which can be much faster.
@@ -63,6 +61,13 @@ If you don't know anything about NodeJS, these directions might be helpful.
63
61
 
64
62
  For a very thorough walk-through, see [this](https://www.troublefreepool.com/threads/pentair-intellicenter-pool-control-dashboard-instructional-guide.218514/) great thread on Trouble Free Pool. Thanks @MyAZPool.
65
63
 
64
+ #### Upgrade Instructions
65
+ Assuming you cloned the repo, the following are easy steps to get the latest version:
66
+ 1. Change directory to the njsPC app
67
+ 2. `git pull`
68
+ 3. `npm i` (not always necessary, but if dependencies are upgraded this will bring them up to date)
69
+ 4. Start application as normal, or if using `npm run start:cached` then run `npm run build` to compile the code.
70
+
66
71
  ### Docker instructions
67
72
 
68
73
  See the [wiki](https://github.com/tagyoureit/nodejs-poolController/wiki/Docker). Thanks @wurmr @andylippitt @emes.
@@ -108,7 +113,7 @@ Need to be updated:
108
113
  * [ISY Polyglot NodeServer](https://github.com/brianmtreese/nodejs-pool-controller-polyglotv2) created by @brianmtreese
109
114
 
110
115
  # Support
111
- 1. For discussions, recommendations, designs, and clarifications, we recommend you join our [Gitter Chat room](https://gitter.im/pentair_pool/Lobby).
116
+ 1. For discussions, recommendations, designs, and clarifications, we recommend you join the [Github discussions](https://github.com/tagyoureit/nodejs-poolController/discussions or [Gitter Chat room](https://gitter.im/pentair_pool/Lobby).
112
117
  1. Check the [wiki](https://github.com/tagyoureit/nodejs-poolController/wiki) for tips, tricks and additional documentation.
113
118
  1. For bug reports you can open a [github issue](https://github.com/tagyoureit/nodejs-poolController/issues/new),
114
119
 
package/app.ts CHANGED
@@ -30,7 +30,7 @@ export async function initAsync() {
30
30
  try {
31
31
  await config.init();
32
32
  await logger.init();
33
- await conn.init();
33
+ await conn.initAsync();
34
34
  await sys.init();
35
35
  await state.init();
36
36
  await webApp.init();
package/config/Config.ts CHANGED
@@ -17,10 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  import * as path from "path";
18
18
  import * as fs from "fs";
19
19
  import { EventEmitter } from 'events';
20
-
21
- //import { conn } from "../controller/comms/Comms";
22
20
  const extend = require("extend");
23
21
  import { logger } from "../logger/Logger";
22
+ import { utils } from "../controller/Constants";
24
23
  class Config {
25
24
  private cfgPath: string;
26
25
  private _cfg: any;
@@ -59,6 +58,7 @@ class Config {
59
58
  else throw err;
60
59
  });
61
60
  this._isLoading = false;
61
+ this.getEnvVariables();
62
62
  } catch (err) {
63
63
  console.log(`Error reading configuration information. Aborting startup: ${ err }`);
64
64
  // Rethrow this error so we exit the app with the appropriate pause in the console.
@@ -86,6 +86,20 @@ class Config {
86
86
 
87
87
  }
88
88
  }
89
+ public removeSection(section: string) {
90
+ let c = this._cfg;
91
+ if (section.indexOf('.') !== -1) {
92
+ let arr = section.split('.');
93
+ for (let i = 0; i < arr.length - 1; i++) {
94
+ if (typeof c[arr[i]] === 'undefined')
95
+ c[arr[i]] = {};
96
+ c = c[arr[i]];
97
+ }
98
+ section = arr[arr.length - 1];
99
+ }
100
+ if(typeof c[section] !== 'undefined') delete c[section];
101
+ this.update();
102
+ }
89
103
  public setSection(section: string, val) {
90
104
  let c = this._cfg;
91
105
  if (section.indexOf('.') !== -1) {
@@ -151,5 +165,27 @@ class Config {
151
165
  }
152
166
  }
153
167
  }
168
+ private getEnvVariables(){
169
+ // set docker env variables to config.json, if they are set
170
+ let env = process.env;
171
+ let bUpdate = false;
172
+ if (typeof env.POOL_RS485_PORT !== 'undefined' && env.POOL_RS485_PORT !== this._cfg.controller.comms.rs485Port) {
173
+ this._cfg.controller.comms.rs485Port = env.POOL_RS485_PORT;
174
+ bUpdate = true;
175
+ }
176
+ if (typeof env.POOL_NET_CONNECT !== 'undefined' && env.POOL_NET_CONNECT !== this._cfg.controller.comms.netConnect) {
177
+ this._cfg.controller.comms.netConnect = utils.makeBool(env.POOL_NET_CONNECT);
178
+ bUpdate = true;
179
+ }
180
+ if (typeof env.POOL_NET_HOST !== 'undefined' && env.POOL_NET_HOST !== this._cfg.controller.comms.netHost) {
181
+ this._cfg.controller.comms.netHost = env.POOL_NET_HOST;
182
+ bUpdate = true;
183
+ }
184
+ if (typeof env.POOL_NET_PORT !== 'undefined' && env.POOL_NET_PORT !== this._cfg.controller.comms.netPort) {
185
+ this._cfg.controller.comms.netPort = env.POOL_NET_PORT;
186
+ bUpdate = true;
187
+ }
188
+ if (bUpdate) this.update();
189
+ }
154
190
  }
155
191
  export const config: Config = new Config();
@@ -39,27 +39,42 @@ class VersionCheck {
39
39
  if (typeof state.appVersion.nextCheckTime === 'undefined' || new Date() > new Date(state.appVersion.nextCheckTime)) setTimeout(() => { this.checkAll(); }, 100);
40
40
  }
41
41
  public checkGitLocal() {
42
+ let env = process.env;
42
43
  // check local git version
43
44
  try {
44
- let res = execSync('git rev-parse --abbrev-ref HEAD', { stdio: 'pipe' });
45
- let out = res.toString().trim();
45
+ let out: string;
46
+ if (typeof env.SOURCE_BRANCH !== 'undefined')
47
+ {
48
+ out = env.SOURCE_BRANCH // check for docker variable
49
+ }
50
+ else {
51
+ let res = execSync('git rev-parse --abbrev-ref HEAD', { stdio: 'pipe' });
52
+ out = res.toString().trim();
53
+ }
46
54
  logger.info(`The current git branch output is ${out}`);
47
55
  switch (out) {
48
- case 'fatal':
49
- case 'command':
50
- state.appVersion.gitLocalBranch = '--';
51
- break;
52
- default:
53
- state.appVersion.gitLocalBranch = out;
54
- }
56
+ case 'fatal':
57
+ case 'command':
58
+ state.appVersion.gitLocalBranch = '--';
59
+ break;
60
+ default:
61
+ state.appVersion.gitLocalBranch = out;
62
+ }
55
63
  }
56
64
  catch (err) {
57
65
  state.appVersion.gitLocalBranch = '--';
58
66
  logger.warn(`Unable to retrieve local git branch. ${err}`);
59
67
  }
60
68
  try {
61
- let res = execSync('git rev-parse HEAD', { stdio: 'pipe' });
62
- let out = res.toString().trim();
69
+ let out: string;
70
+ if (typeof env.SOURCE_COMMIT !== 'undefined')
71
+ {
72
+ out = env.SOURCE_COMMIT; // check for docker variable
73
+ }
74
+ else {
75
+ let res = execSync('git rev-parse HEAD', { stdio: 'pipe' });
76
+ out = res.toString().trim();
77
+ }
63
78
  logger.info(`The current git commit output is ${out}`);
64
79
  switch (out) {
65
80
  case 'fatal':
@@ -87,7 +102,7 @@ class VersionCheck {
87
102
  });
88
103
  }
89
104
  catch (err) {
90
- logger.error(err);
105
+ logger.error(`Error checking latest release: ${err.message}`);
91
106
  }
92
107
  }
93
108
 
@@ -301,7 +301,8 @@ export enum ControllerType {
301
301
  EasyTouch = 'easytouch',
302
302
  Unknown = 'unknown',
303
303
  Virtual = 'virtual',
304
- Nixie = 'nixie'
304
+ Nixie = 'nixie',
305
+ AquaLink = 'aqualink'
305
306
  }
306
307
  // export enum VirtualDeviceType {
307
308
  // Pump = 'pump',