Migrate firmata light to color_mode (#69256)

pull/69253/head
Erik Montnemery 2022-04-04 18:17:21 +02:00 committed by GitHub
parent 67c95e92b1
commit 5d56f94786
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 6 deletions

View File

@ -5,7 +5,7 @@ import logging
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
SUPPORT_BRIGHTNESS,
COLOR_MODE_BRIGHTNESS,
LightEntity,
)
from homeassistant.config_entries import ConfigEntry
@ -56,6 +56,9 @@ async def async_setup_entry(
class FirmataLight(FirmataPinEntity, LightEntity):
"""Representation of a light on a Firmata board."""
_attr_color_mode = COLOR_MODE_BRIGHTNESS
_attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
def __init__(
self,
api: FirmataBoardPin,
@ -83,11 +86,6 @@ class FirmataLight(FirmataPinEntity, LightEntity):
"""Return the brightness of the light."""
return self._api.state
@property
def supported_features(self) -> int:
"""Flag supported features."""
return SUPPORT_BRIGHTNESS
async def async_turn_on(self, **kwargs) -> None:
"""Turn on light."""
level = kwargs.get(ATTR_BRIGHTNESS, self._last_on_level)