npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

philips-hue-api

v0.1.6

Published

An API wrapper for Philips Hue lights.

Downloads

34

Readme

Build Status Coverage Status

NOTE: This package will currently only work if you're on the same network as your Hue base station.

Install

npm install philips-hue-api --save

Usage

When you're on the same network as your Hue (good for testing)

var Hue = require('philips-hue-api'),
    hue = Hue('http://192.168.x.x/api/your_username');

hue.lights(1).on(); // Turns on light number 1.

When you're not on the same network (good for real-world applications)

var Hue = require('philips-hue-api'),
    hue = Hue('username', '[email protected]', 'my-amazing-password');

hue.authenticate().then(function(lights) {
    lights(1).off();
});

API

Lights

list() - Asynchronous function that returns the available lights (as JSON) for the current bridge.

Hue('http://192.168.x.x/api/username/').lights().list(function(error, lights) {
    console.log(lights);
});

off() - Turns off the specified light.

on() - Turns on the specified light.

breathe() - Causes the specified light to perform a breath cycle (transition to a higher brightness, then lower brightness, then back).

hue(int) - Sets the hue (color) of the specified lights (between 0 and 65535). Both 0 and 65535 are red, 25500 is green and 46920 is blue.

color(string) - Helper function for setting the hue of the specified light. Can be: red, orange, yellow, green, white, blue, purple, magenta, or pink.

saturation(int) - Sets the saturation of the specified light. 254 is the most saturated (colored) and 0 is the least saturated (white).

brightness(int) - Sets the brightness of the specified light (between 1 and 254). 1 is the darkest and 254 is the brightest.

colorTemperature(int) - Sets the color temperature of the specified light (between 153 and 500). 153 is 6500K, 500 is 2000K.

state(object)

More Examples

Listing Lights

var Hue = require('philips-hue-api'),
    hue = Hue("[your-username]", "[your-email]", "[your-password]");

hue.authenticate().then(function(lights) {
    lights().list();
});

Turning a light on by its name

var Hue = require('philips-hue-api'),
    hue = Hue("[your-username]", "[your-email]", "[your-password]");

hue.authenticate().then(function(lights) {
    lights('Bedroom').on();
});

Making your light turn blue

var Hue = require('philips-hue-api'),
    hue = Hue("[your-username]", "[your-email]", "[your-password]");

hue.authenticate().then(function(lights) {
    lights('Bedroom').color('blue');
});