Use ColorMode enum in ihc (#70508)

This commit is contained in:
epenet 2022-04-23 21:16:07 +02:00 committed by GitHub
parent 34ad7b329e
commit 346a385f1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,12 +3,7 @@ from __future__ import annotations
from ihcsdk.ihccontroller import IHCController from ihcsdk.ihccontroller import IHCController
from homeassistant.components.light import ( from homeassistant.components.light import ATTR_BRIGHTNESS, ColorMode, LightEntity
ATTR_BRIGHTNESS,
COLOR_MODE_BRIGHTNESS,
COLOR_MODE_ONOFF,
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
@ -80,9 +75,9 @@ class IhcLight(IHCDevice, LightEntity):
self._state = False self._state = False
if self._dimmable: if self._dimmable:
self._attr_color_mode = COLOR_MODE_BRIGHTNESS self._attr_color_mode = ColorMode.BRIGHTNESS
else: else:
self._attr_color_mode = COLOR_MODE_ONOFF self._attr_color_mode = ColorMode.ONOFF
self._attr_supported_color_modes = {self._attr_color_mode} self._attr_supported_color_modes = {self._attr_color_mode}
@property @property