nodejs-poolcontroller 8.0.1 → 8.0.2

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 (47) hide show
  1. package/.docker/Dockerfile.armv6 +29 -0
  2. package/.docker/Dockerfile.armv7 +29 -0
  3. package/.docker/Dockerfile.linux +62 -0
  4. package/.docker/Dockerfile.windows +43 -0
  5. package/.docker/docker-compose.yml +47 -0
  6. package/.docker/ecosystem.config.js +35 -0
  7. package/.github/workflows/docker-publish-njsPC-linux.yml +81 -0
  8. package/.github/workflows/docker-publish-njsPC-windows.yml +41 -0
  9. package/Dockerfile +4 -3
  10. package/README.md +4 -1
  11. package/config/Config.ts +1 -1
  12. package/controller/Constants.ts +164 -67
  13. package/controller/Equipment.ts +78 -18
  14. package/controller/Lockouts.ts +15 -0
  15. package/controller/State.ts +280 -7
  16. package/controller/boards/EasyTouchBoard.ts +225 -101
  17. package/controller/boards/IntelliCenterBoard.ts +67 -18
  18. package/controller/boards/IntelliTouchBoard.ts +2 -4
  19. package/controller/boards/NixieBoard.ts +84 -27
  20. package/controller/boards/SunTouchBoard.ts +8 -2
  21. package/controller/boards/SystemBoard.ts +3259 -3242
  22. package/controller/comms/ScreenLogic.ts +47 -44
  23. package/controller/comms/messages/Messages.ts +4 -4
  24. package/controller/comms/messages/config/ChlorinatorMessage.ts +10 -3
  25. package/controller/comms/messages/config/ExternalMessage.ts +4 -1
  26. package/controller/comms/messages/config/PumpMessage.ts +8 -7
  27. package/controller/comms/messages/config/RemoteMessage.ts +48 -43
  28. package/controller/comms/messages/status/ChlorinatorStateMessage.ts +8 -2
  29. package/controller/comms/messages/status/EquipmentStateMessage.ts +9 -4
  30. package/controller/nixie/NixieEquipment.ts +1 -1
  31. package/controller/nixie/bodies/Body.ts +1 -1
  32. package/controller/nixie/chemistry/ChemController.ts +37 -28
  33. package/controller/nixie/circuits/Circuit.ts +36 -0
  34. package/controller/nixie/heaters/Heater.ts +24 -5
  35. package/controller/nixie/pumps/Pump.ts +155 -97
  36. package/controller/nixie/schedules/Schedule.ts +207 -126
  37. package/defaultConfig.json +3 -3
  38. package/logger/DataLogger.ts +7 -7
  39. package/package.json +2 -2
  40. package/sendSocket.js +32 -0
  41. package/web/Server.ts +17 -11
  42. package/web/bindings/homeassistant.json +2 -2
  43. package/web/interfaces/mqttInterface.ts +18 -18
  44. package/web/services/config/Config.ts +34 -1
  45. package/web/services/state/State.ts +10 -3
  46. package/web/services/state/StateSocket.ts +7 -3
  47. package/web/services/utilities/Utilities.ts +3 -3
