From 5e6b17ac01bf1f207f09451e136ca6ca59007b4a Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 2 Dec 2026 15:08:41 +0100 Subject: [PATCH] Use the action field enums in nest (#196033) --- homeassistant/components/nest/climate.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/nest/climate.py b/homeassistant/components/nest/climate.py index afe4e889cb80..c411555788b7 100644 --- a/homeassistant/components/nest/climate.py +++ b/homeassistant/components/nest/climate.py @@ -14,19 +14,17 @@ from google_nest_sdm.thermostat_traits import ( ) from homeassistant.components.climate import ( - ATTR_HVAC_MODE, - ATTR_TARGET_TEMP_HIGH, - ATTR_TARGET_TEMP_LOW, FAN_OFF, FAN_ON, PRESET_ECO, PRESET_NONE, ClimateEntity, ClimateEntityFeature, + ClimateServiceArgument, HVACAction, HVACMode, ) -from homeassistant.const import ATTR_TEMPERATURE, UnitOfTemperature +from homeassistant.const import UnitOfTemperature from homeassistant.core import HomeAssistant from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback @@ -308,9 +306,9 @@ class ThermostatEntity(ClimateEntity): async def async_set_temperature(self, **kwargs: Any) -> None: """Set new target temperature.""" hvac_mode = self.hvac_mode - low_temp = kwargs.get(ATTR_TARGET_TEMP_LOW) - high_temp = kwargs.get(ATTR_TARGET_TEMP_HIGH) - temp = kwargs.get(ATTR_TEMPERATURE) + low_temp = kwargs.get(ClimateServiceArgument.TARGET_TEMP_LOW) + high_temp = kwargs.get(ClimateServiceArgument.TARGET_TEMP_HIGH) + temp = kwargs.get(ClimateServiceArgument.TEMPERATURE) if temp: temperature_description = f"temperature to {temp}" @@ -324,8 +322,8 @@ class ThermostatEntity(ClimateEntity): "Cannot set temperature while in ECO preset mode." ) - if kwargs.get(ATTR_HVAC_MODE) is not None: - hvac_mode = kwargs[ATTR_HVAC_MODE] + if kwargs.get(ClimateServiceArgument.HVAC_MODE) is not None: + hvac_mode = kwargs[ClimateServiceArgument.HVAC_MODE] await self.async_set_hvac_mode(hvac_mode) if ThermostatTemperatureSetpointTrait.NAME not in self._device.traits: