Use the action field enums in nest (#196033)

This commit is contained in:
epenet
2026-12-02 09:08:41 -05:00
committed by GitHub
parent 99c8712b5d
commit 5e6b17ac01
+7 -9
View File
@@ -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: