Use unknown color_mode for MQTT json lights if color mode is not set (#108909)

This commit is contained in:
Jan Bouwhuis 2024-01-26 14:42:47 +01:00 committed by GitHub
parent 00c2ba69f7
commit 7bec5ef6bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 76 additions and 0 deletions

View file

@ -220,6 +220,8 @@ class MqttLightJson(MqttEntity, LightEntity, RestoreEntity):
self._attr_supported_color_modes = self._config[CONF_SUPPORTED_COLOR_MODES]
if self.supported_color_modes and len(self.supported_color_modes) == 1:
self._attr_color_mode = next(iter(self.supported_color_modes))
else:
self._attr_color_mode = ColorMode.UNKNOWN
def _update_color(self, values: dict[str, Any]) -> None:
if not self._config[CONF_COLOR_MODE]: