mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Migrate firmata light to color_mode (#69256)
This commit is contained in:
parent
67c95e92b1
commit
5d56f94786
@ -5,7 +5,7 @@ import logging
|
|||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
SUPPORT_BRIGHTNESS,
|
COLOR_MODE_BRIGHTNESS,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
@ -56,6 +56,9 @@ async def async_setup_entry(
|
|||||||
class FirmataLight(FirmataPinEntity, LightEntity):
|
class FirmataLight(FirmataPinEntity, LightEntity):
|
||||||
"""Representation of a light on a Firmata board."""
|
"""Representation of a light on a Firmata board."""
|
||||||
|
|
||||||
|
_attr_color_mode = COLOR_MODE_BRIGHTNESS
|
||||||
|
_attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
api: FirmataBoardPin,
|
api: FirmataBoardPin,
|
||||||
@ -83,11 +86,6 @@ class FirmataLight(FirmataPinEntity, LightEntity):
|
|||||||
"""Return the brightness of the light."""
|
"""Return the brightness of the light."""
|
||||||
return self._api.state
|
return self._api.state
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self) -> int:
|
|
||||||
"""Flag supported features."""
|
|
||||||
return SUPPORT_BRIGHTNESS
|
|
||||||
|
|
||||||
async def async_turn_on(self, **kwargs) -> None:
|
async def async_turn_on(self, **kwargs) -> None:
|
||||||
"""Turn on light."""
|
"""Turn on light."""
|
||||||
level = kwargs.get(ATTR_BRIGHTNESS, self._last_on_level)
|
level = kwargs.get(ATTR_BRIGHTNESS, self._last_on_level)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user