From 30b25a4d3d64d3f99e6d91595969906ae8a2ccfb Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Tue, 26 Apr 2022 09:26:29 +0200 Subject: [PATCH] Use climate enums in xs1 (#70753) --- homeassistant/components/xs1/climate.py | 26 +++++-------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/homeassistant/components/xs1/climate.py b/homeassistant/components/xs1/climate.py index 8ff3f2e8e03..bf2ab898112 100644 --- a/homeassistant/components/xs1/climate.py +++ b/homeassistant/components/xs1/climate.py @@ -3,8 +3,8 @@ from __future__ import annotations from xs1_api_client.api_constants import ActuatorType -from homeassistant.components.climate import ClimateEntity, ClimateEntityFeature -from homeassistant.components.climate.const import HVAC_MODE_HEAT +from homeassistant.components.climate import ClimateEntity +from homeassistant.components.climate.const import ClimateEntityFeature, HVACMode from homeassistant.const import ATTR_TEMPERATURE from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -15,8 +15,6 @@ from . import ACTUATORS, DOMAIN as COMPONENT_DOMAIN, SENSORS, XS1DeviceEntity MIN_TEMP = 8 MAX_TEMP = 25 -SUPPORT_HVAC = [HVAC_MODE_HEAT] - def setup_platform( hass: HomeAssistant, @@ -48,6 +46,8 @@ def setup_platform( class XS1ThermostatEntity(XS1DeviceEntity, ClimateEntity): """Representation of a XS1 thermostat.""" + _attr_hvac_mode = HVACMode.HEAT + _attr_hvac_modes = [HVACMode.HEAT] _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE def __init__(self, device, sensor): @@ -60,22 +60,6 @@ class XS1ThermostatEntity(XS1DeviceEntity, ClimateEntity): """Return the name of the device if any.""" return self.device.name() - @property - def hvac_mode(self): - """Return hvac operation ie. heat, cool mode. - - Need to be one of HVAC_MODE_*. - """ - return HVAC_MODE_HEAT - - @property - def hvac_modes(self): - """Return the list of available hvac operation modes. - - Need to be a subset of HVAC_MODES. - """ - return SUPPORT_HVAC - @property def current_temperature(self): """Return the current temperature.""" @@ -113,7 +97,7 @@ class XS1ThermostatEntity(XS1DeviceEntity, ClimateEntity): if self.sensor is not None: self.schedule_update_ha_state() - def set_hvac_mode(self, hvac_mode): + def set_hvac_mode(self, hvac_mode: HVACMode) -> None: """Set new target hvac mode.""" async def async_update(self):