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:
Robert Svensson 2021-06-08 00:03:33 +02:00 committed by GitHub
parent 76edfe6c62
commit aad90b8644
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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."""