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

Short flash when light is turned on #47

Closed HarlekinX closed 9 years ago

HarlekinX commented 9 years ago

I noticed the following:

It seems that it first turns on, so the light wants to return to its previous bright white state. After that it gets its new color state.

Using the Hue Tab, when i do the same (one button is bright white, the second is dark red and the main is off), the flash doesn't happen. It turns from off to dark red directly,

Does anybody know why this happens with the node-hue-api but not with the Hue Tab? Are I am doing something wrong?

peter-murray commented 9 years ago

The API is sending all the values at once, I don't separate them in any way to the bridge.

I will put together a test tomorrow to see if I can reproduce it. When you say Hue Tab, is the the Phillips hue app, or some other application?

Are you using the state object in the API, or just passing an object with values, as you posted above?

HarlekinX commented 9 years ago

I'm passing the object like this:

  1. White hue_api.setLightState(6, {"on":true,"bri":254,"colormode":"hs","hue":10923,"sat":0}) .fail(displayError) .done();
  2. Off hue_api.setLightState(6, hue_state.off()) .fail(displayError) .done();
  3. Dark Red hue_api.setLightState(6, {"on":true,"bri":128,"colormode":"hs","hue":65535,"sat":254}) .fail(displayError) .done();

And the Hue Tap is the physical switch by Philips. The buttons get linked to scenes.

peter-murray commented 9 years ago

Ok, the Hue tap uses scenes for when it responds to button presses, this is a completely different mechanism to the setting of a light state.

The light states for a light requires that the light is actually turned on before most of them can be properly set (especially those that deal with colours), which is why it flashes when it has to transition from a different colour and the light is currently off.

There is nothing that the library is doing here, it is all behaviour of the bridge and its firmware.

I would recommend that you save a scene (there can be around 200 saved) and recall it if you do not want to experience these flashes, You can even recall the actual scenes that the Hue Tap uses.

The downside of scenes is that the most of the applications require that you create them directly in the application, as those created in the library will not show up in the iOS applications.

HarlekinX commented 9 years ago

Yes, you are right. I set the scenes and activating them works without flashing :-) It seems to me that Philips should update their API to avoid this.

By the way, node-hue-api is really a great work and the documentation couldn't be better.