• Stars
    star
    213
  • Rank 184,796 (Top 4 %)
  • Language
    JavaScript
  • Created over 11 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A command line interface to phillips hue

hue(1)

A command line interface to philips hue

NOTE: A more complete and updated implementation of a Hue Management CLI can be found here https://github.com/bahamas10/hueadm

Installation

First, install Node.js, then:

npm install -g hue-cli

...and the executable will be installed globally as hue

Usage

Usage: hue [-c config] [-H host] [--json] [command]

control philips hue over the command line

examples
  hue config                  # view the hue config
  hue lights                  # get a list of lights
  hue lights 5                # get information about light 5
  hue lights 5,6,7 on         # turn lights 5 6 and 7 on
  hue lights on               # turn all lights on
  hue lights 1 ff0000         # turn light 1 red
  hue lights 1 red            # same as above
  hue lights 1 +10            # increase the brightness by 10 (out of 254)
  hue lights 1 -10            # decrease the brightness by 10 (out of 254)
  hue lights 1 =100           # set the brightness to 100 (out of 254)
  hue lights 1 +10%           # increase the brightness by 10%
  hue lights 1 -10%           # decrease the brightness by 10%
  hue lights 1 =100%          # set the brightness to 100%
  hue lights 4,5 colorloop    # enable the colorloop effect on lights 4 and 5
  hue lights 4,5 alert        # blink lights 4 and 5 for 30 seconds
  hue lights 4,5 clear        # clear any effects on lights 4 and 5
  hue lights 1 state          # set the state on light 1 as passed in as JSON over stdin
  hue rename 1 light-name     # set light 1's name to the given string
  hue lights reset            # reset all lamps to default (on, as if the bulb was just flipped on)
  hue lights 1,2 reset        # reset just bulbs 1 and 2
  hue help                    # this message
  hue register                # register this app to hue
  hue search                  # search for hue base stations

commands
  config, lights, help, register, search

options
  -c, --config <file>    config file, defaults to ~/.hue.json
  -h, --help             print this message and exit
  -H, --host             the hostname or ip of the bridge to control
  -j, --json             force output to be in json
  -u, --updates          check for available updates
  -v, --version          print the version number and exit

Example

starting off

First, let's search for nearby base stations

$ hue search
1 stations found

1: 10.0.1.218

Pass in -j for json if you'd like

$ hue -j search
[
  "10.0.1.218"
]

Next, let's try to list the lights on that base station

$ hue -H 10.0.1.218 lights
error: application not registered, run `hue register` first

This app isn't registered yet, let's go ahead and do that

$ hue -H 10.0.1.218 register
please go and press the link button on your base station
Hue Base Station paired!

listing lights

All you had to do was press the button on your base station to register, cool right? Let's re-run the lights command

$ hue -H 10.0.1.218 lights
   1 Mike 1
   2 Mike 2
   3 Dave closet
   4 Hallway 2
   5 Hallway 1
   6 Front hallway
   7 Dave Ledge Left
   8 Dave Ledge Right
   9 Dave's Piano
  10 Dave's Lamp
  11 Balcony Mike
  12 Balcony Dave
  13 Balcony Living Room
  14 Mike 3
  15 Living room 3
  16 Living room 1

Again, -j if you'd like json output.

Running with the command lights will give us a list of all the lights connected to the base station.

From here, we can get information about a single light like:

$ hue lights 1
   1 on    141    Mike 1

141 in the above example is the brightness.

And -j for json

$ hue -j lights 1
{
  "state": {
    "on": true,
    "bri": 141,
    "hue": 13122,
    "sat": 211,
    "xy": [
      0.5119,
      0.4147
    ],
    "ct": 467,
    "alert": "none",
    "effect": "none",
    "colormode": "ct",
    "reachable": true
  },
  "type": "Extended color light",
  ...
}

controlling the lights

Let's actually mess with the lights now. Let's turn on the light in my closet.

$ hue lights 3 on
light 3 success

What about both lights in the hallway?

