diff --git a/homeassistant/components/mqtt/light/schema_basic.py b/homeassistant/components/mqtt/light/schema_basic.py index 7f2c2cf5e06..fe09667ca4a 100644 --- a/homeassistant/components/mqtt/light/schema_basic.py +++ b/homeassistant/components/mqtt/light/schema_basic.py @@ -482,6 +482,13 @@ class MqttLight(MqttEntity, LightEntity, RestoreEntity): if self._topic[CONF_BRIGHTNESS_STATE_TOPIC] is None: rgb = convert_color(*color) brightness = max(rgb) + if brightness == 0: + _LOGGER.debug( + "Ignoring %s message with zero rgb brightness from '%s'", + color_mode, + msg.topic, + ) + return None self._attr_brightness = brightness # Normalize the color to 100% brightness color = tuple( diff --git a/tests/components/mqtt/test_light.py b/tests/components/mqtt/test_light.py index ee4f170e8e6..59d5090b711 100644 --- a/tests/components/mqtt/test_light.py +++ b/tests/components/mqtt/test_light.py @@ -666,6 +666,12 @@ async def test_brightness_from_rgb_controlling_scale( assert state.attributes.get("brightness") == 128 assert state.attributes.get("rgb_color") == (255, 128, 64) + # Test zero rgb is ignored + async_fire_mqtt_message(hass, "test_scale_rgb/rgb/status", "0,0,0") + state = hass.states.get("light.test") + assert state.attributes.get("brightness") == 128 + assert state.attributes.get("rgb_color") == (255, 128, 64) + mqtt_mock.async_publish.reset_mock() await common.async_turn_on(hass, "light.test", brightness=191) await hass.async_block_till_done()