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 SLMessage = require('./SLMessage.js').SLMessage;
|
||||||
|
|
||||||
|
const SPA_CIRCUIT_ID = 500;
|
||||||
|
const POOL_CIRCUIT_ID = 505;
|
||||||
|
|
||||||
exports.SLPoolStatusMessage = class SLPoolStatusMessage extends SLMessage {
|
exports.SLPoolStatusMessage = class SLPoolStatusMessage extends SLMessage {
|
||||||
constructor(buf) {
|
constructor(buf) {
|
||||||
super(0, 12526);
|
super(0, 12526);
|
||||||
@ -67,4 +70,32 @@ exports.SLPoolStatusMessage = class SLPoolStatusMessage extends SLMessage {
|
|||||||
this.orpTank = this.readInt32LE();
|
this.orpTank = this.readInt32LE();
|
||||||
this.alarms = 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
2
test.js
2
test.js
@ -15,6 +15,8 @@ finder.on('serverFound', function(server) {
|
|||||||
console.log(" salt ppm=" + status.saltPPM);
|
console.log(" salt ppm=" + status.saltPPM);
|
||||||
console.log(" pH=" + status.pH);
|
console.log(" pH=" + status.pH);
|
||||||
console.log(" saturation=" + status.saturation);
|
console.log(" saturation=" + status.saturation);
|
||||||
|
console.log(" spa active=" + status.isSpaActive());
|
||||||
|
console.log(" pool active=" + status.isPoolActive());
|
||||||
}).on('controllerConfig', function(config) {
|
}).on('controllerConfig', function(config) {
|
||||||
console.log(" controller is in celsius=" + config.degC);
|
console.log(" controller is in celsius=" + config.degC);
|
||||||
client.close();
|
client.close();
|
||||||
|
Reference in New Issue
Block a user