Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions homeassistant/components/tessie/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
)

from homeassistant.components.climate import (
ATTR_HVAC_MODE,
ClimateEntity,
ClimateEntityFeature,
HVACMode,
Expand Down Expand Up @@ -112,9 +113,12 @@ async def async_turn_off(self) -> None:

async def async_set_temperature(self, **kwargs: Any) -> None:
"""Set the climate temperature."""
temp = kwargs[ATTR_TEMPERATURE]
await self.run(set_temperature, temperature=temp)
self.set(("climate_state_driver_temp_setting", temp))
if mode := kwargs.get(ATTR_HVAC_MODE):
await self.async_set_hvac_mode(mode)

if temp := kwargs.get(ATTR_TEMPERATURE):
await self.run(set_temperature, temperature=temp)
self.set(("climate_state_driver_temp_setting", temp))

async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
"""Set the climate mode and state."""
Expand Down
12 changes: 10 additions & 2 deletions tests/components/tessie/test_climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,22 @@ async def test_climate(
with patch(
"homeassistant.components.tessie.climate.set_temperature",
return_value=TEST_RESPONSE,
) as mock_set:
) as mock_set, patch(
"homeassistant.components.tessie.climate.start_climate_preconditioning",
return_value=TEST_RESPONSE,
) as mock_set2:
await hass.services.async_call(
CLIMATE_DOMAIN,
SERVICE_SET_TEMPERATURE,
{ATTR_ENTITY_ID: [entity_id], ATTR_TEMPERATURE: 20},
{
ATTR_ENTITY_ID: [entity_id],
ATTR_HVAC_MODE: HVACMode.HEAT_COOL,
ATTR_TEMPERATURE: 20,
},
blocking=True,
)
mock_set.assert_called_once()
mock_set2.assert_called_once()
state = hass.states.get(entity_id)
assert state.attributes[ATTR_TEMPERATURE] == 20

Expand Down