Added SLEquipmentConfigurationMessage

I am not documenting this in the readme just yet because I don't really know how to interpret the data provided, but it seems to be necessary if we want to be able to change pump speeds in the future or read any historical data about the equipment. I'm not sure how much I'm going to be able to figure out about these arrays since the data appears random to me at the moment, but perhaps others will be able to figure out what's in here.
This commit is contained in:
2020-02-22 11:29:29 -06:00
parent da9864462b
commit 81b3a61c28
3 changed files with 60 additions and 0 deletions

View File

@ -202,6 +202,10 @@ class UnitConnection extends EventEmitter {
this.client.write(new messages.SLVersionMessage().toBuffer());
}
getEquipmentConfiguration() {
this.client.write(new messages.SLEquipmentConfigurationMessage().toBuffer());
}
setCircuitState(controllerId, circuitId, circuitState) {
this.client.write(new messages.SLSetCircuitStateMessage(controllerId, circuitId, circuitState).toBuffer());
}
@ -279,6 +283,9 @@ class UnitConnection extends EventEmitter {
// console.log(" it's a set salt cell config ack");
this.emit('setSaltCellConfig', new messages.SLSetSaltCellConfigMessage());
break;
case messages.SLEquipmentConfigurationMessage.getResponseId():
this.emit('equipmentConfiguration', new messages.SLEquipmentConfigurationMessage(msg));
break;
case 13:
// console.log(" it's a login failure.");
this.emit('loginFailed');

View File

@ -0,0 +1,51 @@
'use strict';
const SLMessage = require('./SLMessage.js').SLMessage;
const MSG_ID = 12566;
exports.SLEquipmentConfigurationMessage = class SLEquipmentConfigurationMessage extends SLMessage {
constructor(buf) {
var size;
if (buf) {
size = buf.readInt32LE(4) + 8;
}
super(0, MSG_ID, size);
if (!buf) {
this.writeInt32LE(0);
this.writeInt32LE(0);
} else {
this._wroteSize = true;
this.writeBuffer(buf, 0);
this.decode();
}
}
decode() {
super.decode();
this.controllerType = this.readUInt8();
this.hardwareType = this.readUInt8();
this.readUInt8();
this.readUInt8();
this.controllerData = this.readInt32LE();
this.versionDataArray = this.readSLArray();
this.speedDataArray = this.readSLArray();
this.valveDataArray = this.readSLArray();
this.remoteDataArray = this.readSLArray();
this.sensorDataArray = this.readSLArray();
this.delayDataArray = this.readSLArray();
this.macroDataArray = this.readSLArray();
this.miscDataArray = this.readSLArray();
this.lightDataArray = this.readSLArray();
this.flowDataArray = this.readSLArray();
this.sgDataArray = this.readSLArray();
this.spaFlowDataArray = this.readSLArray();
}
static getResponseId() {
return MSG_ID + 1;
}
};

View File

@ -13,3 +13,5 @@ exports.SLSetHeatSetPointMessage = require('./SLSetHeatSetPoint.js').SLSetHeatSe
exports.SLSetHeatModeMessage = require('./SLSetHeatMode.js').SLSetHeatMode;
exports.SLLightControlMessage = require('./SLLightControl.js').SLLightControl;
exports.SLSetSaltCellConfigMessage = require('./SLSetSaltCellConfigMessage.js').SLSetSaltCellConfigMessage;
exports.SLEquipmentConfigurationMessage =
require('./SLEquipmentConfigurationMessage.js').SLEquipmentConfigurationMessage;