Added server support for issuing light commands
This commit is contained in:
@ -33,6 +33,13 @@ module.exports = NodeHelper.create({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setLightcmd: function(lightCmd) {
|
||||||
|
var self = this;
|
||||||
|
setLights(lightCmd, function(poolStatus) {
|
||||||
|
self.sendSocketNotification('SCREENLOGIC_LIGHTCMD_DONE', {lightCmd: lightCmd, status: poolStatus});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
restartTimer: function() {
|
restartTimer: function() {
|
||||||
var interval = this.updateInterval;
|
var interval = this.updateInterval;
|
||||||
this.updateInterval = undefined;
|
this.updateInterval = undefined;
|
||||||
@ -183,3 +190,21 @@ function setHeatstateState(heatstate, cb) {
|
|||||||
|
|
||||||
foundUnit.connect();
|
foundUnit.connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setLights(lightCmd, cb) {
|
||||||
|
if (!foundUnit) {
|
||||||
|
cb();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foundUnit.once('loggedIn', function() {
|
||||||
|
foundUnit.sendLightCommand(0, lightCmd);
|
||||||
|
}).once('sentLightCommand', function() {
|
||||||
|
foundUnit.getPoolStatus();
|
||||||
|
}).once('poolStatus', function(status) {
|
||||||
|
foundUnit.close();
|
||||||
|
cb(status);
|
||||||
|
});
|
||||||
|
|
||||||
|
foundUnit.connect();
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user