@@ -0,0 +1,29 @@
1
+ # Use a base image compatible with ARMv6 architecture
2
+ FROM arm32v6/node:14-alpine
3
+
4
+ # Install necessary build dependencies
5
+ RUN apk add --no-cache make gcc g++ python3 linux-headers udev tzdata git
6
+
7
+ # Set the working directory
8
+ WORKDIR /app
9
+
10
+ # Copy package.json and package-lock.json
11
+ COPY package*.json ./
12
+
13
+ # Install dependencies (both development and production)
14
+ RUN npm ci
15
+
16
+ # Copy the rest of the application
17
+ COPY . .
18
+
19
+ # Build the application
20
+ RUN npm run build
21
+
22
+ # Set environment variables
23
+ ENV NODE_ENV=production
24
+
25
+ # Expose the port (if applicable)
26
+ EXPOSE 4200
27
+
28
+ # Command to run the application
29
+ CMD ["node", "dist/app.js"]
@@ -0,0 +1,29 @@
1
+ # Use a base image compatible with ARMv7 architecture
2
+ FROM arm32v7/node:14-alpine
3
+
4
+ # Install necessary build dependencies
5
+ RUN apk add --no-cache make gcc g++ python3 linux-headers udev tzdata git
6
+
7
+ # Set the working directory
8
+ WORKDIR /app
9
+
10
+ # Copy package.json and package-lock.json
11
+ COPY package*.json ./
12
+
13
+ # Install dependencies (both development and production)
14
+ RUN npm ci
15
+
16
+ # Copy the rest of the application
17
+ COPY . .
18
+
19
+ # Build the application
20
+ RUN npm run build
21
+
22
+ # Set environment variables
23
+ ENV NODE_ENV=production
24
+
25
+ # Expose the port (if applicable)
26
+ EXPOSE 4200
27
+
28
+ # Command to run the application
29
+ CMD ["node", "dist/app.js"]
@@ -0,0 +1,62 @@
1
+ # Use a Linux-based image as the build stage for the first application
2
+ FROM node:lts-alpine AS build-njspc
3
+
4
+ # Install necessary build dependencies
5
+ RUN apk add --no-cache make gcc g++ python3 linux-headers udev tzdata
6
+
7
+ # Create the app directory and set ownership for the first application
8
+ RUN mkdir -p /app/nodejs-poolcontroller && chown node:node /app/nodejs-poolcontroller
9
+
10
+ # Set the working directory for the first application
11
+ WORKDIR /app/nodejs-poolcontroller
12
+
13
+ # Copy the source code and necessary files for the first application
14
+ COPY ./nodejs-poolcontroller/defaultConfig.json ./config.json
15
+ COPY ./nodejs-poolcontroller ./
16
+ COPY ./.docker/ecosystem.config.js ./ecosystem.config.js
17
+
18
+ # Install dependencies and build the first application
19
+ RUN npm ci
20
+ RUN npm run build
21
+
22
+ # Second stage for the second application
23
+ FROM node:lts-alpine AS build-njspc-dp
24
+
25
+ # Create the app directory and set ownership for the second application
26
+ RUN mkdir -p /app/nodejs-poolcontroller-dashpanel && chown node:node /app/nodejs-poolcontroller-dashpanel
27
+
28
+ # Set the working directory for the second application
29
+ WORKDIR /app/nodejs-poolcontroller-dashpanel
30
+
31
+ # Copy the source code and necessary files for the second application
32
+ COPY ./nodejs-poolcontroller-dashpanel ./
33
+
34
+ # Install dependencies and build the second application
35
+ RUN npm ci
36
+ RUN npm run build
37
+
38
+ # Fourth stage for the final combined image
39
+ FROM node:lts-alpine AS final
40
+
41
+ # Install PM2 globally
42
+ RUN npm install pm2 -g
43
+
44
+ # Create the app directory and set ownership
45
+ RUN mkdir -p /app && chown node:node /app
46
+
47
+ # Set the working directory for the final combined image
48
+ WORKDIR /app
49
+
50
+ # Copy built applications from the previous stages into the final image
51
+ COPY --from=build-njspc /app/nodejs-poolcontroller ./nodejs-poolcontroller
52
+ COPY --from=build-njspc-dp /app/nodejs-poolcontroller-dashpanel ./nodejs-poolcontroller-dashpanel
53
+ # COPY --from=build-rem /app/relayEquipmentManager ./relayEquipmentManager
54
+
55
+ # Copy the ecosystem configuration file from the build stage
56
+ COPY --from=build-njspc /app/nodejs-poolcontroller/ecosystem.config.js ./ecosystem.config.js
57
+
58
+ # Expose any necessary ports
59
+ EXPOSE 4200 5150
60
+
61
+ # Define the command to run both applications using PM2
62
+ CMD ["pm2-runtime", "start", "ecosystem.config.js"]
@@ -0,0 +1,43 @@
1
+ # Use a Windows-based image as the build stage
2
+ FROM mcr.microsoft.com/windows/servercore:ltsc2019 AS build
3
+
4
+ # Set the working directory
5
+ WORKDIR C:\app
6
+
7
+ # Copy package.json and package-lock.json files
8
+ COPY package*.json ./
9
+ COPY defaultConfig.json config.json
10
+
11
+ # Install Node.js
12
+ RUN curl -sL https://nodejs.org/dist/v14.17.6/node-v14.17.6-x64.msi -o node.msi
13
+ RUN msiexec /i node.msi /quiet
14
+
15
+ # Install npm dependencies
16
+ RUN npm ci
17
+
18
+ # Copy the rest of the application files
19
+ COPY . .
20
+
21
+ # Build the application
22
+ RUN npm run build
23
+
24
+ # Second stage for the production image
25
+ FROM mcr.microsoft.com/windows/servercore:ltsc2019 as prod
26
+
27
+ # Install git
28
+ RUN powershell -Command "Invoke-WebRequest -Uri https://github.com/git-for-windows/git/releases/download/v2.33.1.windows.1/Git-2.33.1-64-bit.exe -OutFile git.exe" && .\git.exe /VERYSILENT /NORESTART
29
+
30
+ # Create the app directory
31
+ RUN mkdir C:\app
32
+
33
+ # Set the working directory
34
+ WORKDIR C:\app
35
+
36
+ # Copy built application from the build stage
37
+ COPY --from=build C:\app .
38
+
39
+ # Set environment variables
40
+ ENV NODE_ENV=production
41
+
42
+ # Define the entrypoint
43
+ CMD ["node", "dist/app.js"]
@@ -0,0 +1,47 @@
1
+ version: '3.8'
2
+
3
+ services:
4
+ poolcontroller:
5
+ image: tagyoureit/nodejs-poolcontroller:latest
6
+ container_name: poolcontroller
7
+ restart: always
8
+ group_add:
9
+ - dialout
10
+ devices:
11
+ - /dev/ttyUSB0
12
+ ports:
13
+ - "4200:4200"
14
+ volumes:
15
+ - /data/poolcontroller/config.json:/app/nodejs-poolcontroller/config.json
16
+ - /data/poolcontroller/data:/app/nodejs-poolcontroller/data
17
+ - /data/poolcontroller/logs:/app/nodejs-poolcontroller/logs
18
+ poolcontroller-dashpanel:
19
+ restart: always
20
+ container_name: poolcontroller-dashpanel
21
+ ports:
22
+ - "5150:5150"
23
+ volumes:
24
+ - /data/poolcontroller-dashpanel/config.json:/app/nodejs-poolcontroller-dashpanel/config.json
25
+ image: rstrouse/nodejs-poolcontroller-dashpanel:latest
26
+ depends_on:
27
+ - poolcontroller
28
+
29
+ # poolcontroller-armv7:
30
+ # image: tagyoureit/nodejs-poolcontroller-armv7:latest
31
+ # container_name: poolcontroller-armv7
32
+ # restart: always
33
+ # ports:
34
+ # - "4200:4200"
35
+ # volumes:
36
+ # - /data/poolcontroller/config.json:/app/config.json
37
+ # - /data/poolcontroller/data:/app/data
38
+
39
+ # poolcontroller-armv6:
40
+ # image: tagyoureit/nodejs-poolcontroller-armv6:latest
41
+ # container_name: poolcontroller-armv6
42
+ # restart: always
43
+ # ports:
44
+ # - "4200:4200"
45
+ # volumes:
46
+ # - /data/poolcontroller/config.json:/app/config.json
47
+ # - /data/poolcontroller/data:/app/data
@@ -0,0 +1,35 @@
1
+ module.exports = {
2
+ apps: [
3
+ {
4
+ name: "dashPanel",
5
+ script: "npm",
6
+ args: ["start"],
7
+ cwd: "/app/nodejs-poolcontroller-dashpanel",
8
+ restart_delay: 10000,
9
+ watch: [
10
+ "pages",
11
+ "scripts",
12
+ "server",
13
+ "package.json"
14
+ ],
15
+ watch_delay: 5000,
16
+ kill_timeout: 15000
17
+ },
18
+ {
19
+ name: "njsPC",
20
+ script: "npm",
21
+ args: ["start"],
22
+ cwd: "/app/nodejs-poolcontroller",
23
+ restart_delay: 10000,
24
+ watch: [
25
+ "config",
26
+ "controller",
27
+ "logger",
28
+ "web",
29
+ "package.json"
30
+ ],
31
+ watch_delay: 5000,
32
+ kill_timeout: 15000
33
+ }
34
+ ]
35
+ };
@@ -0,0 +1,81 @@
1
+ name: Publish Docker Image - Ubuntu
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ - docker
8
+ workflow_dispatch:
9
+
10
+ jobs:
11
+ build-and-push:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - name: Checkout code
15
+ uses: actions/checkout@v3
16
+
17
+ - name: Checkout code from tagyoureit/nodejs-poolcontroller
18
+ uses: actions/checkout@v3
19
+ with:
20
+ repository: tagyoureit/nodejs-poolcontroller
21
+ ref: master # or specify the branch or tag to pull from
22
+ path: nodejs-poolcontroller
23
+
24
+ - name: Checkout code from rstrouse/nodejs-poolcontroller-dashpanel
25
+ uses: actions/checkout@v3
26
+ with:
27
+ repository: rstrouse/nodejs-poolcontroller-dashpanel #
28
+ ref: master # Specify the branch or tag to pull from
29
+ path: nodejs-poolcontroller-dashpanel # Specify the directory to checkout the code into
30
+
31
+ - name: Login to Docker Hub
32
+ uses: docker/login-action@v3
33
+ with:
34
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
35
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
36
+
37
+ - name: Build and push combined Docker image
38
+ uses: docker/build-push-action@v4
39
+ with:
40
+ context: .
41
+ file: ./.docker/Dockerfile.linux
42
+ push: true
43
+ tags: |
44
+ tagyoureit/njspc-dp-combined-app:latest
45
+
46
+
47
+ # - name: Build and push njsPC Linux Docker image (x86_64)
48
+ # uses: docker/build-push-action@v4
49
+ # with:
50
+ # context: .
51
+ # file: ./.docker/Dockerfile.linux
52
+ # push: true
53
+ # tags: |
54
+ # tagyoureit/nodejs-poolcontroller:latest
55
+
56
+ # - name: Build and push njsPC-dP Linux Docker image (x86_64)
57
+ # uses: docker/build-push-action@v4
58
+ # with:
59
+ # context: nodejs-poolcontroller-dashpanel
60
+ # file: ./.docker/Dockerfile.linux
61
+ # push: true
62
+ # tags: |
63
+ # rstrouse/nodejs-poolcontroller-dashpanel:latest
64
+
65
+ # - name: Build and push ARMv7 Docker image
66
+ # uses: docker/build-push-action@v4
67
+ # with:
68
+ # context: .
69
+ # file: ./.docker/Dockerfile.armv7 # Adjust the path to your ARMv7 Dockerfile
70
+ # push: true
71
+ # tags: |
72
+ # tagyoureit/nodejs-poolcontroller-armv7:latest
73
+
74
+ # - name: Build and push ARMv6 Docker image
75
+ # uses: docker/build-push-action@v4
76
+ # with:
77
+ # context: .
78
+ # file: ./.docker/Dockerfile.armv6 # Adjust the path to your ARMv6 Dockerfile
79
+ # push: true
80
+ # tags: |
81
+ # tagyoureit/nodejs-poolcontroller-armv6:latest
@@ -0,0 +1,41 @@
1
+ name: Publish Docker Image - Windows
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - docker
7
+ workflow_dispatch:
8
+
9
+
10
+ jobs:
11
+ build-and-push-windows:
12
+ runs-on: windows-latest
13
+
14
+ steps:
15
+ - name: Checkout code
16
+ uses: actions/checkout@v4
17
+
18
+ -
19
+ # Add support for more platforms with QEMU (optional)
20
+ # https://github.com/docker/setup-qemu-action
21
+ name: Set up QEMU
22
+ uses: docker/setup-qemu-action@v3
23
+ -
24
+ name: Set up Docker Buildx
25
+ uses: docker/setup-buildx-action@v3
26
+
27
+ - name: Login to Docker Hub
28
+ uses: docker/login-action@v3
29
+ with:
30
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
31
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
32
+
33
+ - name: Build and push Windows Docker image
34
+ uses: docker/build-push-action@v3
35
+ with:
36
+ context: .
37
+ file: ./Dockerfile.windows
38
+ push: true
39
+ tags: |
40
+ tagyoureit/nodejs-poolcontroller:windows-latest
41
+ platforms: windows/amd64
package/Dockerfile CHANGED
@@ -1,13 +1,14 @@
1
- FROM node:lts-alpine3.12 AS build
1
+ FROM node:lts-alpine AS build
2
2
  RUN apk add --no-cache make gcc g++ python3 linux-headers udev tzdata
