2.2.2 • Published 8 years ago
hue-util v2.2.2
Philips
Node module for controlling Philips Hue lights
Installation
npm install hue-util
Example
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
}
2.2.2
8 years ago
2.2.1
9 years ago
2.2.0
9 years ago
2.1.0
9 years ago
2.0.3
9 years ago
2.0.2
9 years ago
1.5.0
9 years ago
1.4.0
9 years ago
1.3.0
9 years ago
1.2.1
9 years ago
1.2.0
9 years ago
1.1.5
9 years ago
1.1.4
10 years ago
1.1.2
10 years ago
1.1.1
10 years ago
1.1.0
10 years ago
1.0.5
10 years ago
1.0.3
10 years ago
1.0.2
10 years ago
1.0.1
10 years ago
1.0.0
10 years ago