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

minoss-hue

v0.1.8

Published

Philips Hue Module for Minoss

Downloads

11

Readme

Philips Hue for Minoss

GitHub version NPM version Dependency version

This module adds support for controlling Philips Hue devices to Minoss server. The API communication is based on node-hue-api.

Table Of Contents


Installation

Inside your Minoss root folder just use npm to install this Module.

$ npm install minoss-hue

Configuration

By default there are three configuration files available inside the config/ folder: bridges, lights and groups. The configurations for lights and groups are optionally. You can store different light states there, if wanted. For more details take a look inside the files or read about the state builder.

Before using this module the bridges configuration should be set up. This file contains the IP address and username for all bridges inside the network, which should be controlled.

It is possible to store the bridges under own names. The name default is a reserved name. Minoss will select this bridge whenever no bridge name was given by request parameters. So, if only one bridge is available, the name default should be used.

module.exports = {
    default: {
        ip: "192.168.1.11",
        username: "your-hue-bridge-username"
    },
    garden: {
        ip: "192.168.1.20",
        username: "your-garden-bridge-username"
    },
    another: {
        // ...
    }
};

If you don't know how to register a username for your bridge, read about it in the official documentation.

Bridge selection

It is possible to use more than one bridge in this module. The bridge request parameter controls which bridge will be selected for the current action. Inside the configuration it is possible to add those.

When no bridge parameter was added on request, the default bridge will be used. So, if working with a single bridge only, or when it's wanted to use the default bridge, the bridge parameter redundant.

Default bridge:

http://localhost:8080/hue/bridges?action=config
http://localhost:8080/hue/bridges?action=config&bridge=default

Selecting another bridge:

http://localhost:8080/hue/bridges?action=config&bridge=garden

Parameter Shorthand

All request parameters can be shorten to it's first character. With this it is possible to use shorten URLs.

bridge  ->  b
id      ->  i
group   ->  g 
state   ->  s

Example:

http://localhost:8080/hue/lights?action=set&id=1&state=on
http://localhost:8080/hue/lights?a=set&i=1&s=on

State Builder

Hue lights and groups uses so called states to define it's current output. Things like brightness or saturation and others can be controlled by this. The module can build these states by request.

States for lights and groups could be predefined in configuration. By default the states on, off, low, mid and high are predefined and available. They can be set by it's name on request:

http://localhost:8080/hue/lights?action=set&id=1&state=on

Using JSON as State

It is possible to use a JSON string as state on request. It works the same way as with predefined states:

http://localhost:8080/hue/lights?action=set&id=1&state={"on":true,"bri":255}

Chaining States

The state builder can even handle a chain of states. These states has to be separated by a pipe | on request. It will combine all state in the given order. When a state property is set by more than one entry, the last one will be set.

For example, these are predefined states:

var states = {
    on: {
        on: true
    },
    normal: {
        bri: 1,
        sat: 255
    },
    high: {
        bri: 255
    }
}

And this request:

http://localhost:8080/hue/lights?action=set&id=1&state=on|normal|high

The resulting state would become:

{
  "on": true,
  "bri": 255,
  "sat": 255
}

It is even possible to chain a JSON string too.

http://localhost:8080/hue/lights?action=set&id=1&state=on|normal|{"bri":255}

Scripts

The following tables describe the available scripts and parameters of the module

Bridges

http://localhost:8080/hue/bridges?action={ACTION}

| action | parameters | description | :------------------------ | :-------------------------------------------------------- |------------- | config | (str) bridge | b [optional] | receive the full configuration of a bridge | description | (str) bridge | b [optional] | receive the description of a bridge | search (default) | - | search for bridges inside your network | state | (str) bridge | b [optional] | receive the full current state of a bridge | user | (str) bridge | b [optional] | receive all registered users of a bridge | version | (str) bridge | b [optional] | receive software version information of a bridge

Lights

http://localhost:8080/hue**/lights**?action={ACTION}

| action | parameters | description | :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------- |------------- | get (default) | (str) bridge | b [optional] (int) id | i [optional] | receive information of all lights, or of a specific light when id is set | set | (str) bridge | b [optional] (int) id | i (str) state | s  | set a state, or a chain of states, to a specified light

Groups

http://localhost:8080/hue/groups?action={ACTION}

| action | parameters | description | :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------- |------------- | get (default) | (str) bridge | b [optional] (int) id | i [optional] | receive information of all groups, or of a specific group when id is set | set | (str) bridge | b [optional] (int) id | i (str) state | s  | set a state, or a chain of states, to a specified group

Scenes

http://localhost:8080/hue/scenes?action={ACTION}

| action | parameters | description | :--------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------- |------------- | get (default) | (str) bridge | b [optional] (int) id | i [optional] | receive information of all scenes, or of a specific scene when id is set | set | (str) bridge | b [optional] (int) id | i (str) group | g  | set a scene to a specified group

Schedules

http://localhost:8080/hue/schedules?action={ACTION}

| action | parameters | description | :--------------------- | :-------------------------------------------------------------------------------------------------------------------|------------- | get (default) | (str) bridge | b [optional] (int) id | i [optional] | receive information of all schedules, or of a specific schedule when id is set

Bugs / Feature request

Please report bugs and feel free to ask for new features directly on GitHub.

License

Minoss is dual-licensed under MIT and GPL-2.0 license.

Donation

You like to support me?
You appreciate my work?
You use it in commercial projects?

Feel free to make a little donation! :wink: