nodejs-poolcontroller 7.6.0 → 7.6.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 +44 -44
- package/.github/ISSUE_TEMPLATE/bug_report.md +52 -52
- package/CONTRIBUTING.md +74 -74
- package/Changelog +215 -215
- package/Dockerfile +17 -17
- package/Gruntfile.js +40 -40
- package/LICENSE +661 -661
- package/README.md +191 -186
- package/app.ts +0 -0
- package/config/Config.ts +24 -2
- package/config/VersionCheck.ts +27 -12
- package/config copy.json +299 -299
- package/controller/Constants.ts +0 -0
- package/controller/Equipment.ts +2459 -2405
- package/controller/Errors.ts +180 -180
- package/controller/Lockouts.ts +436 -422
- package/controller/State.ts +51 -26
- package/controller/boards/BoardFactory.ts +45 -45
- package/controller/boards/EasyTouchBoard.ts +2653 -2537
- package/controller/boards/IntelliCenterBoard.ts +4230 -4034
- package/controller/boards/IntelliComBoard.ts +63 -63
- package/controller/boards/IntelliTouchBoard.ts +241 -241
- package/controller/boards/NixieBoard.ts +1675 -1660
- package/controller/boards/SystemBoard.ts +4697 -4463
- package/controller/comms/Comms.ts +138 -1
- package/controller/comms/messages/Messages.ts +3 -5
- package/controller/comms/messages/config/ChlorinatorMessage.ts +1 -1
- 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 +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 +9 -7
- 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 +0 -20
- package/controller/comms/messages/config/IntellichemMessage.ts +0 -0
- package/controller/comms/messages/config/OptionsMessage.ts +25 -1
- package/controller/comms/messages/config/PumpMessage.ts +0 -0
- package/controller/comms/messages/config/RemoteMessage.ts +0 -0
- package/controller/comms/messages/config/ScheduleMessage.ts +347 -342
- package/controller/comms/messages/config/SecurityMessage.ts +0 -0
- 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 +1 -1
- package/controller/comms/messages/status/HeaterStateMessage.ts +86 -86
- package/controller/comms/messages/status/IntelliChemStateMessage.ts +445 -397
- package/controller/comms/messages/status/IntelliValveStateMessage.ts +35 -35
- package/controller/comms/messages/status/PumpStateMessage.ts +0 -0
- 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 +2498 -2398
- package/controller/nixie/chemistry/Chlorinator.ts +314 -314
- package/controller/nixie/circuits/Circuit.ts +248 -245
- package/controller/nixie/heaters/Heater.ts +648 -600
- package/controller/nixie/pumps/Pump.ts +661 -661
- package/controller/nixie/schedules/Schedule.ts +257 -257
- package/controller/nixie/valves/Valve.ts +170 -170
- package/defaultConfig.json +286 -286
- package/issue_template.md +51 -51
- 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 +2 -2
- package/web/bindings/influxDB.json +1021 -981
- package/web/bindings/mqtt.json +654 -654
- package/web/bindings/mqttAlt.json +684 -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 +136 -136
- package/web/interfaces/httpInterface.ts +124 -124
- package/web/interfaces/influxInterface.ts +245 -241
- package/web/interfaces/mqttInterface.ts +475 -475
- package/web/services/config/Config.ts +10 -108
- package/web/services/config/ConfigSocket.ts +0 -0
- package/web/services/state/State.ts +71 -4
- package/web/services/state/StateSocket.ts +0 -0
- package/web/services/utilities/Utilities.ts +42 -42
package/controller/State.ts
CHANGED
|
@@ -498,6 +498,7 @@ export interface ICircuitState {
|
|
|
498
498
|
startTime?: Timestamp;
|
|
499
499
|
endTime: Timestamp;
|
|
500
500
|
lightingTheme?: number;
|
|
501
|
+
action?: number;
|
|
501
502
|
emitEquipmentChange();
|
|
502
503
|
get(bCopy?: boolean);
|
|
503
504
|
showInFeatures?: boolean;
|
|
@@ -1022,9 +1023,9 @@ export class ScheduleState extends EqState {
|
|
|
1022
1023
|
if (typeof this.data.startDate === 'undefined') this._startDate = new Date();
|
|
1023
1024
|
else this._startDate = new Date(this.data.startDate);
|
|
1024
1025
|
if (isNaN(this._startDate.getTime())) this._startDate = new Date();
|
|
1025
|
-
if (typeof this.data.startTimeType === 'undefined') this.data.startTimeType = 0;
|
|
1026
|
-
if (typeof this.data.endTimeType === 'undefined') this.data.endTimeType = 0;
|
|
1027
|
-
if (typeof this.data.display === 'undefined') this.display = 0;
|
|
1026
|
+
if (typeof this.data.startTimeType === 'undefined') this.data.startTimeType = sys.board.valueMaps.scheduleTimeTypes.transform(0);
|
|
1027
|
+
if (typeof this.data.endTimeType === 'undefined') this.data.endTimeType = sys.board.valueMaps.scheduleTimeTypes.transform(0);
|
|
1028
|
+
if (typeof this.data.display === 'undefined') this.data.display = sys.board.valueMaps.scheduleDisplayTypes.transform(0);
|
|
1028
1029
|
}
|
|
1029
1030
|
private _startDate: Date = new Date();
|
|
1030
1031
|
public get startDate(): Date { return this._startDate; }
|
|
@@ -1236,7 +1237,7 @@ export class LightGroupState extends EqState implements ICircuitGroupState, ICir
|
|
|
1236
1237
|
public get action(): number { return typeof this.data.action !== 'undefined' ? this.data.action.val : 0; }
|
|
1237
1238
|
public set action(val: number) {
|
|
1238
1239
|
if (this.action !== val || typeof this.data.action === 'undefined') {
|
|
1239
|
-
this.data.action = sys.board.valueMaps.
|
|
1240
|
+
this.data.action = sys.board.valueMaps.circuitActions.transform(val);
|
|
1240
1241
|
this.hasChanged = true;
|
|
1241
1242
|
}
|
|
1242
1243
|
}
|
|
@@ -1268,7 +1269,7 @@ export class LightGroupState extends EqState implements ICircuitGroupState, ICir
|
|
|
1268
1269
|
let sgrp = this.get(true); // Always operate on a copy.
|
|
1269
1270
|
sgrp.circuits = [];
|
|
1270
1271
|
if (typeof sgrp.lightingTheme === 'undefined') sgrp.lightingTheme = sys.board.valueMaps.lightThemes.transformByName('white');
|
|
1271
|
-
if (typeof sgrp.action === 'undefined') sgrp.action = sys.board.valueMaps.
|
|
1272
|
+
if (typeof sgrp.action === 'undefined') sgrp.action = sys.board.valueMaps.circuitActions.transform(0);
|
|
1272
1273
|
let cgrp = sys.circuitGroups.getItemById(this.id);
|
|
1273
1274
|
for (let i = 0; i < cgrp.circuits.length; i++) {
|
|
1274
1275
|
let lgc = cgrp.circuits.getItemByIndex(i).get(true);
|
|
@@ -1410,7 +1411,7 @@ export class BodyTempState extends EqState {
|
|
|
1410
1411
|
}
|
|
1411
1412
|
export class TemperatureState extends EqState {
|
|
1412
1413
|
public initData() {
|
|
1413
|
-
if (typeof this.data.units === 'undefined') this.units = 0;
|
|
1414
|
+
if (typeof this.data.units === 'undefined') this.data.units = sys.board.valueMaps.tempUnits.transform(0);
|
|
1414
1415
|
}
|
|
1415
1416
|
public get waterSensor1(): number { return this.data.waterSensor1; }
|
|
1416
1417
|
public set waterSensor1(val: number) { this.setDataVal('waterSensor1', val); }
|
|
@@ -1647,6 +1648,8 @@ export class CircuitState extends EqState implements ICircuitState {
|
|
|
1647
1648
|
public dataName = 'circuit';
|
|
1648
1649
|
public initData() {
|
|
1649
1650
|
if (typeof this.data.freezeProtect === 'undefined') this.data.freezeProtect = false;
|
|
1651
|
+
if (typeof this.data.action === 'undefined') this.data.action = sys.board.valueMaps.circuitActions.transform(0);
|
|
1652
|
+
if (typeof this.data.type === 'undefined') this.data.type = sys.board.valueMaps.circuitFunctions.transform(0);
|
|
1650
1653
|
}
|
|
1651
1654
|
public get id(): number { return this.data.id; }
|
|
1652
1655
|
public set id(val: number) { this.data.id = val; }
|
|
@@ -1654,6 +1657,13 @@ export class CircuitState extends EqState implements ICircuitState {
|
|
|
1654
1657
|
public set name(val: string) { this.setDataVal('name', val); }
|
|
1655
1658
|
public get nameId(): number { return this.data.nameId; }
|
|
1656
1659
|
public set nameId(val: number) { this.setDataVal('nameId', val); }
|
|
1660
|
+
public get action(): number { return typeof this.data.action !== 'undefined' ? this.data.action.val : 0; }
|
|
1661
|
+
public set action(val: number) {
|
|
1662
|
+
if (this.action !== val || typeof this.data.action === 'undefined') {
|
|
1663
|
+
this.data.action = sys.board.valueMaps.circuitActions.transform(val);
|
|
1664
|
+
this.hasChanged = true;
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1657
1667
|
public get showInFeatures(): boolean { return this.data.showInFeatures; }
|
|
1658
1668
|
public set showInFeatures(val: boolean) { this.setDataVal('showInFeatures', val); }
|
|
1659
1669
|
public get isOn(): boolean { return this.data.isOn; }
|
|
@@ -1974,7 +1984,9 @@ export class ChemControllerState extends EqState {
|
|
|
1974
1984
|
if (typeof this.data.orp === 'undefined') this.data.orp = {};
|
|
1975
1985
|
if (typeof this.data.ph === 'undefined') this.data.ph = {};
|
|
1976
1986
|
if (typeof this.data.flowSensor === 'undefined') this.data.flowSensor = {};
|
|
1977
|
-
if (typeof this.data.type === 'undefined') {
|
|
1987
|
+
if (typeof this.data.type === 'undefined') {
|
|
1988
|
+
this.data.type = sys.board.valueMaps.chemControllerTypes.transform(1);
|
|
1989
|
+
}
|
|
1978
1990
|
else if (typeof this.data.type.ph === 'undefined') {
|
|
1979
1991
|
this.data.type = sys.board.valueMaps.chemControllerTypes.transform(this.type);
|
|
1980
1992
|
}
|
|
@@ -2190,7 +2202,7 @@ export class ChemControllerState extends EqState {
|
|
|
2190
2202
|
public get flowSensor(): ChemicalFlowSensorState { return new ChemicalFlowSensorState(this.data, 'flowSensor', this); }
|
|
2191
2203
|
public get warnings(): ChemControllerStateWarnings { return new ChemControllerStateWarnings(this.data, 'warnings', this); }
|
|
2192
2204
|
public get alarms(): ChemControllerStateAlarms { return new ChemControllerStateAlarms(this.data, 'alarms', this); }
|
|
2193
|
-
public get siCalcType(): number { return this.data.siCalcType; }
|
|
2205
|
+
public get siCalcType(): number { return typeof this.data.siCalcType === 'undefined' ? 0 : this.data.siCalcType.val; }
|
|
2194
2206
|
public set siCalcType(val: number) {
|
|
2195
2207
|
if (this.siCalcType !== val) {
|
|
2196
2208
|
this.data.siCalcType = sys.board.valueMaps.siCalcTypes.transform(val);
|
|
@@ -2230,6 +2242,7 @@ export class ChemicalState extends ChildEqState {
|
|
|
2230
2242
|
if (typeof this.data.flowDelay === 'undefined') this.data.flowDelay = false;
|
|
2231
2243
|
if (typeof this.data.dosingStatus === 'undefined') this.dosingStatus = 2;
|
|
2232
2244
|
if (typeof this.data.enabled === 'undefined') this.data.enabled = true;
|
|
2245
|
+
if (typeof this.data.freezeProtect === 'undefined') this.data.freezeProtect = false;
|
|
2233
2246
|
}
|
|
2234
2247
|
public getConfig(): Chemical { return; }
|
|
2235
2248
|
public calcDoseHistory(): number {
|
|
@@ -2336,6 +2349,8 @@ export class ChemicalState extends ChildEqState {
|
|
|
2336
2349
|
public get demandHistory() { return new ChemicalDemandState(this.data, 'demandHistory', this) };
|
|
2337
2350
|
public get enabled(): boolean { return this.data.enabled; }
|
|
2338
2351
|
public set enabled(val: boolean) { this.data.enabled = val; }
|
|
2352
|
+
public get freezeProtect(): boolean { return this.data.freezeProtect; }
|
|
2353
|
+
public set freezeProtect(val: boolean) { this.data.freezeProtect = val; }
|
|
2339
2354
|
public get level(): number { return this.data.level; }
|
|
2340
2355
|
public set level(val: number) { this.setDataVal('level', val); }
|
|
2341
2356
|
public get setpoint(): number { return this.data.setpoint; }
|
|
@@ -2393,8 +2408,8 @@ export class ChemicalState extends ChildEqState {
|
|
|
2393
2408
|
}
|
|
2394
2409
|
export class ChemicalPhState extends ChemicalState {
|
|
2395
2410
|
public initData() {
|
|
2396
|
-
// if (typeof this.data.chemType === 'undefined') this.data.chemType === 'acid'; // RSG 10-23-21 - Only a getter; don't need to set this.
|
|
2397
2411
|
super.initData();
|
|
2412
|
+
if (typeof this.data.chemType === 'undefined') this.data.chemType = 'none';
|
|
2398
2413
|
}
|
|
2399
2414
|
public getConfig() {
|
|
2400
2415
|
let schem = this.chemController;
|
|
@@ -2403,7 +2418,8 @@ export class ChemicalPhState extends ChemicalState {
|
|
|
2403
2418
|
return typeof chem !== 'undefined' ? chem.ph : undefined;
|
|
2404
2419
|
}
|
|
2405
2420
|
}
|
|
2406
|
-
public get chemType() { return
|
|
2421
|
+
public get chemType() { return this.data.chemType; }
|
|
2422
|
+
public set chemType(val: string) { this.setDataVal('chemType', val); }
|
|
2407
2423
|
public get probe(): ChemicalProbePHState { return new ChemicalProbePHState(this.data, 'probe', this); }
|
|
2408
2424
|
public getExtended() {
|
|
2409
2425
|
let chem = super.getExtended();
|
|
@@ -2452,7 +2468,7 @@ export class ChemicalPhState extends ChemicalState {
|
|
|
2452
2468
|
export class ChemicalORPState extends ChemicalState {
|
|
2453
2469
|
public initData() {
|
|
2454
2470
|
if (typeof this.data.probe === 'undefined') this.data.probe = {};
|
|
2455
|
-
if (typeof this.data.chemType === 'undefined') this.data.chemType
|
|
2471
|
+
if (typeof this.data.chemType === 'undefined') this.data.chemType = 'none';
|
|
2456
2472
|
if (typeof this.data.useChlorinator === 'undefined') this.data.useChlorinator = false;
|
|
2457
2473
|
super.initData();
|
|
2458
2474
|
// Load up the 24 hours doseHistory.
|
|
@@ -2465,6 +2481,7 @@ export class ChemicalORPState extends ChemicalState {
|
|
|
2465
2481
|
//});
|
|
2466
2482
|
}
|
|
2467
2483
|
public get chemType() { return 'orp'; }
|
|
2484
|
+
public set chemType(val) { this.setDataVal('chemType', val); }
|
|
2468
2485
|
public get probe() { return new ChemicalProbeORPState(this.data, 'probe', this); }
|
|
2469
2486
|
public get useChlorinator(): boolean { return utils.makeBool(this.data.useChlorinator); }
|
|
2470
2487
|
public set useChlorinator(val: boolean) { this.setDataVal('useChlorinator', val); }
|
|
@@ -2743,20 +2760,21 @@ export class ChemControllerStateAlarms extends ChildEqState {
|
|
|
2743
2760
|
//ctor(data): ChemControllerStateWarnings { return new ChemControllerStateWarnings(data, name || 'alarms'); }
|
|
2744
2761
|
public dataName = 'chemControllerAlarms';
|
|
2745
2762
|
public initData() {
|
|
2746
|
-
if (typeof this.data.flow === 'undefined') this.flow = 0;
|
|
2747
|
-
if (typeof this.data.pH === 'undefined') this.pH = 0;
|
|
2748
|
-
if (typeof this.data.orp === 'undefined') this.orp = 0;
|
|
2749
|
-
if (typeof this.data.pHTank === 'undefined') this.pHTank = 0;
|
|
2750
|
-
if (typeof this.data.orpTank === 'undefined') this.orpTank = 0;
|
|
2751
|
-
if (typeof this.data.probeFault === 'undefined') this.probeFault = 0;
|
|
2752
|
-
if (typeof this.data.pHProbeFault === 'undefined') this.pHProbeFault = 0;
|
|
2753
|
-
if (typeof this.data.orpProbeFault === 'undefined') this.orpProbeFault = 0;
|
|
2754
|
-
if (typeof this.data.pHPumpFault === 'undefined') this.pHPumpFault = 0;
|
|
2755
|
-
if (typeof this.data.orpPumpFault === 'undefined') this.orpPumpFault = 0;
|
|
2756
|
-
if (typeof this.data.chlorFault === 'undefined') this.chlorFault = 0;
|
|
2757
|
-
if (typeof this.data.bodyFault === 'undefined') this.bodyFault = 0;
|
|
2758
|
-
if (typeof this.data.flowSensorFault === 'undefined') this.flowSensorFault = 0;
|
|
2759
|
-
if (typeof this.data.comms === 'undefined') this.comms = 0;
|
|
2763
|
+
if (typeof this.data.flow === 'undefined') this.data.flow = sys.board.valueMaps.chemControllerAlarms.transform(0);
|
|
2764
|
+
if (typeof this.data.pH === 'undefined') this.data.pH = sys.board.valueMaps.chemControllerAlarms.transform(0);
|
|
2765
|
+
if (typeof this.data.orp === 'undefined') this.data.orp = sys.board.valueMaps.chemControllerAlarms.transform(0);
|
|
2766
|
+
if (typeof this.data.pHTank === 'undefined') this.data.pHTank = sys.board.valueMaps.chemControllerAlarms.transform(0);
|
|
2767
|
+
if (typeof this.data.orpTank === 'undefined') this.data.orpTank = sys.board.valueMaps.chemControllerAlarms.transform(0);
|
|
2768
|
+
if (typeof this.data.probeFault === 'undefined') this.data.probeFault = sys.board.valueMaps.chemControllerAlarms.transform(0);
|
|
2769
|
+
if (typeof this.data.pHProbeFault === 'undefined') this.data.pHProbeFault = sys.board.valueMaps.chemControllerAlarms.transform(0);
|
|
2770
|
+
if (typeof this.data.orpProbeFault === 'undefined') this.data.orpProbeFault = sys.board.valueMaps.chemControllerAlarms.transform(0);
|
|
2771
|
+
if (typeof this.data.pHPumpFault === 'undefined') this.data.pHPumpFault = sys.board.valueMaps.chemControllerHardwareFaults.transform(0);
|
|
2772
|
+
if (typeof this.data.orpPumpFault === 'undefined') this.data.orpPumpFault = sys.board.valueMaps.chemControllerHardwareFaults.transform(0);
|
|
2773
|
+
if (typeof this.data.chlorFault === 'undefined') this.data.chlorFault = sys.board.valueMaps.chemControllerHardwareFaults.transform(0);
|
|
2774
|
+
if (typeof this.data.bodyFault === 'undefined') this.data.bodyFault = sys.board.valueMaps.chemControllerHardwareFaults.transform(0);
|
|
2775
|
+
if (typeof this.data.flowSensorFault === 'undefined') this.data.flowSensorFault = sys.board.valueMaps.chemControllerHardwareFaults.transform(0);
|
|
2776
|
+
if (typeof this.data.comms === 'undefined') this.data.comms = sys.board.valueMaps.chemControllerStatus.transform(0);
|
|
2777
|
+
if (typeof this.data.freezeProtect === 'undefined') this.data.freezeProtect = sys.board.valueMaps.chemControllerAlarms.transform(0);
|
|
2760
2778
|
}
|
|
2761
2779
|
public get flow(): number { return typeof this.data.flow === 'undefined' ? undefined : this.data.flow.val; }
|
|
2762
2780
|
public set flow(val: number) {
|
|
@@ -2849,7 +2867,6 @@ export class ChemControllerStateAlarms extends ChildEqState {
|
|
|
2849
2867
|
this.hasChanged = true;
|
|
2850
2868
|
}
|
|
2851
2869
|
}
|
|
2852
|
-
|
|
2853
2870
|
public get comms(): number { return typeof this.data.comms === 'undefined' ? undefined : this.data.comms.val; }
|
|
2854
2871
|
public set comms(val: number) {
|
|
2855
2872
|
if (this.comms !== val) {
|
|
@@ -2857,6 +2874,14 @@ export class ChemControllerStateAlarms extends ChildEqState {
|
|
|
2857
2874
|
this.hasChanged = true;
|
|
2858
2875
|
}
|
|
2859
2876
|
}
|
|
2877
|
+
public get freezeProtect(): number { return typeof this.data.freezeProtect === 'undefined' ? undefined : this.data.freezeProtect.val; }
|
|
2878
|
+
public set freezeProtect(val: number) {
|
|
2879
|
+
if (this.freezeProtect !== val) {
|
|
2880
|
+
this.data.freezeProtect = sys.board.valueMaps.chemControllerAlarms.transform(val);
|
|
2881
|
+
this.hasChanged = true;
|
|
2882
|
+
}
|
|
2883
|
+
}
|
|
2884
|
+
|
|
2860
2885
|
}
|
|
2861
2886
|
export class AppVersionState extends EqState {
|
|
2862
2887
|
public get nextCheckTime(): string { return this.data.nextCheckTime; }
|
|
@@ -1,45 +1,45 @@
|
|
|
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 { IntelliCenterBoard } from './IntelliCenterBoard';
|
|
18
|
-
import { IntelliTouchBoard } from './IntelliTouchBoard';
|
|
19
|
-
import { IntelliComBoard } from './IntelliComBoard';
|
|
20
|
-
import { EasyTouchBoard } from './EasyTouchBoard';
|
|
21
|
-
import { SystemBoard } from './SystemBoard';
|
|
22
|
-
import { ControllerType } from '../Constants';
|
|
23
|
-
import { PoolSystem } from '../Equipment';
|
|
24
|
-
import { NixieBoard } from './NixieBoard';
|
|
25
|
-
|
|
26
|
-
export class BoardFactory {
|
|
27
|
-
// Factory create the system board from the controller type. Resist storing
|
|
28
|
-
// the pool system as this can cause a leak. The PoolSystem object already has a reference to this.
|
|
29
|
-
public static fromControllerType(ct: ControllerType, system: PoolSystem) {
|
|
30
|
-
switch (ct) {
|
|
31
|
-
case ControllerType.IntelliCenter:
|
|
32
|
-
return new IntelliCenterBoard(system);
|
|
33
|
-
case ControllerType.IntelliTouch:
|
|
34
|
-
return new IntelliTouchBoard(system);
|
|
35
|
-
case ControllerType.IntelliCom:
|
|
36
|
-
return new IntelliComBoard(system);
|
|
37
|
-
case ControllerType.EasyTouch:
|
|
38
|
-
return new EasyTouchBoard(system);
|
|
39
|
-
case ControllerType.Nixie:
|
|
40
|
-
return new NixieBoard(system);
|
|
41
|
-
}
|
|
42
|
-
return new SystemBoard(system);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
}
|
|
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 { IntelliCenterBoard } from './IntelliCenterBoard';
|
|
18
|
+
import { IntelliTouchBoard } from './IntelliTouchBoard';
|
|
19
|
+
import { IntelliComBoard } from './IntelliComBoard';
|
|
20
|
+
import { EasyTouchBoard } from './EasyTouchBoard';
|
|
21
|
+
import { SystemBoard } from './SystemBoard';
|
|
22
|
+
import { ControllerType } from '../Constants';
|
|
23
|
+
import { PoolSystem } from '../Equipment';
|
|
24
|
+
import { NixieBoard } from './NixieBoard';
|
|
25
|
+
|
|
26
|
+
export class BoardFactory {
|
|
27
|
+
// Factory create the system board from the controller type. Resist storing
|
|
28
|
+
// the pool system as this can cause a leak. The PoolSystem object already has a reference to this.
|
|
29
|
+
public static fromControllerType(ct: ControllerType, system: PoolSystem) {
|
|
30
|
+
switch (ct) {
|
|
31
|
+
case ControllerType.IntelliCenter:
|
|
32
|
+
return new IntelliCenterBoard(system);
|
|
33
|
+
case ControllerType.IntelliTouch:
|
|
34
|
+
return new IntelliTouchBoard(system);
|
|
35
|
+
case ControllerType.IntelliCom:
|
|
36
|
+
return new IntelliComBoard(system);
|
|
37
|
+
case ControllerType.EasyTouch:
|
|
38
|
+
return new EasyTouchBoard(system);
|
|
39
|
+
case ControllerType.Nixie:
|
|
40
|
+
return new NixieBoard(system);
|
|
41
|
+
}
|
|
42
|
+
return new SystemBoard(system);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
}
|