Change bulb color temperature depending on time of day

I have two Inovelli tunable white bulbs in a floor lamp. Except for the Hubitat, these are the only smart components involved and the lamp is plugged into a regular wall outlet. This outlet is not controlled by a wall switch.

I want these bulbs to do three things:

  1. When the lamp is on, start adjusting the color temperature at 9:45am from 3000 K to 5500 K over the course of 30 minutes. This is the "Desk light fade into day" rule in the screenshots below.
  2. When the lamp is on, starting adjusting the color temperature at sunset -90 from 5500 K to 3000 K over 45 minutes. This is "Desk light fade into evening".
  3. When the light off and then switched on, set the color temperature to 5500k if the time is between 9:45 am and sunset -90. Outside that timespan, the bulbs should turn on to 3000 K. This "Desk lamp on".

Here are my rules. I have the two bulbs grouped as the 'Desk lamp' device.
dlday

dlevening

desklampon

The fade rules are working fine, but it doesn't jump to the proper color temperature by itself if i turn the lamp on in the evening or early morning. However, if I log into the Hubitat and run the rule manually, the rule works and the color temp changes right away.

I know I'm close but I'm missing something. Any suggestions how I can make this work?

You would have to test this but I'm not sure that you're bulbs will send an event when they get power. That's not technically a turning on event. They might not send anything and you won't have an event for the last requirement unless you ping them or something.

With smart bulbs you sort of want to not cut power to them if you plan to use them for automations. That way you know they will respond.

Also for requirement 1 and 2 you need to set an initial color temperature just in case it's not what you're expecting.

I have my Sengleds doing something similar with this rule:

It works great. Some of them are always powered and others are on old fashioned switches. This fires when the mode changes, or any of the bulbs turn on. I suppose if the bulb was set to “off” and then switched off physically it might not work when they come back on... but I haven’t run into that problem yet.

I would prefer to have them change over a minute or so rather than flash to it... but there doesn’t seem to be a way to make that happen.

1 Like

Here is something I came up with this morning which simplifies things a bit. It moves the calculation of color temperature into one place, and the setting of temperature on the bulbs into another. They’re linked via a global variable.

These screenshots don’t do a great job of conveying information like this, so here’s a plain English version too.

  • I added a global variable called color-temperature
  • I made a rule which changes the color temperature global variable based on the system mode (ie the time of day)
  • I made a rule which changes the color temperature of the bulbs to match the global variable; it is triggered by a change in the variable or a bulb switching on.
  • I also adjusted the bulb driver settings to make color changes happen as slow as possible, 5s. This softens the flicker when a bulb is turned on which was set to a different mode color.

1 Like

Yeah I was afraid of the constant power vs. power off situation but I'm not sure how to avoid it with a fixture which isn't hard wired to a wall switch (important note: I do not want to rely on controlling the lamp through a phone or computer).

I assume I could install a smart outlet which the lamp plugs into for constant power. Then I'd then need a button device to use as a trigger which tells the Hubitat to tell the bulbs to change level from 0 to 100%. Does that sound right?

Here are the HE logs from when I turn on this lamp:

I'm new to this stuff, but do those log entries count as events, or is there something specific you had in mind?

Thanks for the examples. I've got to take some time to wrap my head around all that. How were you able to specify a trigger event of turns on? I can only find "physical on", maybe I'm not looking hard enough.

Where the bulb shows up depends on the driver and the device. It may be that the bulbs you have don’t send events the way mine do. The list of triggers is long and not exactly easy to internalize.

From the Trigger menu I select “Switch” and then I can pick my bulbs, and when it receives power it triggers the event.

Alternatively — you could use Circadian Daylight :slight_smile:

5 Likes

Turns out that this was the only change I needed to make and now I can turn the light on at any time and it'll jump to the desired color temperature. This while still doing the gradual fade.

I'll experiment with some of the other ideas here too. Thank you everyone who responded.

1 Like

Just came here to say thank you for this, I was about to post asking how to do this but found your post. Much appreciated!

1 Like