Added ability to send light commands (on, off, set colors, etc.)

This implementation is barebones and only does what I was able to find easily in the official app's source code. I'd love to do more with this, so any pull requests adding functionality would be welcomed.

Closes https://github.com/parnic/node-screenlogic/issues/4
This commit is contained in:
2019-07-29 21:37:36 -05:00
parent 3b774923eb
commit 5ec3fbb802
5 changed files with 88 additions and 0 deletions

View File

@ -0,0 +1,25 @@
'use strict';
const SLMessage = require('./SLMessage.js').SLMessage;
const MSG_ID = 12556;
exports.SLLightControl = class SLLightControl extends SLMessage {
constructor(controllerIndex, command) {
super(0, MSG_ID);
this.controllerIndex = controllerIndex;
this.command = command;
}
encode() {
this.writeInt32LE(this.controllerIndex || 0);
this.writeInt32LE(this.command || 0);
super.encode();
}
static getResponseId() {
return MSG_ID + 1;
}
};