parameter, username, not available
Closed this issue · 4 comments
Just installed 1.1.11 from npm and I'm running into the following error with the following sample program and using philips-hue-cmd:
var Hue = require('philips-hue');
var hue = new Hue();
var configFile = 'philips-hue.json';
hue
.login(configFile)
.then(function(conf){
return hue.light(1).on();
})
.then(function(res){
console.log(res);
})
.catch(function(err){
console.error(err.stack || err);
});
Error:
[ '10.????????' ]
bridge: 10.????????
philips-hue auth bridge: 10.0.???????? +495ms
follow-redirects options +3ms { maxRedirects: 5,
protocol: 'http:',
hostname: '10.????????',
port: null,
path: '/api',
method: 'post',
headers:
{ Accept: 'application/json, text/plain, */*',
'Content-Type': 'application/x-www-form-urlencoded',
'User-Agent': 'axios/0.9.1',
'Content-Length': 79 },
agent: undefined,
auth: undefined,
userCallback: [Function: handleResponse] }
philips-hue [ { error: { type: 6, address: '/username', description: 'parameter, username, not available' } } ] +13ms
Error: {"type":6,"address":"/username","description":"parameter, username, not available"}
at checkResponse (/home/jsc/hue/node_modules/philips-hue/lib/util.js:17:28)
at /home/jsc/hue/node_modules/philips-hue/lib/philips-hue.js:114:33
at process._tickCallback (internal/process/next_tick.js:103:7)
I did verify that the username parameter to the auth call (line 110 of philips-hue.js) isn't null.
data: JSON.stringify({
devicetype: this.devicetype,
username: username
})
What's the (censored) content of your configfile?
I don't have a config file. I thought the login call would create that on first use? Am I misunderstanding how that works?
@jclement I'm quite sure you need to put your hue address & token manually into that file, or provide them by initially setting them the first time you start up the program. I haven't used that configfile part myself, but it surely can't just guess your address/token.
I ran into the same issue. It's caused by a change in the Hue API: http://www.developers.meethue.com/documentation/important-whitelist-changes
I proposed a fix with PR #13