From 6d237275f8a64193c711cc4b3ba8e6973989439c Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Sat, 23 Apr 2022 21:24:19 +0200 Subject: [PATCH] Use ColorMode enum in modern_forms (#70523) --- homeassistant/components/modern_forms/light.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/modern_forms/light.py b/homeassistant/components/modern_forms/light.py index 7431cf0c3bb..55569054ac4 100644 --- a/homeassistant/components/modern_forms/light.py +++ b/homeassistant/components/modern_forms/light.py @@ -6,11 +6,7 @@ from typing import Any from aiomodernforms.const import LIGHT_POWER_OFF, LIGHT_POWER_ON import voluptuous as vol -from homeassistant.components.light import ( - ATTR_BRIGHTNESS, - COLOR_MODE_BRIGHTNESS, - LightEntity, -) +from homeassistant.components.light import ATTR_BRIGHTNESS, ColorMode, LightEntity from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_platform @@ -83,6 +79,9 @@ async def async_setup_entry( class ModernFormsLightEntity(ModernFormsDeviceEntity, LightEntity): """Defines a Modern Forms light.""" + _attr_color_mode = ColorMode.BRIGHTNESS + _attr_supported_color_modes = {ColorMode.BRIGHTNESS} + def __init__( self, entry_id: str, coordinator: ModernFormsDataUpdateCoordinator ) -> None: @@ -94,8 +93,6 @@ class ModernFormsLightEntity(ModernFormsDeviceEntity, LightEntity): icon=None, ) self._attr_unique_id = f"{self.coordinator.data.info.mac_address}" - self._attr_color_mode = COLOR_MODE_BRIGHTNESS - self._attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS} @property def brightness(self) -> int | None: