Ensure all messages populate the response senderId

Fixed `addClient` and `removeClient` events returning `SLCancelDelay` objects. This shouldn't really make a difference as there are no properties to worry about on one or the other, but it was still incorrect and could cause bugs if stuff was added to those messages in the future.
This commit is contained in:
2020-08-12 08:51:44 -05:00
parent 8294947f8c
commit 27bdf0380e
11 changed files with 100 additions and 57 deletions

View File

@ -6,9 +6,14 @@ const MSG_ID = 12522;
exports.SLAddClient = class SLAddClient extends SLMessage {
constructor(clientId, senderId) {
super(senderId, MSG_ID);
if (typeof clientId === 'object') {
var size = clientId.readInt32LE(4) + 8;
super(clientId, MSG_ID, size);
} else {
super(senderId, MSG_ID);
this.clientId = clientId;
this.clientId = clientId;
}
}
encode() {

View File

@ -6,10 +6,15 @@ const MSG_ID = 12556;
exports.SLLightControl = class SLLightControl extends SLMessage {
constructor(controllerIndex, command, senderId) {
super(senderId, MSG_ID);
if (typeof controllerIndex === 'object') {
var size = controllerIndex.readInt32LE(4) + 8;
super(controllerIndex, MSG_ID, size);
} else {
super(senderId, MSG_ID);
this.controllerIndex = controllerIndex;
this.command = command;
this.controllerIndex = controllerIndex;
this.command = command;
}
}
encode() {

View File

@ -6,9 +6,14 @@ const MSG_ID = 12524;
exports.SLRemoveClient = class SLRemoveClient extends SLMessage {
constructor(clientId, senderId) {
super(senderId, MSG_ID);
if (typeof clientId === 'object') {
var size = clientId.readInt32LE(4) + 8;
super(clientId, MSG_ID, size);
} else {
super(senderId, MSG_ID);
this.clientId = clientId;
this.clientId = clientId;
}
}
encode() {

View File

@ -7,10 +7,15 @@ const MSG_ID = 12550;
exports.SLSetCircuitRuntimeById = class SLSetCircuitRuntimeById extends SLMessage {
constructor(circuitId, runTime, senderId) {
super(senderId, MSG_ID);
if (typeof circuitId === 'object') {
var size = circuitId.readInt32LE(4) + 8;
super(circuitId, MSG_ID, size);
} else {
super(senderId, MSG_ID);
this.circuitId = circuitId;
this.runTime = runTime;
this.circuitId = circuitId;
this.runTime = runTime;
}
}
encode() {

View File

@ -6,11 +6,16 @@ const MSG_ID = 12530;
exports.SLSetCircuitStateMessage = class SLSetCircuitStateMessage extends SLMessage {
constructor(controllerId, circuitId, circuitState, senderId) {
super(senderId, MSG_ID);
if (typeof controllerId === 'object') {
var size = controllerId.readInt32LE(4) + 8;
super(controllerId, MSG_ID, size);
} else {
super(senderId, MSG_ID);
this.controllerId = controllerId;
this.circuitId = circuitId;
this.circuitState = circuitState;
this.controllerId = controllerId;
this.circuitId = circuitId;
this.circuitState = circuitState;
}
}
encode() {

View File

@ -6,13 +6,16 @@ const MSG_ID = 12538;
exports.SLSetHeatMode = class SLSetHeatMode extends SLMessage {
constructor(controllerIndex, bodyType, heatMode, senderId) {
super(senderId, MSG_ID);
if (typeof controllerIndex === 'object') {
var size = controllerIndex.readInt32LE(4) + 8;
super(controllerIndex, MSG_ID, size);
} else {
super(senderId, MSG_ID);
this.controllerIndex = controllerIndex;
this.bodyType = bodyType;
this.heatMode = heatMode;
// heatmodes:
// 0: "Off", 1: "Solar", 2 : "Solar Preferred", 3 : "Heat Pump", 4: "Don't Change"
this.controllerIndex = controllerIndex;
this.bodyType = bodyType;
this.heatMode = heatMode;
}
}
encode() {

View File

@ -6,11 +6,16 @@ const MSG_ID = 12528;
exports.SLSetHeatSetPoint = class SLSetHeatSetPoint extends SLMessage {
constructor(controllerIndex, bodyType, temperature, senderId) {
super(senderId, MSG_ID);
if (typeof controllerIndex === 'object') {
var size = controllerIndex.readInt32LE(4) + 8;
super(controllerIndex, MSG_ID, size);
} else {
super(senderId, MSG_ID);
this.controllerIndex = controllerIndex;
this.bodyType = bodyType;
this.temperature = temperature;
this.controllerIndex = controllerIndex;
this.bodyType = bodyType;
this.temperature = temperature;
}
}
encode() {

View File

@ -6,16 +6,21 @@ const MSG_ID = 12586;
exports.SLSetPumpFlow = class SLSetPumpFlow extends SLMessage {
constructor(pumpId, circuitId, setPoint, isRPMs, senderId) {
super(senderId, MSG_ID);
this.pumpId = pumpId;
this.circuitId = circuitId;
this.setPoint = setPoint;
if (isRPMs === true) {
this.isRPMs = 1;
if (typeof pumpId === 'object') {
var size = pumpId.readInt32LE(4) + 8;
super(pumpId, MSG_ID, size);
} else {
this.isRPMs = 0;
super(senderId, MSG_ID);
this.pumpId = pumpId;
this.circuitId = circuitId;
this.setPoint = setPoint;
if (isRPMs === true) {
this.isRPMs = 1;
} else {
this.isRPMs = 0;
}
}
}

View File

@ -6,11 +6,16 @@ const MSG_ID = 12576;
exports.SLSetSaltCellConfigMessage = class SLSetSaltCellConfigMessage extends SLMessage {
constructor(controllerIndex, poolOutput, spaOutput, senderId) {
super(senderId, MSG_ID);
if (typeof controllerIndex === 'object') {
var size = controllerIndex.readInt32LE(4) + 8;
super(controllerIndex, MSG_ID, size);
} else {
super(senderId, MSG_ID);
this.controllerIndex = controllerIndex;
this.poolOutput = poolOutput;
this.spaOutput = spaOutput;
this.controllerIndex = controllerIndex;
this.poolOutput = poolOutput;
this.spaOutput = spaOutput;
}
}
encode() {