You may think about briefly starting cool during the pre-sunrise stage.
The blue hour is the cool colored light that occurs in the twilight before the sun comes up
its been argued that this is also an important part of naturally waking.
@seanharsh: This looks like just what I’ve been searching for! Thank you for writing it.
I’m experimenting using it on v2026.1 and have noticed a log entry that “kelvin” has been replaced with “color_temp_kelvin”. I’ve made the adjustment in the YAML so I’m hoping that fixes it.
Also, I am using two Govee lights that are integrated with Mosquito MQTT and work well. However, there is a classic wall switch that controls dimmable power to them. Before I run your script, how should I set the switch? Do I turn down the Govee lights, but turn the switch on in your script? But that would seem to not provide power to the Govee lights?
I’m sure there’s a simple setup here, but I’m a newbie with HA and I’m not sure what your code needs to succeed.
Ill look at the kelvin option again, might have changed it since I released this.
As to the Govee, MQTT should work fine as long as the bulb has the standard brightness controls. For your standard swtich, I would leave it all the way up, and control brightness via HA itself (If I understand your setup correctly). Smart bulbs should always get 100% power.
Or do you mean the MQTT is pushing a swtich entity for the lights? If so, leave that be and use the light entity of the bulb(s) or group them and use the light group instead.
Yes, this is what I figured - the wall switch needs to be on 100% for the Grovees to get power. Should I set that in the “run this before automation” setting? I’ve tried this and it turns on the Grovee lights which runs the sunrise concept. Maybe I should start with the switch on and the Grovee lights to 1%? I’m still experimenting.
The MQTT is how the Grovee lights are set by HA. HA make the call via MQTT and the Govee lights obeys. This seems to work well and with good response times.
Or maybe I shouldn’t use Grovee lights. I have these on a trial and can return them. Do you recommend another manufacturer?
OK, so you do have a physical switch that controls dimming. What brand is it?
Govee is fine, really anything that runs in MQTT should be great. If you don’t have a zigbee network yet, Govee are great. I run a mix of Govee (for the TV back lights and to sync with other bulbs in the room for entertainment fun) and then some Segland zigbee, Ikea zigbee, and I think a Hue somewhere.
To be honest, I am using this in our bedroom with some older LIFX bulbs, all of which are attached to Innovelli switches. Those switches are set to smart bulb mode which provided constant power, but allows me to program the paddels to control power and brightness.
Maybe try to verify the switch is 100% in “Pre-Sunrise” and maybe see if the bulb(s) will let you set brightness to 0, worst case 1%.
For reference, here is my automation using the bedroom situation I described earlier:
I had some luck this morning. The trick settings seem to be in pre-sunrise actions to turn on the Insteon master dimmer to 100% and then set both Grovee bulbs power equals off. It happens so fast that I don’t notice. Then your script runs.
I’ve noticed the script doesn’t change the bulbs as smoothly as I’d like. In looking at your YAML, I see something like this a few times in the code:
While this works, I wonder why you don’t use a loop whose looping steps could be set/controlled? Or is that not possible a HA YAML? I’m an experienced coder, but a total newbie to HA and thus am only beginning to understand HA’s YAML files.
If this is possible, I’m happy to help with a PR if I can find the time.
Here’s the blueprint with some looping fixes. It also supports a Kelvin range.
Unfortunately my Insteon lights just don’t look compatable with the Grovee bulbs. I can’t turn on the power (via the dimmer) to the lights and turn them Govee light off fast enough. There is no Govee setting where the power-up as off or 1%. So, the sunrise gets really bright before it goes back to 1% to start. {sigh}
Yea, I think there was an issue with my LIFX bulbs and using a loop, but they seem to transition between % smoothly themselves, so it was never noticeable. I may try to loop them again using your changes and see what happens. You can also create a pull request on my repo to make the change there if you want to add more.
I have adjusted mine to use a loop, but instead of it being linear, I am using a curve, one to try and mimic the slow and then fast brightness from a typical sunrise.
In example, if you set your max brightness to 100% and duration at 45 minutes, you get something like this:
0 min 1% 2000K
5 min 5% 2400K
15 min 20% 3200K
30 min 55% 4400K
45 min 100% 5500K
I will tell you, I can not get the transition to work smoothly for my Govee bulbs here, either using mqtt or matter. When trying to apply the transition using the light.on action, it ignores the time. And I do get a weird flash at the start of the automation that does not seem to be resolvable pre either. The LIFX bulb does have a transition and was why I was using my 6 step process earlier; it was smooth.
Give the new loop a try. Just re-import the blueprint using my link/button above.
Sorry, I’ve been out of touch and haven’t got a PR ready yet. Sounds like you’ve been updating your code and may just want to pick anything out of mine that’s useful and not have me do a PR at all.
No problem, I looked at yours a little, had time today to re-write the loop, and test a bit. Im sure you have more better ways, and Ill keep an eye out for a PR if you want to send one my way.
Compare with mine, I decided to start from scratch since my research suggested a curve more than a linear approach to the sun’s progression. I did not integrate everything you suggested either.
Yea, same as my wife haha. I run an automation based on our location data as well as calendar events and phone alarms to disable this as well as other automations when we are known to not have to be anywhere in the morning. I have been thinking of adding it built-in for those more simple situations.
Ah, how do you disable an automation from running like that? Wouldn’t mind doing it that way since I have a calendar event set up for when I don’t have work as well