Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions homeassistant/components/ihc/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

from homeassistant.components.light import (
ATTR_BRIGHTNESS,
SUPPORT_BRIGHTNESS,
COLOR_MODE_BRIGHTNESS,
COLOR_MODE_ONOFF,
LightEntity,
)
from homeassistant.core import HomeAssistant
Expand Down Expand Up @@ -78,6 +79,12 @@ def __init__(
self._dimmable = dimmable
self._state = False

if self._dimmable:
self._attr_color_mode = COLOR_MODE_BRIGHTNESS
else:
self._attr_color_mode = COLOR_MODE_ONOFF
self._attr_supported_color_modes = {self._attr_color_mode}

@property
def brightness(self) -> int:
"""Return the brightness of this light between 0..255."""
Expand All @@ -88,13 +95,6 @@ def is_on(self) -> bool:
"""Return true if light is on."""
return self._state

@property
def supported_features(self):
"""Flag supported features."""
if self._dimmable:
return SUPPORT_BRIGHTNESS
return 0

async def async_turn_on(self, **kwargs):
"""Turn the light on."""
if ATTR_BRIGHTNESS in kwargs:
Expand Down