mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Migrate unifiled light to color_mode (#69523)
This commit is contained in:
parent
72429a6c04
commit
ee71dcca6c
@ -8,8 +8,8 @@ import voluptuous as vol
|
||||
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS,
|
||||
COLOR_MODE_BRIGHTNESS,
|
||||
PLATFORM_SCHEMA,
|
||||
SUPPORT_BRIGHTNESS,
|
||||
LightEntity,
|
||||
)
|
||||
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNAME
|
||||
@ -59,6 +59,9 @@ def setup_platform(
|
||||
class UnifiLedLight(LightEntity):
|
||||
"""Representation of an unifiled Light."""
|
||||
|
||||
_attr_color_mode = COLOR_MODE_BRIGHTNESS
|
||||
_attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
|
||||
|
||||
def __init__(self, light, api):
|
||||
"""Init Unifi LED Light."""
|
||||
|
||||
@ -69,7 +72,6 @@ class UnifiLedLight(LightEntity):
|
||||
self._state = light["status"]["output"]
|
||||
self._available = light["isOnline"]
|
||||
self._brightness = self._api.convertfrom100to255(light["status"]["led"])
|
||||
self._features = SUPPORT_BRIGHTNESS
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
@ -96,11 +98,6 @@ class UnifiLedLight(LightEntity):
|
||||
"""Return true if light is on."""
|
||||
return self._state
|
||||
|
||||
@property
|
||||
def supported_features(self):
|
||||
"""Return the supported features of this light."""
|
||||
return self._features
|
||||
|
||||
def turn_on(self, **kwargs):
|
||||
"""Instruct the light to turn on."""
|
||||
self._api.setdevicebrightness(
|
||||
|
Loading…
x
Reference in New Issue
Block a user