mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Send color_brightness to ESPHome devices on 1.20 (pre-color_mode) (#54670)
This commit is contained in:
parent
d091068092
commit
41d932fcf8
@ -105,8 +105,8 @@ class EsphomeLight(EsphomeEntity[LightInfo, LightState], LightEntity):
|
|||||||
color_bri = max(rgb)
|
color_bri = max(rgb)
|
||||||
# normalize rgb
|
# normalize rgb
|
||||||
data["rgb"] = tuple(x / (color_bri or 1) for x in rgb)
|
data["rgb"] = tuple(x / (color_bri or 1) for x in rgb)
|
||||||
|
data["color_brightness"] = color_bri
|
||||||
if self._supports_color_mode:
|
if self._supports_color_mode:
|
||||||
data["color_brightness"] = color_bri
|
|
||||||
data["color_mode"] = LightColorMode.RGB
|
data["color_mode"] = LightColorMode.RGB
|
||||||
|
|
||||||
if (rgbw_ha := kwargs.get(ATTR_RGBW_COLOR)) is not None:
|
if (rgbw_ha := kwargs.get(ATTR_RGBW_COLOR)) is not None:
|
||||||
@ -116,8 +116,8 @@ class EsphomeLight(EsphomeEntity[LightInfo, LightState], LightEntity):
|
|||||||
# normalize rgb
|
# normalize rgb
|
||||||
data["rgb"] = tuple(x / (color_bri or 1) for x in rgb)
|
data["rgb"] = tuple(x / (color_bri or 1) for x in rgb)
|
||||||
data["white"] = w
|
data["white"] = w
|
||||||
|
data["color_brightness"] = color_bri
|
||||||
if self._supports_color_mode:
|
if self._supports_color_mode:
|
||||||
data["color_brightness"] = color_bri
|
|
||||||
data["color_mode"] = LightColorMode.RGB_WHITE
|
data["color_mode"] = LightColorMode.RGB_WHITE
|
||||||
|
|
||||||
if (rgbww_ha := kwargs.get(ATTR_RGBWW_COLOR)) is not None:
|
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)
|
data["color_temperature"] = min_ct + ct_ratio * (max_ct - min_ct)
|
||||||
target_mode = LightColorMode.RGB_COLOR_TEMPERATURE
|
target_mode = LightColorMode.RGB_COLOR_TEMPERATURE
|
||||||
|
|
||||||
|
data["color_brightness"] = color_bri
|
||||||
if self._supports_color_mode:
|
if self._supports_color_mode:
|
||||||
data["color_brightness"] = color_bri
|
|
||||||
data["color_mode"] = target_mode
|
data["color_mode"] = target_mode
|
||||||
|
|
||||||
if (flash := kwargs.get(ATTR_FLASH)) is not None:
|
if (flash := kwargs.get(ATTR_FLASH)) is not None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user