Added quick way to check if pool/spa are on
Added interpreters for 'ok' variable
This commit is contained in:
@ -1,5 +1,8 @@
|
||||
const SLMessage = require('./SLMessage.js').SLMessage;
|
||||
|
||||
const SPA_CIRCUIT_ID = 500;
|
||||
const POOL_CIRCUIT_ID = 505;
|
||||
|
||||
exports.SLPoolStatusMessage = class SLPoolStatusMessage extends SLMessage {
|
||||
constructor(buf) {
|
||||
super(0, 12526);
|
||||
@ -67,4 +70,32 @@ exports.SLPoolStatusMessage = class SLPoolStatusMessage extends SLMessage {
|
||||
this.orpTank = this.readInt32LE();
|
||||
this.alarms = this.readInt32LE();
|
||||
}
|
||||
|
||||
isDeviceReady() {
|
||||
return this.ok === 1;
|
||||
}
|
||||
|
||||
isDeviceSync() {
|
||||
return this.ok === 2;
|
||||
}
|
||||
|
||||
isDeviceServiceMode() {
|
||||
return this.ok === 3;
|
||||
}
|
||||
|
||||
isSpaActive() {
|
||||
for (let i = 0; i < this.circuitArray.length; i++) {
|
||||
if (this.circuitArray[i].id === SPA_CIRCUIT_ID) {
|
||||
return this.circuitArray[i].state === 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
isPoolActive() {
|
||||
for (let i = 0; i < this.circuitArray.length; i++) {
|
||||
if (this.circuitArray[i].id === POOL_CIRCUIT_ID) {
|
||||
return this.circuitArray[i].state === 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user