https://github.com/octoblu/node-hue-util
Node module for controlling Philips Hue lights
https://github.com/octoblu/node-hue-util
Last synced: 12 months ago
JSON representation
Node module for controlling Philips Hue lights
- Host: GitHub
- URL: https://github.com/octoblu/node-hue-util
- Owner: octoblu
- License: mit
- Created: 2015-07-23T19:41:52.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2017-03-03T01:32:37.000Z (over 9 years ago)
- Last Synced: 2025-08-09T08:20:40.712Z (about 1 year ago)
- Language: CoffeeScript
- Homepage:
- Size: 27.3 KB
- Stars: 2
- Watchers: 12
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Philips
Node module for controlling Philips Hue lights
## Installation
`npm install hue-util`
## Example
```javascript
var HueUtil = require('hue-util');
var app = 'hue-util';
var ipAddress = '192.168.1.15'; // Use the ipAddress of the bridge or null
var username = null;
var hue = new HueUtil(app, ipAddress, username, onUsernameChange);
var options = {
lightNumber: 0, // Light Number or Group Number
useGroup: true, // To use group or not
on: false, // Turn the light on or off
color: 'red', // TinyColor2 color string
transitiontime: // A number to define transitiontime (optional)
alert: undefined// Alert string (optional)
effect: undefined // Effect string (optional)
};
// Change the lights
hue.changeLights(options, function(error, response){
if(error != null) return console.error('Error changing lights', error);
console.log('Response from changing lights', response);
});
// Check the sensors
hue.checkSensors(function(error, response){
if(error != null) return console.error('Error checking sensors', error);
console.log('Response from checking sensors', response);
});
// Check the states of the buttons on a hue button
var sensorName = 'SensorName'; // name of your sensor
hue.checkButtons(sensorName, function(error, response){
if(error != null) return console.error('Error checking buttons', error);
console.log('Response from checking buttons', response);
// To prevent duplicates compare the different between the last state and the current state.
// Button code will be conversion from the raw button code and will be a number between 1 and 4.
// Response
// {state: {...}, button: 1}
});
function onUsernameChange(newUsername){
username = newUsername;
// Store the username for future use
// otherwise you'll be required to press the hue bridge link button again
}
```