From ade91ebdab97cda6410e96b392f3b2d7461a13c5 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 4 Feb 2026 15:00:12 +0100 Subject: [PATCH] Cleanup deprecated COLOR_MODE light constants (#162197) --- homeassistant/components/light/__init__.py | 20 ------------------- tests/components/emulated_hue/test_hue_api.py | 16 +++++++-------- tests/components/light/test_init.py | 14 ------------- 3 files changed, 8 insertions(+), 42 deletions(-) diff --git a/homeassistant/components/light/__init__.py b/homeassistant/components/light/__init__.py index 99f299a49eb..fe241b5b63a 100644 --- a/homeassistant/components/light/__init__.py +++ b/homeassistant/components/light/__init__.py @@ -82,26 +82,6 @@ ATTR_COLOR_MODE = "color_mode" # List of color modes supported by the light ATTR_SUPPORTED_COLOR_MODES = "supported_color_modes" -# These COLOR_MODE_* constants are deprecated as of Home Assistant 2022.5. -# Please use the LightEntityFeature enum instead. -_DEPRECATED_COLOR_MODE_UNKNOWN: Final = DeprecatedConstantEnum( - ColorMode.UNKNOWN, "2026.1" -) -_DEPRECATED_COLOR_MODE_ONOFF: Final = DeprecatedConstantEnum(ColorMode.ONOFF, "2026.1") -_DEPRECATED_COLOR_MODE_BRIGHTNESS: Final = DeprecatedConstantEnum( - ColorMode.BRIGHTNESS, "2026.1" -) -_DEPRECATED_COLOR_MODE_COLOR_TEMP: Final = DeprecatedConstantEnum( - ColorMode.COLOR_TEMP, "2026.1" -) -_DEPRECATED_COLOR_MODE_HS: Final = DeprecatedConstantEnum(ColorMode.HS, "2026.1") -_DEPRECATED_COLOR_MODE_XY: Final = DeprecatedConstantEnum(ColorMode.XY, "2026.1") -_DEPRECATED_COLOR_MODE_RGB: Final = DeprecatedConstantEnum(ColorMode.RGB, "2026.1") -_DEPRECATED_COLOR_MODE_RGBW: Final = DeprecatedConstantEnum(ColorMode.RGBW, "2026.1") -_DEPRECATED_COLOR_MODE_RGBWW: Final = DeprecatedConstantEnum(ColorMode.RGBWW, "2026.1") -_DEPRECATED_COLOR_MODE_WHITE: Final = DeprecatedConstantEnum(ColorMode.WHITE, "2026.1") - - # mypy: disallow-any-generics diff --git a/tests/components/emulated_hue/test_hue_api.py b/tests/components/emulated_hue/test_hue_api.py index 0f8ffcbee9f..3754d1754e9 100644 --- a/tests/components/emulated_hue/test_hue_api.py +++ b/tests/components/emulated_hue/test_hue_api.py @@ -1794,11 +1794,11 @@ async def test_get_light_state_when_none( light.ATTR_COLOR_TEMP_KELVIN: None, light.ATTR_XY_COLOR: None, light.ATTR_SUPPORTED_COLOR_MODES: [ - light.COLOR_MODE_COLOR_TEMP, - light.COLOR_MODE_HS, - light.COLOR_MODE_XY, + light.ColorMode.COLOR_TEMP, + light.ColorMode.HS, + light.ColorMode.XY, ], - light.ATTR_COLOR_MODE: light.COLOR_MODE_XY, + light.ATTR_COLOR_MODE: light.ColorMode.XY, }, ) @@ -1822,11 +1822,11 @@ async def test_get_light_state_when_none( light.ATTR_COLOR_TEMP_KELVIN: None, light.ATTR_XY_COLOR: None, light.ATTR_SUPPORTED_COLOR_MODES: [ - light.COLOR_MODE_COLOR_TEMP, - light.COLOR_MODE_HS, - light.COLOR_MODE_XY, + light.ColorMode.COLOR_TEMP, + light.ColorMode.HS, + light.ColorMode.XY, ], - light.ATTR_COLOR_MODE: light.COLOR_MODE_XY, + light.ATTR_COLOR_MODE: light.ColorMode.XY, }, ) diff --git a/tests/components/light/test_init.py b/tests/components/light/test_init.py index 43b138cd5fe..1a9a005c0c9 100644 --- a/tests/components/light/test_init.py +++ b/tests/components/light/test_init.py @@ -2914,17 +2914,3 @@ def test_deprecated_support_light_constants_enums( import_and_test_deprecated_constant_enum( caplog, light, entity_feature, "SUPPORT_", "2026.1" ) - - -@pytest.mark.parametrize( - "entity_feature", - list(light.ColorMode), -) -def test_deprecated_color_mode_constants_enums( - caplog: pytest.LogCaptureFixture, - entity_feature: light.LightEntityFeature, -) -> None: - """Test deprecated support light constants.""" - import_and_test_deprecated_constant_enum( - caplog, light, entity_feature, "COLOR_MODE_", "2026.1" - )