$ hue lights 4,5 on
light 4 success
light 5 success

What if we try to turn on a non-existent light?

$ hue lights 99 on
light 99 failed: resource, /lights/99/state, not available

Cool, errors handled properly. Let's see some more examples

$ hue lights off
light 1 success
light 2 success
light 3 success
...

This is shorthand for

$ hue lights all off

Where all is a recognized keyword for all lights in the system. You can also:

$ hue lights off

To quickly turn off all lights on the system

controlling colors

We can turn the lights on and off, that's great... what about colors?

How about hex

$ hue lights 4 ffffff
light 4 success

We just set the light in the hallway to pure white, hex ffffff. Let's go crazy and turn all of the lights in the house red (this is where we need the all keyword)

$ hue lights all ff0000
light 1 success
light 2 success
...

It's worth noting here that, because this tool is written in Node, all requests to the lights are done concurrently. This means we don't have to wait for light 1 to finish before we instruct light 2 to change, nor wait for light 2 to finish before we instruct light 3 to change, and so on.

Shorthand hex is also supported

$ hue lights 3,4 0f0
light 3 success
light 4 success

Now lights 3 and 4 are green

Last but not least, any CSS name is supported for colors

$ hue lights 1 yellow
light 1 success

Light 1 is now yellow. The full list of colors is available here http://xahlee.info/js/css_color_names.html

brightness

Brightness can also be changed using the =, + and - operators

$ hue lights 1 +20
light 1 brightness 200 -> 220
$ hue lights 1 -30
light 1 brightness 220 -> 190
$ hue lights 1 =150
light 1 brightness 150

effects

You can enable the colorloop effect on lamps by running

$ hue lights 4,5,6 colorloop
light 4 success
light 5 success
light 6 success

and clear all effects with

$ hue lights 4,5,6 clear
light 4 success
light 5 success
light 6 success

debugging

Last but not least, you can pass the state as JSON over stdin. The possible values are found at http://developers.meethue.com/1_lightsapi.html in section 1.6.

$ echo '{"bri": 240, "hue": 25500}' | hue lights 7 state

The state keyword tells hue to read from stdin

Config

A config file will be created at ~/.hue.json upon registration that looks like...

{
  "host": "1.2.3.4",
  "colors": {
    "myred": "fe0000",
    "myblue": "0000fe"
  }
}
  • host: the host to connect to (normally passed in as -H)
  • colors: a key-value pair of color aliases to their hex mapping, you can use these when changing the colors of a light

Credits

License

MIT

More Repositories

1

bash-style-guide

A style guide for writing safe, predictable, and portable bash scripts (not sh!)
685
star
2

zfs-prune-snapshots

Remove snapshots from one or more zpools that match given criteria
Shell
263
star
3

hueadm

A command line management interface to Philips hue
JavaScript
204
star
4

css-color-names

A JSON Object of css color names mapped to their hex value
JavaScript
141
star
5

node-clear

Clear the terminal screen if possible
JavaScript
112
star
6

bash-vsv

Manage and view runit services
Shell
92
star
7

ryb

A color picker that transposes from the primary colors, RYB, to RGB
JavaScript
72
star
8

you-suck-at-programming

You Suck at Programming - a video series
Shell
71
star
9

basher

Configuration Management in Bash
Shell
68
star
10

node-dtrace-examples

Examples of DTrace probes in Node.js
JavaScript
61
star
11

unifi-proxy

a hack to allow direct connections to unifi protect on a different layer 3 network
JavaScript
60
star
12

vsv

Manage and view runit services
Rust
58
star
13

dotfiles

My configuration files
Vim Script
56
star
14

node-sshp

simple, intuitive, no bs approach to parallel ssh
JavaScript
56
star
15

JSONSyntaxHighlight

Add syntax highlighting to JSON objects in Objective C for both Cocoa and iOS without using HTML
Objective-C
52
star
16

node-log-timestamp

Prepend timestamps to functions like console.log, console.warn, etc
JavaScript
52
star
17

