Use a RGBW light as a light with color temperature control

Use a RGBW light as a light with color temperature control.

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

The theory: An RGBW light can also be used to shift the white light in the color spectrum.
With CT lights, the color spectrum can only be shifted in a pretty narrow spectrum. RGBW lights allow color temperatures from 1900 to 10000 kelvin. For a wide range of CT (color temperature) the use of RGBW lights allow high brightness and a very good CRI. (see color rendition index). The CRI of white LEDs used in the RGBW light should be above 90 to get natural colors of the illuminated objects. The CRI of a white produced by RGB is below 70, which looks really bad. Strong reds, orange tones and dark blue colors can get really funky.

I use this concept for many years, so far my homebrew SW ran on ESP8266 controllers. With the switch to esphome a new control is necessary, so far esphome can not control RGBW lights with color temperature.

With this template any RGWB light can be converted to a color temperature controlled light. As soon as the setpoint changes, the color temperature is adjusted without changing the brightness.

Before an RGBW can be controlled with CT, it must be calibrated. Every light is different, even if it says the same thing.
I have made many attempts to calibrate automatically with RGB sensors. They have all failed. Pink turned green, orange turned turquoise, the whole spectrum. This is probably because the wavelengths of the LEDs do not match the wavelengths of the sensors. If you don’t have a full blown spectrometer there is only one possibility. Trust your eyes. In the end the light has to please your eyes, if it’s not perfect on scale, so what.
Calibration takes some time, but I have added sample data for a starting point.

Recommended calibration:
I use five calibration points. More could be overkill, however using only three limits the available CT spectrum or leads to interesting colors.
For calibration, I created another blueprint. With this you can easily adjust the values until you are satisfied.
Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled. (Calibration helper)

  1. If you want to calibrate on five color temperatures, you start with the middle value. This is the native white of the white LED, all other RGB values are 0, the temperature of the light should be known.
  2. The second value is the value towards blue. Here you look for a known reference source like the white of a monitor, which usually has a color temperature of 6500 kelvin. Check for your model. Now set white to about 70% and add blue and green until the colors are very similar.
  3. The next point is extreme blue light like at blue hour with about 10000 kelvin. Set blue to 100 and reduce white so that only a small part is visible but still has an effect. Then green to taste. Don’t trust any sensor, only your eyes.
  4. Now the calibrations towards red are missing. A halogen lamp has a nice color and can be used as a reference if available. If your white is already a warm white, then move it with 100% red in the direction of warm. Reduce white a bit, add green to taste.
  5. The last point is extreme warm light. Here most of the brightness can no longer be achieved, but looks nice and who wants a super bright extremely warm light? For red 100% white with about 30% almost off. Green as it pleases, I take 50%.

Copy the obtained values into the blueprint for RGBW to CT.
All channels R,G,B,W must have the same number of values!
The blueprint has an optional MQTT topic. Debugging blueprints is hell. In some cases the cause can be found here.

This is how my calibration looks like:

Let there be light!

If something goes wrong:

  • In the developement homeassitant did not like me sometimes with automations staying in oblivion. Delete the automation from frontend and start over. Sometimes this does not help, then open automation.yaml (or wherever you store your automations) delete this automation (probably the last one) and reload automation.


  • 2022-01-1 Initial release.

More theory:

source: Wikipedia
If you take two white lights at very large distance fading from one to another will lead to pink colors. More on the topic here (German language) (not affiliated or whatever)
The blueprint uses mred internally, an inverse of CT in kelvin. This is way more linear on the usable and visible range.


Hey, thank you for the nice tutorial (even when I am using Fibaro Home Automation).
To be honest I was to lacy to do any kind of calibration, I just took your values and I am fine with them :smiley:

Thanks for the feedback.
I also find myself to tweak values on an active light into a direction I like. After the initial calibration of course :wink:

Hello @swifty1101

I’m having an issue that I hope you can help with. Any suggestions on the error below?

2022-07-28 23:48:13 DEBUG (MainThread) [homeassistant.components.automation.use_rgbw_as_ct_light] Automation triggered
2022-07-28 23:48:13 ERROR (MainThread) [homeassistant.components.automation.use_rgbw_as_ct_light] Error rendering variables: AttributeError: 'list' object has no attribute 'lower'

hard to tell, could you share your relevant automation as yaml? it is in the automation.yaml, you can find it by the name.

Hi @swifty1101


- id: '1658928595792'
  alias: Use RGBW as CT Light
  description: ''
    path: swifty99/RGBW2CTLight.yaml
      - 2000
      - 2700
      - 3500
      - 4000
      - 6500
      - 20
      - 60
      - 100
      - 100
      - 70
      rgbw_2_ct_requested_input: input_number.colour_temperature
        - light.living_room_downlight_rear_left
      - 0
      - 0
      - 0
      - 0
      - 5
      - 60
      - 60
      - 70
      - 0
      - 10
      - 100
      - 100
      - 100
      - 0
      - 0

And attributes for the light. Note that this is physically a RBGW light, and I can send RGBW service commands, that work.

min_mireds: 153
max_mireds: 370
  - colorloop
  - color_temp
  - xy
color_mode: color_temp
brightness: 129
  - 28.391
  - 65.659
  - 255
  - 166
  - 87
  - 0.526
  - 0.387
off_with_transition: false
off_brightness: null
friendly_name: Living Room Downlight Rear Right
supported_features: 44
color_temp: 370

the automation looks good so far. Debugging blueprints is outright ugly, so no guarantee I can help.
For me the light entity looks suspicious.
my RGBW light in the develper tools → states looks like this:

supported_color_modes: rgbw
color_mode: rgbw
brightness: 0
hs_color: 22.326, 19.283
rgb_color: 223, 196, 180
rgbw_color: 54, 21, 0, 223
xy_color: 0.373, 0.345
friendly_name: a_name
supported_features: 40

yours does not seem to support rgbw mode. I do not know what happens if you send RGBW commands to a light, that you state is a RGBW light, however does not state it in supported color modes.
My assuption would be, that your light is a color temp light, which somehow accepts RGBW commands.
As your light accepts color temp right away, why not use it directly?