mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Use supported color modes in Axis integration (#51557)
* Use supported color modes in Axis integration * Fix Frencks comments * Do Frencks suggestion
This commit is contained in:
parent
76edfe6c62
commit
aad90b8644
@ -4,7 +4,7 @@ from axis.event_stream import CLASS_LIGHT
|
|||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
SUPPORT_BRIGHTNESS,
|
COLOR_MODE_BRIGHTNESS,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
@ -49,7 +49,8 @@ class AxisLight(AxisEventBase, LightEntity):
|
|||||||
self.current_intensity = 0
|
self.current_intensity = 0
|
||||||
self.max_intensity = 0
|
self.max_intensity = 0
|
||||||
|
|
||||||
self._features = SUPPORT_BRIGHTNESS
|
self._attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
|
||||||
|
self._attr_color_mode = COLOR_MODE_BRIGHTNESS
|
||||||
|
|
||||||
async def async_added_to_hass(self) -> None:
|
async def async_added_to_hass(self) -> None:
|
||||||
"""Subscribe lights events."""
|
"""Subscribe lights events."""
|
||||||
@ -67,11 +68,6 @@ class AxisLight(AxisEventBase, LightEntity):
|
|||||||
)
|
)
|
||||||
self.max_intensity = max_intensity["data"]["ranges"][0]["high"]
|
self.max_intensity = max_intensity["data"]["ranges"][0]["high"]
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Flag supported features."""
|
|
||||||
return self._features
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
"""Return the name of the light."""
|
"""Return the name of the light."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user