GetPumpStatus / SetPumpFlow commands (#28)

* added GetPumpStatus / SetPumpFlow commands

* Updated README.md with GetPumpStatus / SetPumpFlow information

* rename `setPointType` to `isRPMs`

* renamed val0 to pumpType and val1 to isRunning

* added `unknown command` case

* fixed lint error

* Renamed unknown values to pumpUnknown1 and pumpUnknown2

* renamed 30 to unknownCommand
This commit is contained in:
Bruce Sheplan
2020-06-09 07:49:24 -05:00
committed by GitHub
parent 219ce110ea
commit 75d642cbfc
5 changed files with 139 additions and 1 deletions

View File

@ -253,6 +253,14 @@ class UnitConnection extends EventEmitter {
this.client.write(new messages.SLSetCircuitRuntimeById(circuitId, runTime).toBuffer());
}
getPumpStatus(pumpId) {
this.client.write(new messages.SLGetPumpStatus(null, pumpId).toBuffer());
}
setPumpFlow(pumpId, circuitId, setPoint, isRPMs) {
this.client.write(new messages.SLSetPumpFlow(pumpId, circuitId, setPoint, isRPMs).toBuffer());
}
onClientMessage(msg) {
// console.log('received message of length ' + msg.length);
if (msg.length < 4) {
@ -328,10 +336,20 @@ class UnitConnection extends EventEmitter {
case messages.SLSetCircuitRuntimeById.getResponseId():
this.emit('setCircuitRuntimebyId', new messages.SLSetCircuitRuntimeById());
break;
case messages.SLGetPumpStatus.getResponseId():
this.emit('getPumpStatus', new messages.SLGetPumpStatus(msg));
break;
case messages.SLSetPumpFlow.getResponseId():
this.emit('setPumpFlow', new messages.SLSetPumpFlow());
break;
case 13:
// console.log(" it's a login failure.");
this.emit('loginFailed');
break;
case 30:
// console.log("unknown command");
this.emit('unknownCommand');
break;
case 31:
// console.log(" it's a parameter failure.");
this.emit('badParameter');