Created
November 20, 2017 20:56
-
-
Save marcusramberg/6a63b01588137bb6e85ae4602a12f136 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Milight = require('../Source/node-milight-promise/src/index').MilightController; | |
var commands = require('../Source/node-milight-promise/src/index').commandsV6; | |
// Important Notes: | |
// * Instead of providing the global broadcast address which is the default, you should provide the IP address | |
// of the Milight Controller for unicast mode. Don't use the global broadcast address on Windows as this may give | |
// unexpected results. On Windows, global broadcast packets will only be routed via the first network adapter. If | |
// you want to use a broadcast address though, use a network-specific address, e.g. for `192.168.0.1/24` use | |
// `192.168.0.255`. | |
// * Note, for the V6 command set each command must be proevided with a zone parameter as shown in the example below! | |
var light = new Milight({ | |
ip: "192.168.86.xx", | |
type: 'v6' | |
}), | |
zone = 2; | |
if(process.argv[2] && process.argv[2] == 'on') { | |
light.sendCommands(commands.white.on(zone), commands.white.maxBright(zone)); | |
} else { | |
light.sendCommands(commands.white.off(zone)); | |
} | |
light.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment