From a66ad39c4ec9aae1a650430929e29c49bb6d236d Mon Sep 17 00:00:00 2001 From: Jan Bouwhuis Date: Fri, 22 Sep 2023 12:09:37 +0200 Subject: [PATCH] Assign color_mode for mqtt light as ColorMode (#100709) --- homeassistant/components/mqtt/light/schema_basic.py | 2 +- tests/components/mqtt/test_light.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/mqtt/light/schema_basic.py b/homeassistant/components/mqtt/light/schema_basic.py index 34b4a567ba5..03f78b8c43f 100644 --- a/homeassistant/components/mqtt/light/schema_basic.py +++ b/homeassistant/components/mqtt/light/schema_basic.py @@ -557,7 +557,7 @@ class MqttLight(MqttEntity, LightEntity, RestoreEntity): _LOGGER.debug("Ignoring empty color mode message from '%s'", msg.topic) return - self._attr_color_mode = str(payload) + self._attr_color_mode = ColorMode(str(payload)) get_mqtt_data(self.hass).state_write_requests.write_state_request(self) add_topic(CONF_COLOR_MODE_STATE_TOPIC, color_mode_received) diff --git a/tests/components/mqtt/test_light.py b/tests/components/mqtt/test_light.py index 08def9a923e..ba0b21b5ceb 100644 --- a/tests/components/mqtt/test_light.py +++ b/tests/components/mqtt/test_light.py @@ -3175,9 +3175,9 @@ async def test_reloadable( ("state_topic", "ON", None, "on", None), ( "color_mode_state_topic", - "200", + "rgb", "color_mode", - "200", + "rgb", ("state_topic", "ON"), ), ("color_temp_state_topic", "200", "color_temp", 200, ("state_topic", "ON")),