shokai / node-philips-hue

Node.js library for Philips Hue bridge API
http://npmjs.org/package/philips-hue
17 stars 7 forks source link

Command line #5

Closed hamen closed 9 years ago

hamen commented 9 years ago

Hi Is there a way to setup the config via command line? A config file example? Or a way to pass IP and authentication data via CLI? Thank you

shokai commented 9 years ago

Just send command to control Hue lights, it automatically generate config file (~/.philis-hue.json) if it is not exists.

for example

philips-hue on
# or 
philips-hue --light 1 --bri 120 --hue 30000 --sat 180
hamen commented 9 years ago

Hi Thank you for the quick answer. Unfortunately, it's not working:

[hamen:~] $ philips-hue --light 1 --bri 120 --hue 30000 --sat 180
invalid bridge address "undefined"
[hamen:~] $ ls ~/.philips-hue.json
ls: /Users/hamen/.philips-hue.json: No such file or directory
[hamen:~] 1 $

I'm on OSX Yosemite, if this can help.

shokai commented 9 years ago

This library using nupnp API. It returns bridge's address in the same LAN, so please check your Wi-Fi AP name and LAN cable.

hamen commented 9 years ago

I'm already using it with the official Android app and this Perl script: http://www.floodgap.com/software/huepl/ I was curious about using it with nodejs. May I have a copy-paste of an example config file please?

shokai commented 9 years ago
{"bridge":"192.168.0.102","username":"df350363a10fb3e75f5a889baefd96ac","devicetype":"node-philips-hue"}
hamen commented 9 years ago

Nice! :+1: It's working. Using auth.js in the samples folder, I was able to get the IP and the username. I manually created the ~/.philips-hue.json and now I can command the lights. Thank you! :)

shokai commented 9 years ago

:beer: