mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 04:07:08 +00:00
Add constant for climate feature flag check (#121619)
This commit is contained in:
parent
c5ced14473
commit
9d2cf70ba5
@ -125,6 +125,11 @@ DEFAULT_MAX_HUMIDITY = 99
|
|||||||
|
|
||||||
CONVERTIBLE_ATTRIBUTE = [ATTR_TEMPERATURE, ATTR_TARGET_TEMP_LOW, ATTR_TARGET_TEMP_HIGH]
|
CONVERTIBLE_ATTRIBUTE = [ATTR_TEMPERATURE, ATTR_TARGET_TEMP_LOW, ATTR_TARGET_TEMP_HIGH]
|
||||||
|
|
||||||
|
# Can be removed in 2025.1 after deprecation period of the new feature flags
|
||||||
|
CHECK_TURN_ON_OFF_FEATURE_FLAG = (
|
||||||
|
ClimateEntityFeature.TURN_ON | ClimateEntityFeature.TURN_OFF
|
||||||
|
)
|
||||||
|
|
||||||
SET_TEMPERATURE_SCHEMA = vol.All(
|
SET_TEMPERATURE_SCHEMA = vol.All(
|
||||||
cv.has_at_least_one_key(
|
cv.has_at_least_one_key(
|
||||||
ATTR_TEMPERATURE, ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW
|
ATTR_TEMPERATURE, ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW
|
||||||
@ -378,14 +383,11 @@ class ClimateEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
|||||||
return
|
return
|
||||||
|
|
||||||
supported_features = self.supported_features
|
supported_features = self.supported_features
|
||||||
if supported_features & (
|
if supported_features & CHECK_TURN_ON_OFF_FEATURE_FLAG:
|
||||||
ClimateEntityFeature.TURN_ON | ClimateEntityFeature.TURN_OFF
|
|
||||||
):
|
|
||||||
# The entity supports both turn_on and turn_off, the backwards compatibility
|
# The entity supports both turn_on and turn_off, the backwards compatibility
|
||||||
# checks are not needed
|
# checks are not needed
|
||||||
return
|
return
|
||||||
|
|
||||||
supported_features = self.supported_features
|
|
||||||
if not supported_features & ClimateEntityFeature.TURN_OFF and (
|
if not supported_features & ClimateEntityFeature.TURN_OFF and (
|
||||||
type(self).async_turn_off is not ClimateEntity.async_turn_off
|
type(self).async_turn_off is not ClimateEntity.async_turn_off
|
||||||
or type(self).turn_off is not ClimateEntity.turn_off
|
or type(self).turn_off is not ClimateEntity.turn_off
|
||||||
|
Loading…
x
Reference in New Issue
Block a user