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

Problems toggling off #106

Closed isfett closed 7 years ago

isfett commented 7 years ago

Hey,

i have an issue with changing the lightstate to off. I can't do this on single bulb with setLightState and same with setGroupLightState on groups.

api.setLightState(1, lightstate.create().off());

settings colors (hue, xy, rgb), brightness etc just works fine. any tipps for me?

node 7.5.0 peter-murray/node-hue-api 2.4.1

peter-murray commented 7 years ago

Are you actually waiting for the promise to resolve, as the above snippet is not processing a result being returned, or capturing any errors.

I have just tested this under a Node.js 7.5.0 docker image and it works as expected, although I was using the following code:

hue.setLightState(1, lightstate.create().off())
  .then((result) => {
    console.log(JSON.stringify(result, null, 2))
  })
  .done();

It prints out true for me. When using Q based promises you need to ensure you have called done() so that the promise chain will not swallow any errors, if you have any.