Use LightEntityFeature enum in osramlightify (#71059)

This commit is contained in:
epenet 2022-04-29 21:48:55 +02:00 committed by GitHub
parent 09d61edd9f
commit faffd809d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,9 +18,8 @@ from homeassistant.components.light import (
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_COLOR_TEMP,
SUPPORT_EFFECT,
SUPPORT_TRANSITION,
LightEntity,
LightEntityFeature,
)
from homeassistant.const import CONF_HOST
from homeassistant.core import HomeAssistant
@ -210,13 +209,18 @@ class Luminary(LightEntity):
"""Get list of supported features."""
features = 0
if "lum" in self._luminary.supported_features():
features = features | SUPPORT_BRIGHTNESS | SUPPORT_TRANSITION
features = features | SUPPORT_BRIGHTNESS | LightEntityFeature.TRANSITION
if "temp" in self._luminary.supported_features():
features = features | SUPPORT_COLOR_TEMP | SUPPORT_TRANSITION
features = features | SUPPORT_COLOR_TEMP | LightEntityFeature.TRANSITION
if "rgb" in self._luminary.supported_features():
features = features | SUPPORT_COLOR | SUPPORT_TRANSITION | SUPPORT_EFFECT
features = (
features
| SUPPORT_COLOR
| LightEntityFeature.TRANSITION
| LightEntityFeature.EFFECT
)
return features
@ -416,7 +420,7 @@ class OsramLightifyGroup(Luminary):
"""Get list of supported features."""
features = super()._get_supported_features()
if self._luminary.scenes():
features = features | SUPPORT_EFFECT
features = features | LightEntityFeature.EFFECT
return features