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

API error crash #33

Closed aml25 closed 9 years ago

aml25 commented 9 years ago

Hello,

Every now and then I get this error: Api Error: parameter, xy, is not modifiable. Device is set to off.

I'm not sure what is causing it, as it seems to be random. One thought is I'm calling the API too quickly, but if I do the calls quickly on purpose it doesn't always crash.

aml25 commented 9 years ago

/my/path/to/my/repo/NODE/node_modules/node-hue-api/node_modules/q/q.js:126 throw e; ^

aml25 commented 9 years ago

The cause has been found... If I call .off() on a light that is already off then it crashes.

I'm checking the status of config.lights['(ID)'].state.on first before allowing the .off() to go through, but I'm thinking this should be handled by the node package.

Thanks for the package though! It is super helpful, and really well documented!

peter-murray commented 9 years ago

Yes, it is a feature of the bridge that you cannot set some colour values if the light is in an off state. It kind of makes sense, but was something they added recently in the firmware updates.