Fix CI (tuya number and abode light) (#74163)

* Fix tuya unit_of_measurement

* Fix abode ColorMode
This commit is contained in:
epenet 2022-06-29 11:03:53 +02:00 committed by GitHub
parent 9d73f9a2c5
commit 1970e36f10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 12 deletions

View file

@ -11,10 +11,7 @@ from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_HS_COLOR,
COLOR_MODE_BRIGHTNESS,
COLOR_MODE_COLOR_TEMP,
COLOR_MODE_HS,
COLOR_MODE_ONOFF,
ColorMode,
LightEntity,
)
from homeassistant.config_entries import ConfigEntry
@ -107,20 +104,20 @@ class AbodeLight(AbodeDevice, LightEntity):
"""Return the color mode of the light."""
if self._device.is_dimmable and self._device.is_color_capable:
if self.hs_color is not None:
return COLOR_MODE_HS
return COLOR_MODE_COLOR_TEMP
return ColorMode.HS
return ColorMode.COLOR_TEMP
if self._device.is_dimmable:
return COLOR_MODE_BRIGHTNESS
return COLOR_MODE_ONOFF
return ColorMode.BRIGHTNESS
return ColorMode.ONOFF
@property
def supported_color_modes(self) -> set[str] | None:
"""Flag supported color modes."""
if self._device.is_dimmable and self._device.is_color_capable:
return {COLOR_MODE_COLOR_TEMP, COLOR_MODE_HS}
return {ColorMode.COLOR_TEMP, ColorMode.HS}
if self._device.is_dimmable:
return {COLOR_MODE_BRIGHTNESS}
return {COLOR_MODE_ONOFF}
return {ColorMode.BRIGHTNESS}
return {ColorMode.ONOFF}
@property
def supported_features(self) -> int:

View file

@ -146,7 +146,7 @@ NUMBERS: dict[str, tuple[NumberEntityDescription, ...]] = {
key=DPCode.COOK_TIME,
name="Cook Time",
icon="mdi:timer",
unit_of_measurement=TIME_MINUTES,
native_unit_of_measurement=TIME_MINUTES,
entity_category=EntityCategory.CONFIG,
),
NumberEntityDescription(