Send color_brightness to ESPHome devices on 1.20 (pre-color_mode) (#54670)
This commit is contained in:
parent
d091068092
commit
41d932fcf8
1 changed files with 3 additions and 3 deletions
|
@ -105,8 +105,8 @@ class EsphomeLight(EsphomeEntity[LightInfo, LightState], LightEntity):
|
|||
color_bri = max(rgb)
|
||||
# normalize rgb
|
||||
data["rgb"] = tuple(x / (color_bri or 1) for x in rgb)
|
||||
data["color_brightness"] = color_bri
|
||||
if self._supports_color_mode:
|
||||
data["color_brightness"] = color_bri
|
||||
data["color_mode"] = LightColorMode.RGB
|
||||
|
||||
if (rgbw_ha := kwargs.get(ATTR_RGBW_COLOR)) is not None:
|
||||
|
@ -116,8 +116,8 @@ class EsphomeLight(EsphomeEntity[LightInfo, LightState], LightEntity):
|
|||
# normalize rgb
|
||||
data["rgb"] = tuple(x / (color_bri or 1) for x in rgb)
|
||||
data["white"] = w
|
||||
data["color_brightness"] = color_bri
|
||||
if self._supports_color_mode:
|
||||
data["color_brightness"] = color_bri
|
||||
data["color_mode"] = LightColorMode.RGB_WHITE
|
||||
|
||||
if (rgbww_ha := kwargs.get(ATTR_RGBWW_COLOR)) is not None:
|
||||
|
@ -144,8 +144,8 @@ class EsphomeLight(EsphomeEntity[LightInfo, LightState], LightEntity):
|
|||
data["color_temperature"] = min_ct + ct_ratio * (max_ct - min_ct)
|
||||
target_mode = LightColorMode.RGB_COLOR_TEMPERATURE
|
||||
|
||||
data["color_brightness"] = color_bri
|
||||
if self._supports_color_mode:
|
||||
data["color_brightness"] = color_bri
|
||||
data["color_mode"] = target_mode
|
||||
|
||||
if (flash := kwargs.get(ATTR_FLASH)) is not None:
|
||||
|
|
Loading…
Add table
Reference in a new issue