node-milight
node-milight copied to clipboard
A new endpoint that accepts custom hexabyte array
Hi @oeuillot!
I have a request to create a new custom endpoint which accepts custom hexa code array as a parameter, so it'll be compatible with future devices.
The main reason behind this is: we wrapped your library with a REST framework and our lamps support the "disco" mode which has a new hexa array as you can see it here.
Hello,
Can you write a sample ? How do you want to use it ?
Regards,
Is-it a problem if I migrate this project to ES6 ? (nodejs >=4.0)
Moving to ES6 would be great! :wink:
About the custom endpoint: Based on the current implementation I would imagine somthing like this:
Zone.prototype.customMode = function(callback, customCommand) {
callback = callback || _defaultCallback;
// here could be a default customCommand or a return if empty
var milight = this._milight;
var zones = this.zones;
milight._sync(function(callback) {
async.eachSeries(zones, function(zone, callback) {
milight._send(customCommand, callback);
}, callback);
}, callback);
};
Hello I have committed a new version in Branch ES6. I will test it this night !
Your latest commit looks great, but I haven't tested it!
Hi @oeuillot, I've loaded your ES6 branch to my project, but sadly it throws a bunch of errors.. (syntax error, undefined super this)
Hello @ocReaper ,
Which version of node do you use ?
node --version returns what ?
v5.6.0
I use >v6.0 can you try this version ?
2016-06-23 10:55 GMT+02:00 Ákos Resch [email protected]:
v5.6.0
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/oeuillot/node-milight/issues/4#issuecomment-227989344, or mute the thread https://github.com/notifications/unsubscribe/ADLFW0hNZS3VtMK3N7xBob25uoLUpv1Tks5qOkobgaJpZM4IiKTB .
I installed the latest version (v6.2.2) but the errors are still there..
\milight\lib\zone.js:522
});
^
SyntaxError: Unexpected token )
at Object.exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:513:28)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (path\to\milight\lib\milight.js:9:12)
at Module._compile (module.js:541:32)
after I fix it:
milight\lib\milight.js:22
super(this, 0);
^
ReferenceError: this is not defined
at Milight (path\to\milight\lib\milight.js:22:11)
at Object.<anonymous> (path\to\my\index.js:14:15)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.runMain (module.js:575:10)
at run (node.js:348:7)
at startup (node.js:140:9)
Ok I will fix it today ...