nodejs-poolcontroller 8.0.0 → 8.0.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.
@@ -1398,6 +1398,7 @@ export class PumpCollection extends EqItemCollection<Pump> {
1398
1398
  if (typeof add !== 'undefined' && add) return this.add(data || { id: this.data.length + 1, address: address });
1399
1399
  return this.createItem(data || { id: this.data.length + 1, address: address });
1400
1400
  }
1401
+ public getNextEquipmentId(range?: EquipmentIdRange, exclude?: number[]): number { return super.getNextEquipmentId(typeof range === 'undefined' ? sys.board.equipmentIds.pumps : range, exclude); }
1401
1402
  }
1402
1403
  export class Pump extends EqItem {
1403
1404
  public dataName = 'pumpConfig';
@@ -613,7 +613,7 @@ export class TouchConfigQueue extends ConfigQueue {
613
613
  response: Response.create({
614
614
  response: true
615
615
  , callback: () => {
616
- console.log(`CALLBACKED`);
616
+ // console.log(`CALLBACKED`);
617
617
  }
618
618
  // , callback: () => {
619
619
  // self.processNext(out);
@@ -1,7 +1,7 @@
1
1
  import { ControllerType, Timestamp, Utils, utils } from '../../controller/Constants';
2
2
  import { LightGroup, LightGroupCircuit, sys, Valve, Body, Pump, PumpCircuit, Remote} from '../../controller/Equipment';
3
3
  import { CircuitState, state, ValveState } from '../../controller/State';
4
- import { SLChemData, RemoteLogin, UnitConnection, FindUnits, SLEquipmentStateData, SLIntellichlorData, SLPumpStatusData, SLScheduleData, SLSystemTimeData, HeatModes, SLControllerConfigData, SLEquipmentConfigurationData, HeaterConfig, Valves } from 'node-screenlogic';
4
+ import { RemoteLogin, UnitConnection, FindUnits, SLEquipmentStateData, SLIntellichlorData, SLPumpStatusData, SLScheduleData, SLSystemTimeData, HeatModes, SLControllerConfigData, SLEquipmentConfigurationData, HeaterConfig, Valves, SLChemData, SLGetCustomNamesData } from 'node-screenlogic';
5
5
  import * as Screenlogic from 'node-screenlogic';
6
6
  import { EasyTouchBoard } from '../../controller/boards/EasyTouchBoard';
7
7
  import { IntelliTouchBoard } from '../../controller/boards/IntelliTouchBoard';
@@ -15,7 +15,7 @@ import { Message } from './messages/Messages';
15
15
 
16
16
  export class ScreenLogicComms {
17
17
  constructor() {
18
- this._client = Screenlogic.screenlogic;
18
+ this._client = new Screenlogic.UnitConnection();
19
19
  };
20
20
  public a: SLChemData;
21
21
  public counter: SLCounter = new SLCounter();
@@ -47,11 +47,10 @@ export class ScreenLogicComms {
47
47
  this.controller = new SLController(this._client);
48
48
  let cfg = config.getSection('controller.comms');
49
49
  if (typeof cfg !== 'undefined') this._cfg = cfg;
50
- this.enabled = this._cfg.enabled;
50
+ this.enabled = this._cfg.enabled && this._cfg.type === 'screenlogic';
51
51
  if (!this._cfg.enabled || this._cfg.type !== 'screenlogic') {
52
52
  return;
53
53
  }
54
-
55
54
  let systemName = this._cfg.screenlogic.systemName; // 'Pentair: 00-00-00';
56
55
  let password = this._cfg.screenlogic.password.toString(); // '1111';
57
56
 
@@ -766,11 +765,11 @@ class Controller {
766
765
  logger.error(`Caught error in decodeEquipmentState: ${err.message}`);
767
766
  }
768
767
  }
769
- public static async decodeCustomNames(customNames: string[]) {
768
+ public static async decodeCustomNames(customNames: SLGetCustomNamesData) {
770
769
  for (let i = 0; i < sys.equipment.maxCustomNames; i++) {
771
770
  let data = {
772
771
  id: i,
773
- name: customNames[i]
772
+ name: customNames.names[i]
774
773
  }
775
774
  try {
776
775
 
@@ -1101,14 +1100,14 @@ class Controller {
1101
1100
  pstate.command = (pstate.rpm > 0 || pstate.watts > 0) ? 10 : 0;
1102
1101
  state.emitEquipmentChanges();
1103
1102
  }
1104
- public static async decodeSchedules(slrecurring: SLScheduleData[], slrunonce: SLScheduleData[]) {
1103
+ public static async decodeSchedules(slrecurring: SLScheduleData, slrunonce: SLScheduleData) {
1105
1104
  /* reccuring schedules: [{"scheduleId":1,"circuitId":6,"startTime":"1800","stopTime":"0700","dayMask":127,"flags":0,"heatCmd":4,"heatSetPoint":70,"days":["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]},
1106
1105
 
1107
1106
  {"scheduleId":4,"circuitId":2,"startTime":"1800","stopTime":"2300","dayMask":127,"flags":0,"heatCmd":0,"heatSetPoint":0,"days":["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]},{"scheduleId":11,"circuitId":6,"startTime":"0800","stopTime":"1700","dayMask":127,"flags":0,"heatCmd":4,"heatSetPoint":70,"days":["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]}]
1108
1107
 
1109
1108
  Run once schedules: [{"scheduleId":12,"circuitId":6,"startTime":"0800","stopTime":"1100","dayMask":1,"flags":1,"heatCmd":4,"heatSetPoint":70,"days":["Mon"]},{"scheduleId":13,"circuitId":6,"startTime":"0800","stopTime":"1100","dayMask":1,"flags":1,"heatCmd":4,"heatSetPoint":70,"days":["Mon"]}] */
1110
1109
 
1111
- for (let i = 0; i < slrecurring.length; i++) {
1110
+ for (let i = 0; i < slrecurring.data.length; i++) {
1112
1111
  let slsched = slrecurring[i];
1113
1112
  let data = {
1114
1113
  id: slsched.scheduleId,
@@ -1126,13 +1125,14 @@ class Controller {
1126
1125
  logger.error(`Error setting schedule ${slsched.scheduleId}. ${err.message}`);
1127
1126
  }
1128
1127
  }
1129
- for (let i = 0; i < slrunonce.length; i++) {
1130
- let slsched = slrunonce[i];
1128
+ for (let i = 0; i < slrunonce.data.length; i++) {
1129
+ let slsched = slrunonce.data[i];
1131
1130
  let data = {
1132
1131
  id: slsched.scheduleId,
1133
1132
  circuit: slsched.circuitId,
1134
- startTime: Math.floor(slsched.startTime / 100) * 60 + slsched.startTime % 100,
1135
- endTime: Math.floor(slsched.stopTime / 100) * 60 + slsched.stopTime % 100,
1133
+ // start and stop come in as military time string
1134
+ startTime: parseInt(slsched.startTime, 10),
1135
+ endTime: parseInt(slsched.stopTime, 10),
1136
1136
  scheduleDays: slsched.dayMask,
1137
1137
  changeHeatSetPoint: slsched.heatCmd > 0,
1138
1138
  heatSetPoint: slsched.heatSetPoint,
@@ -1654,7 +1654,7 @@ export class SLController extends SLCommands {
1654
1654
  public async setCustomName(idx: number, name: string){
1655
1655
  try {
1656
1656
  let ack = await this._unit.equipment.setCustomNameAsync(idx, name);
1657
- logger.silly(`Screenlogic:set custom name result: ${ack}`);
1657
+ logger.silly(`Screenlogic:set custom name result: ${JSON.stringify(ack)}`);
1658
1658
  } catch (error) {
1659
1659
  return Promise.reject(new InvalidOperationError('Unable to set custom name.', error.message));
1660
1660
  }
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "controller": {
3
3
  "comms": {
4
+ "type": "local",
4
5
  "portId": 0,
5
6
  "enabled": true,
6
7
  "rs485Port": "/dev/ttyUSB0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodejs-poolcontroller",
3
- "version": "8.0.0",
3
+ "version": "8.0.1",
4
4
  "description": "nodejs-poolController",
5
5
  "main": "app.js",
6
6
  "author": {
@@ -31,7 +31,7 @@
31
31
  "mqtt": "^4.3.7",
32
32
  "multer": "^1.4.5-lts.1",
33
33
  "multicast-dns": "^7.2.4",
34
- "node-screenlogic": "^1.10.1",
34
+ "node-screenlogic": "^2.0.0",
35
35
  "node-ssdp": "^4.0.1",
36
36
  "serialport": "^10.4.0",
37
37
  "socket.io": "^4.5.0",