peter-murray / node-hue-api

Node.js Library for interacting with the Philips Hue Bridge and Lights
Apache License 2.0
1.19k stars 145 forks source link

Parameter "ct" not available #93

Closed tejashah88 closed 8 years ago

tejashah88 commented 8 years ago

I was just testing this library and I encountered this API error:

{ Api Error: parameter, ct, not available
    at checkForError (/root/projects/node_apps/artik_challenge_2016/node_modules/node-hue-api/hue-api/httpPromise.js:90:11)
    at /root/projects/node_apps/artik_challenge_2016/node_modules/node-hue-api/hue-api/httpPromise.js:138:18
    at _fulfilled (/root/projects/node_apps/artik_challenge_2016/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (/root/projects/node_apps/artik_challenge_2016/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (/root/projects/node_apps/artik_challenge_2016/node_modules/q/q.js:796:13)
    at /root/projects/node_apps/artik_challenge_2016/node_modules/q/q.js:604:44
    at runSingle (/root/projects/node_apps/artik_challenge_2016/node_modules/q/q.js:137:13)
    at flush (/root/projects/node_apps/artik_challenge_2016/node_modules/q/q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
  message: 'parameter, ct, not available',
  type: 6,
  address: '/lights/5/state/ct' }

Looking at the error log, it seems as though the "combinedTickCallback" is not available. I'm guessing that Samsung dropped support for this parameter.

Here's the code I used to reproduce the error. Itested it with a Hue Iris as of today.

var hue = require("node-hue-api"),
    HueApi = hue.HueApi,
    lightState = hue.lightState;

var onResult = function(result) {
    console.log(JSON.stringify(result, null, 4));
};

var onError = function(err) {
    console.log(err);
}

var hostname = "192.168.1.148",
    username = "7AUPhCnc5SLS9AThF-qdFO2J1sAWrLP0DeaJwCjH",
    api;

api = new HueApi(hostname, username);
// Set light state to 'on' with warm white value of 500 and brightness set to 1$
state = lightState.create().on().white(50, 50);

// --------------------------
// Using a promise
api.setLightState(5, state)
    .then(onResult)
    .fail(onError)
    .done();

Note that the light states were still changeable so this isn't a breaking error, but just something to look into.

tejashah88 commented 8 years ago

My bad, the error does not refer to "combinedTickCallback", but something else I'm not aware of.

Nibbler999 commented 8 years ago

ct is color temperature. Perhaps your light does not support setting a color temperature.

peter-murray commented 8 years ago

That is the bridge reporting back that your light does not support the ct option for setting colors, as @Nibbler999 indicated. That message you are seeing in the error is coming back from the bridge itself.

The API allows you to send any of the allowed (as defined in the API) settings, but your lights may not be able to take the property, i.e. sending any color options to a white light would generate a similar error.