node-netscape-bookmarks

Create a netscape format bookmarks file (works with Chrome)
JavaScript
38
star
18

preloadimages.js

Preload images and callback when they are all ready
JavaScript
37
star
19

windows-bash-ssh-agent

Scripts to persist ssh-agent on Bash on Ubuntu on Windows
Shell
32
star
20

node-manta-sync

Rsync style command for Joyent's Manta
JavaScript
31
star
21

wordsearch.js

Generate wordsearch puzzles
JavaScript
31
star
22

zfs-snapshot-all

Recursively snapshot all zpools
Shell
27
star
23

zincrsend

Incremental ZFS send/recv backup script
Shell
27
star
24

node-exec

Call a child process with the ease of exec and safety of spawn
JavaScript
27
star
25

zzz-user-hooks

Call scripts on suspend and resume for the currently logged in user using `zzz`
Shell
24
star
26

node-httpserver

command line HTTP server tool for serving up local files, similar to python -mSimpleHTTPServer
JavaScript
23
star
27

node-musicnamer

Organize your music collection
JavaScript
22
star
28

realtime-dtrace-visualization

A collection of scripts used for realtime DTrace visualizations and analysis
D
21
star
29

node-celery-man

Computer load up celery man
JavaScript
20
star
30

node-autocast

Easily and automatically cast common datatypes in JavaScript
JavaScript
19
star
31

node-log-buffer

Buffer calls to console.log, console.warn, etc. for high performance logging
JavaScript
18
star
32

node-smf

Expose smf(5) to Node.js for Solaris/Illumos based operating systems
JavaScript
17
star
33

sombra

sombra ARG for overwatch
JavaScript
16
star
34

music-directory

Serve your music over the web with a nice UI, or as JSON
JavaScript
15
star
35

node-ryb2rgb

Convert colors in JavaScript from ryb to rgb
JavaScript
15
star
36

Alt-Drag

Linux-style alt+drag for windows on Mac OS X
Objective-C
15
star
37

node-http-host-proxy

HTTP(s) proxy with host based routing to front servers, with optional SSL or authentication
JavaScript
15
star
38

node-dhcpd-dashboard

Create an HTTP dashboard for isc-dhcpd
HTML
14
star
39

node-git-http-server

serve a directory of git repositories over http
JavaScript
13
star
40

node-dhcpd-leases

parse isc-dhcpd dhcpd.leases(5) file format
JavaScript
12
star
41

binary-to-qrcode

Binary or Hex to QR Code site
HTML
12
star
42

node-bpm

Calculate BPM by tapping
JavaScript
12
star
43

iAmp-Mobile

Ampache Client for iOS devices
Objective-C
12
star
44

human

show seconds in a human-readable form
C
11
star
45

node-random-mac

Generate a random Mac Address
JavaScript
11
star
46

bash-2048

2048 written in bash
Shell
11
star
47

omnifetch

Print information about an OmniOS machine.
Rust
11
star
48

node-curl-cmd

Generate a curl command line argument list from an http request object
JavaScript
10
star
49

node-log-prefix

Prefix calls to console.log, console.warn, etc with whatever you'd like
JavaScript
10
star
50

node-latest

Quickly determine the latest available version of a package in npm
JavaScript
9
star
51

node-access-log

Add simple access logs to any http or https server
JavaScript
9
star
52

svlogger

A generic svlogd wrapper for runit services
Shell
9
star
53

sshp

Parallel SSH Executor
C
9
star
54

sos

SmartOS Zone Summary
JavaScript
8
star
55

bics

A modular framework for bash plugin management
Shell
8
star
56

node-dvorak

Convert between the Qwerty and Dvorak keyboard layout
JavaScript
8
star
57

visusage

Visual usage statistics for Illumos-based operating systems using prstat, iostat, etc.
Shell
8
star
58

node-xbox-hid-controller

Original Xbox Controller API using node-hid HID device
JavaScript
8
star
59

node-webamp

