bahamas10 / hue-cli Goto Github PK
View Code? Open in Web Editor NEWA command line interface to phillips hue
Home Page: http://bahamas10.github.com/hue-cli/
A command line interface to phillips hue
Home Page: http://bahamas10.github.com/hue-cli/
Having +10, =100 leads me to think that its a 0-100% number when it is in reality 0-255. I think clarifying this in the help command would be helpful.
I see there is a command to set the state of a bulb, but how do I get the state of a bulb?
I need to fork the project and add some debugging output to figure out what's going on, but most of the hex colors I have tried will either turn my lights very red or very white, I can't get any value in between. Could be something in the hex2rgb()
function but I need to see the RGB output to figure that out.
Thought I'd toss this in in case someone else has a similar experience. My Hue lights are a bit older so I don't know if things have changed. I have spent a lot of time playing with the API and implementing my own interfaces, so I should be able to figure this out and (hopefully) post a pull request.
Most notably when running hue lights all reset
, all 3rd generation (not sure about 2nd generation) lights get a noticeable green color cast.
white
works fine but some other predefined colors are slightly off too.
hue register
please go and press the link button on your base station
failed to pair to Hue Base Station 192.168.0.12
/usr/local/lib/node_modules/hue-cli/hue-cli.js:251
throw err;
^
Error
at Object.<anonymous> (/usr/local/lib/node_modules/hue-cli/node_modules/hue.js/lib/helpers.js:7:22)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:456:32)
at tryModuleLoad (module.js:415:12)
at Function.Module._load (module.js:407:3)
at Module.require (module.js:466:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/local/lib/node_modules/hue-cli/node_modules/hue.js/lib/Hue.js:5:20)
at Module._compile (module.js:541:32)
Just installed this globally via npm, everything ok except for the following warning:
npm WARN package.json [email protected] No reposityory field.
Whenever I attempt to run any hue command, I get the following error:
path.js:204
throw new TypeError('Arguments to path.join must be strings');
TypeError: Arguments to path.join must be strings
at f (path.js:204:15)
at Object.filter (native)
at Object.exports.join (path.js:209:40)
...
Running Node.js 0.10.24 on Windows 7 64-bit.
Hey,
When you run a command like "hue -j lights 1,2" the output looks like this:
{
"name": "Light One"
...
}
{
"name": "Light Two"
...
}
While this is two valid JSON objects, the whole result isn't a valid JSON object. This makes it difficult to parse the output with many JSON libraries, including python's json.loads
.
Two options that might make it easier to handle:
Something like:
[{
"name": "Light One"
...
},
{
"name": "Light Two"
...
}]
Something like:
{"name": "Light One", "state": ... }
{"name": "Light Two", "state": ... }
While it's still technically invalid, it's at least easy to split the file on newlines.
Hi, we are using the Hue-cli library, today while working we found the following issue which was not there earlier.
Hue Base Station paired!
username: kEEmOnMDlliWwsi6JSPsO6SLwyfvlWCFaqHsBbVP
config file written to `undefined`
fs.js:638
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
TypeError: path must be a string or Buffer
at Object.fs.openSync (fs.js:638:18)
at Object.fs.writeFileSync (fs.js:1287:33)
at Request.<anonymous> (/usr/local/lib/node_modules/hue-cli/hue-cli.js:285:10)
at Request._callback (/usr/local/lib/node_modules/hue-cli/node_modules/hue.js/lib/Hue.js:188:10)
at Request.self.callback (/usr/local/lib/node_modules/hue-cli/node_modules/request/main.js:122:22)
at emitTwo (events.js:125:13)
at Request.emit (events.js:213:7)
at Request.<anonymous> (/usr/local/lib/node_modules/hue-cli/node_modules/request/main.js:661:16)
at emitOne (events.js:120:20)
at Request.emit (events.js:210:7)
![screenshot 62](https://user-images.githubusercontent.com/25072282/30269652-3248a59e-9707-11e7-85fc-637565bf54de.png)
Please Help to resolve this issue
Why do you use a tarball of hue.js
https://github.com/bahamas10/hue.js/tarball/dave-1432672068
? hue.js
is avaialble with npm
ie. https://www.npmjs.com/package/hue.js
.
The "state" command (e.g. hue lights 1 state) is not working.
When I run the command "cat state.txt | hue lights 1 state", I get the error "light 1 failed: parameter, state, not available". Running the command with -j gives the error:
{
"description": "parameter, state, not available",
"type": 6
}
Am I doing something wrong? I obtain the state.txt json file from the command "hue -j lights 1 > state.txt".
*Edit: I should have read the documentation clearly. It turns out I'm not suppose to just use the entire output from hue -j lights 1. I had to edit it before it worked.
hi,
is it possible to create an individual colorloop? for example, ffffff 2 seconds, blue 4 seconds, purple 6 seconds (transition time 0,3 seconds) and run it?
i was considering just writing a bash script that does this, but seems like it always takes a second for commands to be accepted by my hue bridge (or lamp), so this is not an option...
thanks in advance :)
Recently I was running into this bizarre error whenever I ran anything to do with hue lights
(e.g. hue lights on
, hue lights off
, etc.) on node v9.3.0, npm 5.6.0, & hue-cli 0.3.1.
I was about to ask for help here, but then I realized that the IP of my hue bridge changed, which may or may not have been the root of the problem. After re-registering hue-cli with the new configuration everything started working again. However, this original error message was pretty unhelpful in indicating that this might have been the problem. It could have been that the old IP was given to a different device on the local network and hue-cli was getting bogus data from it.
I'd suggest that this part of the code be adjusted so that, if the configuration stops working for some reason, it gives a more helpful error message stating something has changed with the connection, instead of leaving the user to scratch their head in confusion.
C:\Users\Ben\AppData\Roaming\npm\node_modules\hue-cli\hue-cli.js:141
var keys = Object.keys(lights);
^
TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at C:\Users\Ben\AppData\Roaming\npm\node_modules\hue-cli\hue-cli.js:141:25
at Request.<anonymous> (C:\Users\Ben\AppData\Roaming\npm\node_modules\hue-cli\hue-cli.js:342:5)
at Request._callback (C:\Users\Ben\AppData\Roaming\npm\node_modules\hue-cli\node_modules\hue.js\lib\Hue.js:36:43)
at Request.self.callback (C:\Users\Ben\AppData\Roaming\npm\node_modules\hue-cli\node_modules\request\main.js:122:22) at Request.emit (events.js:159:13)
at Request.<anonymous> (C:\Users\Ben\AppData\Roaming\npm\node_modules\hue-cli\node_modules\request\main.js:661:16)
at Request.emit (events.js:164:20)
at IncomingMessage.<anonymous> (C:\Users\Ben\AppData\Roaming\npm\node_modules\hue-cli\node_modules\request\main.js:623:14)
at IncomingMessage.emit (events.js:164:20)
When i try to run a bash script turning my light on and off via apache i get this error:
path.js:7 throw new TypeError('Path must be a string. Received ' + inspect(path)); ^ TypeError: Path must be a string. Received undefined at assertPath (path.js:7:11) at Object.join (path.js:1211:7) at Object. (/usr/lib/node_modules/hue-cli/hue-cli.js:23:23) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:394:7)
it works as expected in when i call it via ssh
here is the script:
#!/bin/bash lights=$(hue lights 1,2,4) if [[ $lights = *off* ]]; then hue lights 1,2,4 on fi if [[ $lights = *on* ]]; then hue lights 1,2,3,4 off fi
would be great if i could execute the script via the webserver,
Setting the existing state on a light results in an error. Although it still appears to get set correctly.
$ hue -j lights 4 | jq '.state' | hue lights 4 state
light 4 failed: parameter, colormode, not available
State that's being set:
{
"on": true,
"bri": 1,
"hue": 54600,
"sat": 254,
"effect": "none",
"xy": [
0.3721,
0.1536
],
"ct": 236,
"alert": "none",
"colormode": "xy",
"mode": "homeautomation",
"reachable": true
}
When using node 0.12.x (tested with 0.12.1 and 0.12.3) the following exception is thrown:
dgram.js:367
throw errnoException(err, 'getsockname');
^
Error: getsockname EINVAL
at exports._errnoException (util.js:746:11)
at Socket.address (dgram.js:367:11)
at next (/home/sven/.nvm/v0.10.36/lib/node_modules/hue-cli/node_modules/hue.js/lib/Discoverer.js:27:25)
at Object.module.exports [as discover] (/home/sven/.nvm/v0.10.36/lib/node_modules/hue-cli/node_modules/hue.js/lib/Discoverer.js:21:5)
at Object.<anonymous> (/home/sven/.nvm/v0.10.36/lib/node_modules/hue-cli/hue-cli.js:257:9)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
It works correctly with node 0.10.36.
Getting the same output for different commands.
~ % hue lights
Philips Hue CLI.
Usage: hue |||| [options...]
~ % hue search
Philips Hue CLI.
Usage: hue |||| [options...]
It would be nice to be able to specify the config file as a command line switch for, e.g., running this program in batch mode where $HOME
may not point to the right place. In my case, I have some stuff running as another user that wants to run scripts using this client directly, but may not have $HOME
configured in the non-interactive shell, or $HOME
may point elsewhere than my user's home directory.
I am happy to submit a pull request for this functionality if it gets a couple +1s, but wanted to toss it in as an issue in case there are imminent plans to do this or strong reasons not to.
I envision something like -c
/ --config
, which simply accepts a path to the file. We would have to reverse the order of argument parsing and config file loading in the script but that should be a trivial change.
Is there any plans to support group and scenes? A CLI is a great idea, but for me controlling individual light is almost useless. It seems it's supported by the API I think?
when using 'clear': l.forEach(function(id) { client.state(id, {effect: 'none'}
the alert mode are not cleared.
please implement clearalert or just clear that clears the alert mode
when using 'clear': l.forEach(function(id) { client.state(id, {alert: 'none'}
When I try to install this per the readme with npm install hue-cli
, it fails after fetching the dependencies with the following output:
npm WARN enoent ENOENT: no such file or directory, open '/home/myuser/package.json'
npm WARN ghoti No description
npm WARN ghoti No repository field.
npm WARN ghoti No README data
npm WARN ghoti No license field.
the appname should be unique per install, and stored in the config json
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.