diff --git a/homeassistant/components/mqtt/light/schema_basic.py b/homeassistant/components/mqtt/light/schema_basic.py index 8ad553ddd74..497e8186fd0 100644 --- a/homeassistant/components/mqtt/light/schema_basic.py +++ b/homeassistant/components/mqtt/light/schema_basic.py @@ -23,10 +23,10 @@ from homeassistant.components.light import ( SUPPORT_BRIGHTNESS, SUPPORT_COLOR, SUPPORT_COLOR_TEMP, - SUPPORT_EFFECT, SUPPORT_WHITE_VALUE, ColorMode, LightEntity, + LightEntityFeature, valid_supported_color_modes, ) from homeassistant.const import ( @@ -799,7 +799,8 @@ class MqttLight(MqttEntity, LightEntity, RestoreEntity): """Flag supported features.""" supported_features = 0 supported_features |= ( - self._topic[CONF_EFFECT_COMMAND_TOPIC] is not None and SUPPORT_EFFECT + self._topic[CONF_EFFECT_COMMAND_TOPIC] is not None + and LightEntityFeature.EFFECT ) if not self._legacy_mode: return supported_features diff --git a/homeassistant/components/mqtt/light/schema_json.py b/homeassistant/components/mqtt/light/schema_json.py index 2433bdf1679..c1e0d7467e0 100644 --- a/homeassistant/components/mqtt/light/schema_json.py +++ b/homeassistant/components/mqtt/light/schema_json.py @@ -24,13 +24,11 @@ from homeassistant.components.light import ( SUPPORT_BRIGHTNESS, SUPPORT_COLOR, SUPPORT_COLOR_TEMP, - SUPPORT_EFFECT, - SUPPORT_FLASH, - SUPPORT_TRANSITION, SUPPORT_WHITE_VALUE, VALID_COLOR_MODES, ColorMode, LightEntity, + LightEntityFeature, legacy_supported_features, valid_supported_color_modes, ) @@ -215,8 +213,10 @@ class MqttLightJson(MqttEntity, LightEntity, RestoreEntity): for key in (CONF_FLASH_TIME_SHORT, CONF_FLASH_TIME_LONG) } - self._supported_features = SUPPORT_TRANSITION | SUPPORT_FLASH - self._supported_features |= config[CONF_EFFECT] and SUPPORT_EFFECT + self._supported_features = ( + LightEntityFeature.TRANSITION | LightEntityFeature.FLASH + ) + self._supported_features |= config[CONF_EFFECT] and LightEntityFeature.EFFECT if not self._config[CONF_COLOR_MODE]: self._supported_features |= config[CONF_BRIGHTNESS] and SUPPORT_BRIGHTNESS self._supported_features |= config[CONF_COLOR_TEMP] and SUPPORT_COLOR_TEMP @@ -355,7 +355,7 @@ class MqttLightJson(MqttEntity, LightEntity, RestoreEntity): except ValueError: _LOGGER.warning("Invalid color temp value received") - if self._supported_features and SUPPORT_EFFECT: + if self._supported_features and LightEntityFeature.EFFECT: with suppress(KeyError): self._effect = values["effect"] diff --git a/homeassistant/components/mqtt/light/schema_template.py b/homeassistant/components/mqtt/light/schema_template.py index b82474db2a3..a98f634642d 100644 --- a/homeassistant/components/mqtt/light/schema_template.py +++ b/homeassistant/components/mqtt/light/schema_template.py @@ -15,11 +15,9 @@ from homeassistant.components.light import ( SUPPORT_BRIGHTNESS, SUPPORT_COLOR, SUPPORT_COLOR_TEMP, - SUPPORT_EFFECT, - SUPPORT_FLASH, - SUPPORT_TRANSITION, SUPPORT_WHITE_VALUE, LightEntity, + LightEntityFeature, ) from homeassistant.const import ( CONF_NAME, @@ -442,7 +440,7 @@ class MqttLightTemplate(MqttEntity, LightEntity, RestoreEntity): @property def supported_features(self): """Flag supported features.""" - features = SUPPORT_FLASH | SUPPORT_TRANSITION + features = LightEntityFeature.FLASH | LightEntityFeature.TRANSITION if self._templates[CONF_BRIGHTNESS_TEMPLATE] is not None: features = features | SUPPORT_BRIGHTNESS if ( @@ -452,7 +450,7 @@ class MqttLightTemplate(MqttEntity, LightEntity, RestoreEntity): ): features = features | SUPPORT_COLOR | SUPPORT_BRIGHTNESS if self._config.get(CONF_EFFECT_LIST) is not None: - features = features | SUPPORT_EFFECT + features = features | LightEntityFeature.EFFECT if self._templates[CONF_COLOR_TEMP_TEMPLATE] is not None: features = features | SUPPORT_COLOR_TEMP if self._templates[CONF_WHITE_VALUE_TEMPLATE] is not None: