Added ability to set circuit state
This allows for, for example, turning on a water feature or changing pool/spa active status.
This commit is contained in:
8
index.js
8
index.js
@ -127,6 +127,10 @@ class UnitConnection extends EventEmitter {
|
||||
this.client.write(new messages.SLVersionMessage().toBuffer());
|
||||
}
|
||||
|
||||
setCircuitState(controllerId, circuitId, circuitState) {
|
||||
this.client.write(new messages.SLSetCircuitStateMessage(controllerId, circuitId, circuitState).toBuffer());
|
||||
}
|
||||
|
||||
onClientMessage(msg) {
|
||||
//console.log('received message of length ' + msg.length);
|
||||
if (msg.length < 4) {
|
||||
@ -163,6 +167,10 @@ class UnitConnection extends EventEmitter {
|
||||
//console.log(" it's version");
|
||||
this.emit('version', new messages.SLVersionMessage(msg));
|
||||
break;
|
||||
case messages.SLSetCircuitStateMessage.getResponseId():
|
||||
//console.log(" it's circuit toggle ack");
|
||||
this.emit('circuitStateChanged', new messages.SLSetCircuitStateMessage());
|
||||
break;
|
||||
default:
|
||||
//console.log(" it's unknown. type: " + msgType);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user