Skip to content

Instantly share code, notes, and snippets.

@sirvar
Created April 1, 2019 23:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sirvar/5154ae146a4763f94633f033799764bb to your computer and use it in GitHub Desktop.
Save sirvar/5154ae146a4763f94633f033799764bb to your computer and use it in GitHub Desktop.
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