3
3
  WORKDIR /app
4
4
  COPY package*.json ./
5
+ COPY defaultConfig.json config.json
5
6
  RUN npm ci
6
7
  COPY . .
7
8
  RUN npm run build
8
- RUN npm ci --production
9
+ RUN npm ci --omit=dev
9
10
 
10
- FROM node:lts-alpine3.12 as prod
11
+ FROM node:lts-alpine as prod
11
12
  RUN apk add git
12
13
  RUN mkdir /app && chown node:node /app
13
14
  WORKDIR /app
package/README.md CHANGED
@@ -1,3 +1,6 @@
1
+ ```diff
2
+ - INTELLICENTER USERS: Do not upgrade Intellicenter to 2.006. Rollback to 1.064 to use this application.
3
+ ```
1
4
  # nodejs-poolController - Version 8.0
2
5
 
3
6
  ## What is nodejs-poolController
@@ -49,7 +52,7 @@ This is only the server code. See [clients](#module_nodejs-poolController--clie
49
52
  ### Prerequisites
50
53
  If you don't know anything about NodeJS, these directions might be helpful.
51
54
 
52
- 1. Install Nodejs (v12 recommended). (https://nodejs.org/en/download/)
55
+ 1. Install Nodejs (v16+ required). (https://nodejs.org/en/download/)
53
56
  1. Update NPM (https://docs.npmjs.com/getting-started/installing-node).
54
57
  1. It is recommended to clone the source code as updates are frequently pushed while releases are infrequent
55
58
  clone with `git clone https://github.com/tagyoureit/nodejs-poolController.git`
package/config/Config.ts CHANGED
@@ -36,7 +36,7 @@ class Config {
36
36
  // RKS 05-18-20: This originally had multiple points of failure where it was not in the try/catch.
37
37
  try {
38
38
  this._isLoading = true;
39
- this._cfg = fs.existsSync(this.cfgPath) ? JSON.parse(fs.readFileSync(this.cfgPath, "utf8")) : {};
39
+ this._cfg = fs.existsSync(this.cfgPath) ? JSON.parse(fs.readFileSync(this.cfgPath, "utf8").trim()) : {};
40
40
  const def = JSON.parse(fs.readFileSync(path.join(process.cwd(), "/defaultConfig.json"), "utf8").trim());
41
41
  const packageJson = JSON.parse(fs.readFileSync(path.join(process.cwd(), "/package.json"), "utf8").trim());
42
42
  this._cfg = extend(true, {}, def, this._cfg, { appVersion: packageJson.version });