README
philips-hue-controller
I wanted to build an Application to controll my Hue Lamps from my PC and got fed up with there not being a good Package to help me build it. Building everything from scratch took forever and i want to save other people from having to do this.
Features
- Set Lamp Colors using RGB instead of XY / Hue
- Use Promises or Async/Await
- Easy to use and setup
Getting your Bridges IP and generating a Username
Read the Offical Meethue Developer Documentation for a complete explanation: https://developers.meethue.com/develop/get-started-2/
IP-Adress:
Go to https://discovery.meethue.com/ to see your Bridges IP-Adress
Username:
Follow the Steps under: https://developers.meethue.com/develop/get-started-2/#so-lets-get-started
Installation
npm install philips-hue-controller
Examples
Inital Setup
const hue = require('philips-hue-controller');
hue.config({
"ip":"YOUR-BRIDGES-IP-ADRESS",
"key":"YOUR-GENERATED-USERNAME"
});
List of Lamps, Groups and Sensors
const hue = require('philips-hue-controller');
hue.config({
"ip":"YOUR-BRIDGES-IP-ADRESS",
"key":"YOUR-GENERATED-USERNAME"
});
// Lamps
hue.getLights().then((resp) => {
console.log(resp.data) // Returns Object with all Lamps
})
// Groups
hue.getGroups().then((resp) => {
console.log(resp.data) // Returns Object with all Lamps
})
// Sensors
hue.getSensors().then((resp) => {
console.log(resp.data) // Returns Object with all Lamps
})
Change State of individual Lights
const hue = require('philips-hue-controller');
hue.config({
"ip":"YOUR-BRIDGES-IP-ADRESS",
"key":"YOUR-GENERATED-USERNAME"
});
// Change State
/*
[9] -> LampID | ID of the Lamp
[true] -> State | Can be either true or false. true: on, false: off
*/
hue.changeState(9, true);
// Change Brightness
/*
[9] -> LampID | ID of the Lamp
[125] -> Brightness | An Integer from 0-255
*/
hue.changeBrightness(9, 125);
// Change Color / Hue using RGB
/*
[9] -> LampID | ID of the Lamp
R [103] -> R-Value | Change the Color of the Lamp.
G [227] -> G-Value | Change the Color of the Lamp.
B [222] -> B-Value | Change the Color of the Lamp.
---
TThis function will change the Brightness of the Bulb according to the Color provided.
*/
hue.changeColor(9, 103, 227, 222);
Tutorials
If you made a Tutorial on how to use this Package please DM me on Twitter to have your Video displayed here.
Credits
Philips-Hue-Controller is using axios for API calls.
License
This Project is licensed under the MIT License