Use ColorMode enum in velux (#70552)

pull/70908/head
epenet 2022-04-23 22:02:25 +02:00 committed by GitHub
parent 1b08e509ed
commit d00d9a2473
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 12 deletions

View File

@ -2,13 +2,8 @@
from __future__ import annotations from __future__ import annotations
from pyvlx import Intensity, LighteningDevice from pyvlx import Intensity, LighteningDevice
from pyvlx.node import Node
from homeassistant.components.light import ( from homeassistant.components.light import ATTR_BRIGHTNESS, ColorMode, LightEntity
ATTR_BRIGHTNESS,
COLOR_MODE_BRIGHTNESS,
LightEntity,
)
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
@ -33,12 +28,8 @@ async def async_setup_platform(
class VeluxLight(VeluxEntity, LightEntity): class VeluxLight(VeluxEntity, LightEntity):
"""Representation of a Velux light.""" """Representation of a Velux light."""
def __init__(self, node: Node) -> None: _attr_supported_color_modes = {ColorMode.BRIGHTNESS}
"""Initialize the Velux light.""" _attr_color_mode = ColorMode.BRIGHTNESS
super().__init__(node)
self._attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
self._attr_color_mode = COLOR_MODE_BRIGHTNESS
@property @property
def brightness(self): def brightness(self):