1
0
mirror of https://github.com/home-assistant/core.git synced 2026-02-15 07:36:16 +00:00

Fix missing color_mode attribute in mqtt light (#162311)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
epenet
2026-02-05 18:22:57 +01:00
committed by GitHub
parent a5b3d22058
commit 29da1233f3
2 changed files with 3 additions and 0 deletions

View File

@@ -221,8 +221,10 @@ class MqttLightJson(MqttEntity, LightEntity, RestoreEntity):
# Brightness is supported and no supported_color_modes are set,
# so set brightness as the supported color mode.
self._attr_supported_color_modes = {ColorMode.BRIGHTNESS}
self._attr_color_mode = ColorMode.BRIGHTNESS
else:
self._attr_supported_color_modes = {ColorMode.ONOFF}
self._attr_color_mode = ColorMode.ONOFF
def _update_color(self, values: dict[str, Any]) -> None:
color_mode: str = values["color_mode"]

View File

@@ -274,6 +274,7 @@ class MqttLightTemplate(MqttEntity, LightEntity, RestoreEntity):
if color_temp_value != "None"
else None
)
self._update_color_mode()
except ValueError:
_LOGGER.warning(
"Invalid color temperature value '%s' received from %s",