Ampache web interface to make browsing, and playing your music a simple task
JavaScript
8
star
60

node-rgb2ryb

Convert colors in JavaScript from rgb to ryb and back
JavaScript
8
star
61

oisd-install

Pull, validate, and install a host list from https://oisd.nl.
Shell
8
star
62

plex-install-manager

Manage plex media server installations (for Linux)
Shell
7
star
63

node-iprange

Generate an array of all ips in a given subnet
JavaScript
7
star
64

tvstatic

Generate TV static in an HTML5 canvas element
JavaScript
7
star
65

someonewhocares

Pull and install the latest host file from someonewhocares.org
Shell
7
star
66

node-perms

Convert Unix style permissions to strings like ls (0755 => 'rwxr-xr-x')
JavaScript
7
star
67

node-ssh-fingerprint

Generate a fingerprint given an SSH public key (without `ssh-keygen` or external dependencies)
JavaScript
7
star
68

node-etc-passwd

Interface to read a standard Unix passwd and group file-format
JavaScript
7
star
69

Viridian

Viridian is an Ampache Client that displays all of your media from your Ampache server in a simple and convenient way that makes choosing and streaming music an easy task.
Python
7
star
70

app-focus

Print notifications to the console when different apps take focus on OS X
Objective-C
6
star
71

remote-notify

WeeChat plugin for remote osd-notify or growl notificiations.
Python
6
star
72

illumos-sockstat

List open sockets on Illumos with process information
C
6
star
73

node-url-shortener

Spawn up a simple webserver to act as a URL shortener
JavaScript
6
star
74

2048.c

2048 written in C
C
6
star
75

music-generator

Programmatically Generate Music with JavaScript
JavaScript
5
star
76

mac-chromium

Install and upgrade chromium on OS X
Shell
5
star
77

bash-path

Functions to modify colon separated variables like `$PATH` or `$MANPATH`
Shell
5
star
78

node-hue-sdk

Phillips Hue API library
JavaScript
5
star
79

node-dnsgen

Generate DNS files using json
JavaScript
5
star
80

node-fs-caching-server

A caching HTTP server/proxy that stores data on the local filesystem
JavaScript
5
star
81

basher-repo

A template repo for use with basher. Use this as a skeleton or even fork this repository to host your own plugins and scripts.
JavaScript
5
star
82

bash-analysis

Various tools for text extraction, representation, and analysis
Shell
5
star
83

node-ampache

Communicate to an Ampache server using the API
JavaScript
4
star
84

prepositions

A JSON array of one-word, english prepositions
Shell
4
star
85

bash-pitfalls-presentation

for the tech summit
Shell
4
star
86

node-stats-page

Create a /stats page http-server for a server application
JavaScript
4
star
87

dtrace-intro-slides

Slides used for an Introduction to DTrace presentation at Voxer
JavaScript
4
star
88

node-autolinks

Automatically turn URL's into links
JavaScript
4
star
89

plex-upgrade

script to install or upgrade plex on Ubuntu 64bit
Shell
4
star
90

node-gmailx

Send email easily on the command line without running a server
JavaScript
4
star
91

cryptogram

cryptogram puzzle solver helper script
JavaScript
3
star
92

smfwatchdog

A health checking daemon to be used with SMF services
C
3
star
93

node-tilde-expansion

Expand a ~ character to a users home directory like bash
JavaScript
3
star
94

pizza-party

A collection of restaurants that satisfy our weird eating habits
3
star
95

wiiu-media-server

An HTTP media server made specifically for the Wii U browser
CSS
3
star
96

unix-tools

a rewrite of common Unix tools in C
C
3
star
97

XBMCXboxHIDController

Control XBMC using an original Xbox controller on OS X
C
3
star
98

node-git-dump

Dump the contents of a remote git repository without directory listing enabled
JavaScript
3
star
99

node-pins

Create Pinterest style pins for your own files over HTTP
JavaScript
3
star
100

di.fm

Command line tool to listen to D I G I T A L L Y I M P O R T E D
3
star