Skip to content

Home Assistant integration to mix multiple lights of various color temperatures into a single light

License

Notifications You must be signed in to change notification settings

mion00/color-temperature-light-mixer

Repository files navigation

logo logo

Color Temperature Light Mixer

Home Assistant integration to group multiple light sources into a single "virtual" color temperature-changing light.

Useful for instance with LED strips having separate cold white/warm white channels (CCT or CWWW LED), in which two separate light entities are available in Home Assistant, one for each color temperature. This integration groups together the two lights, allowing them to be controlled as a single entity in HA.

An example application is a "dumb"/analog LED strip controlled by a Shelly RGBW2 (configured in 4 white channels mode), where the cold light and warm light channels are each connected to a separate channel in the Shelly.


Features

  • Group two lights sources under a new, "virtual" light that combines their brightness output to achieve a varied range of color temperatures.
  • The "virtual" light reaches 100% brightness by turning on both light sources (check the Know limitations section below for more information and potential issues you may encounter with your specific setup).
  • Intelligently handles unreachable settings for brightness and color temperatures based on the data passed to the light.turn_on service. See this Python notebook for more details.
  • Can restore its own state after a reboot.

Installation

Install from HACS (recommended)

  1. Requirements: have HACS installed, this will allow you to easily manage and track updates.
  2. Add this repository as a Custom repository (more details) or just press the button below:
    Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.
  3. Once added, search in HACS for "Color Temperature Light Mixer".
  4. Click Install.
  5. You can configure the component via:
    1. Home Assistant UI
      In the HA UI go to "Configuration" > "Integrations" click "+" and search for "Color Temperature Light Mixer".
    2. configuration.yaml
      Follow the instructions below, then restart Home Assistant.

Manual installation

  1. Using the tool of choice open the directory (folder) for your HA configuration (where you find configuration.yaml).
  2. If you do not have a custom_components directory (folder) there, you need to create it.
  3. In the custom_components directory (folder) create a new folder called color_temperature_light_mixer.
  4. Download the file color_temperature_light_mixer.zip from the latest release section in this repository.
  5. Extract all files from this archive you downloaded in the directory (folder) you created.
  6. Restart Home Assistant
  7. You can configure the component via:
    1. Home Assistant UI
      In the HA UI go to "Configuration" > "Integrations" click "+" and search for "Color Temperature Light Mixer".
    2. configuration.yaml
      Follow the instructions below, then restart Home Assistant.

Configuration

The integration can be configured via either HA UI and YAML.

The following configuration options are supported:

Name Description
name The name of the "virtual" color changing temperature light.
warm_light_entity_id The entity_id representing the warm light (yellow-ish color).
warm_light_color_temp_kelvin The color temperature of the warm light, in Kelvin.
cold_light_entity_id The entity_id representing the cold light (blu-ish color).
cold_light_color_temp_kelvin The color temperature of the cold light, in Kelvin.

YAML file

The same configuration options can be specified via the configuration.yaml. See the following snippet for an example:

color_temperature_light_mixer:
  - name: Virtual
    warm_light_entity_id: light.warm_white
    warm_light_color_temp_kelvin: 3000
    cold_light_entity_id: light.cold_white
    cold_light_color_temp_kelvin: 6000

This integration will set up the following entities (one for each of your defined configurations):

Platform Description
light The "virtual" color changing temperature light combining the warm and cold light entities.

Keeping track of updates

You can automatically track new versions of this component and update it by HACS, or follow this repository on GitHub to be notified of new releases.

Known limitations and issues

  • This integration makes the assumption that 100% brightness is achieved when both warm white AND cold white LEDs are on. Check the specifications of your lights to see if this type of setup is supported (compared instead to having only one of the strips at 100% power at a time).
    A future development might include the ability to cap the output brightness for setups where this is required.

  • At the moment the assumption is that each light source "contributes" equally to the resulting temperature. This was a design choice done to keep the math required in the computations simple. In some particular setups however this might not be the case.

  • At the moment only two light sources are supported per "virtual" light.
    It is nonetheless possible to create multiple "virtual" lights, each with their own pair of light sources.

  • Support for light transitions has not been appropriately tested yet.

Troubleshooting

You can enable debug logs in two different ways:

  • From the integration page inside Home Assistant, by clicking Enable debug logging and then downloading the generated logs. See the HA docs for more information.

  • By editing configuration.yaml and restarting HA:

    # configuration.yaml
    logger:
    default: info
    logs:
        custom_components.color_temperature_light_mixer: debug

Contributions are welcome!

This is an active open-source project. We are always open to people who want to use the code or contribute to it.

We have set up a separate document containing our contribution guidelines.

Thank you for being involved!

Authors & contributors

For a full list of all authors and contributors, check the contributor's page.

Credits

The original inspiration came from the template light provided by gfrancesco, as part of this HA forum thread.

This Home Assistant custom component was created and is updated using the HA-Blueprint template. You can use this template to maintain your own Home Assistant custom components.