Remove deprecation warnings for zwave_js climate TURN_ON/TURN_OFF features (#109242)

pull/109302/head^2
Raman Gupta 2024-02-01 05:21:40 -05:00 committed by GitHub
parent 286c5faa79
commit 1af25bc010
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 0 deletions

View File

@ -129,6 +129,7 @@ class ZWaveClimate(ZWaveBaseEntity, ClimateEntity):
"""Representation of a Z-Wave climate."""
_attr_precision = PRECISION_TENTHS
_enable_turn_on_off_backwards_compatibility = False
def __init__(
self, config_entry: ConfigEntry, driver: Driver, info: ZwaveDiscoveryInfo
@ -193,6 +194,16 @@ class ZWaveClimate(ZWaveBaseEntity, ClimateEntity):
self._set_modes_and_presets()
if self._current_mode and len(self._hvac_presets) > 1:
self._attr_supported_features |= ClimateEntityFeature.PRESET_MODE
if HVACMode.OFF in self._hvac_modes:
self._attr_supported_features |= ClimateEntityFeature.TURN_OFF
# We can only support turn on if we are able to turn the device off,
# otherwise the device can be considered always on
if len(self._hvac_modes) == 2 or any(
mode in self._hvac_modes
for mode in (HVACMode.HEAT, HVACMode.COOL, HVACMode.HEAT_COOL)
):
self._attr_supported_features |= ClimateEntityFeature.TURN_ON
# If any setpoint value exists, we can assume temperature
# can be set
if any(self._setpoint_values.values()):