Changing light color while off

Continuing the discussion from Lightsd: a daemon with a JSON-RPC API to control your bulbs:

If you sent a Light::SetColor message while the bulbs is off the bulb stays off and the color stored inside the bulb so that when you send a Light::SetPower the bulb will turn on to that color. Is that what you meant? You might need to expand on the problem a bit more…

Yes, that’s exactly what I mean!

So the fix would be to send the Light::SetPower after you send the Light::SetColor, then you can be sure the bulb is powered on and set to the color you wanted.

Yes, but that’s exactly the issue I pointed out, I want to set the color before the bulb is turned on. Here is the issue with the situation right now.

  • bulb is set at full brightness;
  • bulb is powered off (as in Light::SetPower);
  • now I want to power the bulb but only at 10% brightness.

Since you need to power on the bulb before you set the color you’ll get a very undesirable and blinding flicker as the bulb comes up and change its brightness from 100% to 10%.

Are you waiting for the acknowledgment to make sure the packet has arrived before sending the power packet? UDP deliveries can happen out of order.

Also you should set the duration field in the SetColor message to 0 so that the change happens instantly and not over time. Then when the power message arrives the change to the new color is complete.

Ugh, indeed, reception is really spotty. Looks like it’s possible to set the bulbs color while it’s off, I’ll have to confirm when I’m home.

I need to implement the retry logic for everything, I’m currently not using the acknowledgment feature, I’m still pondering whether I should do that or not since I can set a pretty high sample rate for the bulbs, it might end up using both strategies.

Thanks!

Oh, I get it now, I think it’s a bug on the fw 1.1 for the Original, turns out I always tried to do that there :\.

I should update my bulbs.

Thanks!