mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 08:47:10 +00:00
Use ColorMode enum in modern_forms (#70523)
This commit is contained in:
parent
a2bf33e74c
commit
6d237275f8
@ -6,11 +6,7 @@ from typing import Any
|
|||||||
from aiomodernforms.const import LIGHT_POWER_OFF, LIGHT_POWER_ON
|
from aiomodernforms.const import LIGHT_POWER_OFF, LIGHT_POWER_ON
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import ATTR_BRIGHTNESS, ColorMode, LightEntity
|
||||||
ATTR_BRIGHTNESS,
|
|
||||||
COLOR_MODE_BRIGHTNESS,
|
|
||||||
LightEntity,
|
|
||||||
)
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import entity_platform
|
from homeassistant.helpers import entity_platform
|
||||||
@ -83,6 +79,9 @@ async def async_setup_entry(
|
|||||||
class ModernFormsLightEntity(ModernFormsDeviceEntity, LightEntity):
|
class ModernFormsLightEntity(ModernFormsDeviceEntity, LightEntity):
|
||||||
"""Defines a Modern Forms light."""
|
"""Defines a Modern Forms light."""
|
||||||
|
|
||||||
|
_attr_color_mode = ColorMode.BRIGHTNESS
|
||||||
|
_attr_supported_color_modes = {ColorMode.BRIGHTNESS}
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, entry_id: str, coordinator: ModernFormsDataUpdateCoordinator
|
self, entry_id: str, coordinator: ModernFormsDataUpdateCoordinator
|
||||||
) -> None:
|
) -> None:
|
||||||
@ -94,8 +93,6 @@ class ModernFormsLightEntity(ModernFormsDeviceEntity, LightEntity):
|
|||||||
icon=None,
|
icon=None,
|
||||||
)
|
)
|
||||||
self._attr_unique_id = f"{self.coordinator.data.info.mac_address}"
|
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
|
@property
|
||||||
def brightness(self) -> int | None:
|
def brightness(self) -> int | None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user