Created
April 1, 2019 23:08
-
-
Save sirvar/5154ae146a4763f94633f033799764bb 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
const Milight = require('node-milight-promise').MilightController | |
const commands = require('node-milight-promise').commandsV6 | |
const express = require('express') | |
const app = express() | |
var light = new Milight({ | |
ip: "MILIGHT_CONTROLLER_IP", | |
type: 'v6' | |
}), | |
zone = 1 | |
app.get('/on', (req, res) => { | |
light.sendCommands(commands.rgbw.on(zone)) | |
res.send("success") | |
}) | |
app.get('/off', (req, res) => { | |
light.sendCommands(commands.rgbw.off(zone)) | |
res.send("success") | |
}) | |
app.listen(3000, function() { | |
console.log("Listening on port 3000") | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment