mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Migrate enocean light to color_mode (#69180)
This commit is contained in:
parent
24754c31ca
commit
9335b9a52e
@ -7,8 +7,8 @@ import voluptuous as vol
|
|||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
|
COLOR_MODE_BRIGHTNESS,
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
SUPPORT_BRIGHTNESS,
|
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_ID, CONF_NAME
|
from homeassistant.const import CONF_ID, CONF_NAME
|
||||||
@ -22,7 +22,6 @@ from .device import EnOceanEntity
|
|||||||
CONF_SENDER_ID = "sender_id"
|
CONF_SENDER_ID = "sender_id"
|
||||||
|
|
||||||
DEFAULT_NAME = "EnOcean Light"
|
DEFAULT_NAME = "EnOcean Light"
|
||||||
SUPPORT_ENOCEAN = SUPPORT_BRIGHTNESS
|
|
||||||
|
|
||||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||||
{
|
{
|
||||||
@ -50,6 +49,9 @@ def setup_platform(
|
|||||||
class EnOceanLight(EnOceanEntity, LightEntity):
|
class EnOceanLight(EnOceanEntity, LightEntity):
|
||||||
"""Representation of an EnOcean light source."""
|
"""Representation of an EnOcean light source."""
|
||||||
|
|
||||||
|
_attr_color_mode = COLOR_MODE_BRIGHTNESS
|
||||||
|
_attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
|
||||||
|
|
||||||
def __init__(self, sender_id, dev_id, dev_name):
|
def __init__(self, sender_id, dev_id, dev_name):
|
||||||
"""Initialize the EnOcean light source."""
|
"""Initialize the EnOcean light source."""
|
||||||
super().__init__(dev_id, dev_name)
|
super().__init__(dev_id, dev_name)
|
||||||
@ -76,11 +78,6 @@ class EnOceanLight(EnOceanEntity, LightEntity):
|
|||||||
"""If light is on."""
|
"""If light is on."""
|
||||||
return self._on_state
|
return self._on_state
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Flag supported features."""
|
|
||||||
return SUPPORT_ENOCEAN
|
|
||||||
|
|
||||||
def turn_on(self, **kwargs):
|
def turn_on(self, **kwargs):
|
||||||
"""Turn the light source on or sets a specific dimmer value."""
|
"""Turn the light source on or sets a specific dimmer value."""
|
||||||
if (brightness := kwargs.get(ATTR_BRIGHTNESS)) is not None:
|
if (brightness := kwargs.get(ATTR_BRIGHTNESS)) is not None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user