I have several philips hue bulbs that I would like to use in different automations and with the adaptive lighting plug in.
However, I cannot get the lights to turn on properly. Despite my best efforts, all I can do is to get the bulbs to turn on at their previous setting and then change to whatever home assistant sets it to. This change happens quickly (under a second) but it is perceptible and creates an ugly transition.
It is especially noticeable if the light was on bright during the day, and then later on in the evening I want it to turn on dimmed. This happens all the time with the adaptive lighting plug in - the lighta turn on bright and then instantly change.
This call triggers the lights to come on and then instantly change to the dark state:
This now avoids the flash and goes straight to the nightlight I want.
But, this work around does not work well for adaptive lighting as the values to turn on initially are time and date dependent, and could be anything in a range.
How do I get the light to turn on at the right setting first, and avoid the flash when it turns on and then changes straight away?
That’s how the light.turn_on service call works. It’s instructing the bulb to turn on with a desired color but the bulb is designed to turn on using its previous properties. So if its previous state was the color red, that’s the color you’ll see moments before the bulb is set to your desired color.
The reason why a native Hue scene works (without the momentary color-change) is because you’re instructing it to use a specific set of properties that are already known to the bulb.
LIFX bulbs are one of the few that allow you to set a bulb’s properties (like color) when the bulb is off (lifx.set_state). So when the bulb is turned on, it will instantly use the ‘preset’ color (and whatever other properties were set while it was off) without a noticeable color-change. There’s no equivalent service call for Hue (or most other lighting brands).
So the answer to your question is: You can’t.
The workaround is what you have already discovered: native Hue scene. For adaptive lighting purposes, create as many scenes as needed and then call them as required. Use a naming scheme that makes it easy to reference the scene with a template.
I had some interesting problems with my Hue bulbs starting out, too. I don’t know that my suggestion will really be an elegant way to make it work with the adaptive lighting programming, but calling the scene.apply service could also be a good starting point. You can use it to control lighting values even from off without having to set up a scene either in Home Assistant or the Hue app. I discovered it because I was having transition issues with scenes I set up in Home Assistant, and it was the only way I could fade my lights like I did with the Time-based Light function in the Hue app.
Since I don’t use the adaptive lighting setup because I’m weird and rather nocturnal, I’m going to use some educated guesses to make some suggestions on how you could make it work for you. The following code will work to turn on the light at a very dark setting at 2000 Kelvin on my Color Ambience bulbs if that’s what you want to use.
If you always want your lights to change to the current adaptive lighting settings, it seems that you can turn off the take_over_control in the configuration, and I assume it would then adjust the light to the current value after it’s turned on.
If you have take_over_control enabled, you may have to either call adaptive_lighting.**apply** in any script or automation after turning the light on with the code above when adaptive lighting thinks that you want manual control, or you could call the adaptive_lighting.set_manual_control service to specify depending on what called the script/automation.
Personally, I’d probably write two scripts to be able to call either via button or in multiple automations, one that would automatically call the adaptive lighting settings and the other to automatically set the manual control to on.
I hope this suggestion might help you get where you want to go with your lights.