Shellyforhass: [FR] Please add CW/WW support for RGBW2

Created on 17 Sep 2020  路  9Comments  路  Source: StyraHem/ShellyForHASS

Is your feature request related to a problem? Please describe.

I have LED strips which contain both CW and WW leds. It would be nice if these were supported in ShellyForHASS, as discussed a while ago on Facebook.

These strips are also called CCT strips.

Describe the solution you'd like

An implementation of CW/WW support for the RGBW2 device, similar to what is available in Homey with this change: https://github.com/jghaanstra/cloud.shelly/pull/11/commits/fc8f82796214e2a30e9b724efbe4f814a75e2480.

Describe alternatives you've considered

Combining both led colors in a template light, but is is complex and is not user-friendly.

Additional context

enhancement

Most helpful comment

ESPhome has a similar feature:
https://esphome.io/components/light/cwww.html?highlight=cwww

In the config it is possible to choose for constant brightness
(cw+ww equals 100% brightness)
mix 50/50 = 100% brightness

Or to disable constant brightness
mix of cold + warm 100/100 = 200% brightness
The brightness is dynamic in this setup.

I would love to be able to choose between these two options.

CWWW

All 9 comments

If this is possible, it would help me a lot too!

can you please let me know how this should look like in HA and what and how is the connection to the Shelly RGBW2 look like?

The setup contains two CW/WW led (strips) connected to a single Shelly RGBW2. These should show up in HA as two lights with color_temp/kelvin support.

Wiring:
| Shelly | Strip 1 | Strip 2 |
|---|:---:|:---:|
| R | CW | |
| G | WW | |
| B | | CW |
| W | | WW |

How will the conversation from color_temp to percent for WW and CW look like? I guess that depends on what led strips connected?

ESPhome has a similar feature:
https://esphome.io/components/light/cwww.html?highlight=cwww

In the config it is possible to choose for constant brightness
(cw+ww equals 100% brightness)
mix 50/50 = 100% brightness

Or to disable constant brightness
mix of cold + warm 100/100 = 200% brightness
The brightness is dynamic in this setup.

I would love to be able to choose between these two options.

CWWW

I'm using the same configuration with RGBW2's. I have written my own LightRGB class that combines two channels for a light with color temperature. I would also welcome a 'native' support of this feature. My class uses the following conversion between brightness/color temperature and warm/cold values. The conversion supports two methods, were 'A' is basically the "dynamic brightness" curve from @filmgarage, and the other method is the "constant brightness" flavor.

def _bright_temp_from_cold_warm(self, cold, warm):
    """Calculate CT and brightness from cold and warm white."""
    if (cold + warm) == 0:
        return 0, self._temp
    if self._calc_method == "A":
        r = cold / (cold + warm)
        color_temp = round(
            min(MAX_KELVIN, (r * max(0, MAX_KELVIN - MIN_KELVIN)) + MIN_KELVIN)
        )
        brightness = warm if r < 0.5 else cold
    else:
        brightness = max(1, min(100, cold + warm))
        color_temp = round(
            min(
                MAX_KELVIN,
                (cold * max(0, MAX_KELVIN - MIN_KELVIN) / brightness) + MIN_KELVIN,
            )
        )
    return brightness, color_temp

def _cold_warm_from_bright_temp(self, brightness, color_temp):
    """Calculate cold and warm white from CT and brightness."""
    if brightness <= 0:
        return 0.0, 0.0
    if self._calc_method == "A":
        r = (color_temp - MIN_KELVIN) / (MAX_KELVIN - MIN_KELVIN)
        if r < 0.5:
            cold = round(r / (1 - r) * brightness)
            warm = brightness
        else:
            warm = round((1 - r) / r * brightness)
            cold = brightness
    else:
        cold = round(
            (color_temp - MIN_KELVIN) / (MAX_KELVIN - MIN_KELVIN) * brightness
        )
        warm = brightness - cold
    return max(1, min(100, cold)), max(1, min(100, warm))

Gamma correct seems to default to 2.8: https://esphome.io/components/light/index.html#config-light

This feature would be great 馃槉

Was this page helpful?
0 / 5 - 0 ratings

Related issues

filmgarage picture filmgarage  路  7Comments

vistalba picture vistalba  路  9Comments

Goobiegoobers picture Goobiegoobers  路  9Comments

n3tkiller picture n3tkiller  路  7Comments

vistalba picture vistalba  路  5Comments