Compare commits

...

1 Commits

Author SHA1 Message Date
Jean-Marc Collin
9b26d40cec Issue #683 - Window action Anti frost doesnt restore the previous temp 2024-12-08 18:43:05 +00:00
3 changed files with 9 additions and 5 deletions

View File

@@ -1329,8 +1329,8 @@ class BaseThermostat(ClimateEntity, RestoreEntity, Generic[T]):
self._attr_preset_mode = PRESET_ACTIVITY
await self._async_update_motion_temp()
else:
if self._attr_preset_mode == PRESET_NONE:
self._saved_target_temp = self._target_temp
# if self._attr_preset_mode == PRESET_NONE:
# self._saved_target_temp = self._target_temp
self._attr_preset_mode = preset_mode
await self._async_internal_set_temperature(
self.find_preset_temp(preset_mode)

View File

@@ -19,7 +19,7 @@ logging.getLogger().setLevel(logging.DEBUG)
# @pytest.mark.parametrize("expected_lingering_tasks", [True])
# @pytest.mark.parametrize("expected_lingering_timers", [True])
@pytest.mark.parametrize("expected_lingering_timers", [True])
# this test fails if run in // with the next because the underlying_valve_regulation is mixed. Don't know why
# @pytest.mark.skip
async def test_over_climate_valve_mono(hass: HomeAssistant, skip_hass_states_get):

View File

@@ -1802,7 +1802,7 @@ async def test_window_action_frost_temp(hass: HomeAssistant, skip_hass_states_is
event_timestamp = event_timestamp + timedelta(minutes=1)
await send_temperature_change_event(entity, 19, event_timestamp)
# 2. Make the temperature down
# 2. Make the temperature down -> no change
with patch(
"custom_components.versatile_thermostat.base_thermostat.BaseThermostat.send_event"
) as mock_send_event, patch(
@@ -1824,7 +1824,7 @@ async def test_window_action_frost_temp(hass: HomeAssistant, skip_hass_states_is
assert entity.window_state is STATE_OFF
assert entity.window_auto_state is STATE_OFF
# 3. send one degre down in one minute
# 3. send one degre down in one minute -> window is on
with patch(
"custom_components.versatile_thermostat.base_thermostat.BaseThermostat.send_event"
) as mock_send_event, patch(
@@ -1852,6 +1852,8 @@ async def test_window_action_frost_temp(hass: HomeAssistant, skip_hass_states_is
assert entity.preset_mode is PRESET_BOOST
# The eco temp
assert entity.target_temperature == 10
# The last temp is saved
assert entity._saved_target_temp == 21
mock_send_event.assert_has_calls(
[
@@ -1889,6 +1891,7 @@ async def test_window_action_frost_temp(hass: HomeAssistant, skip_hass_states_is
assert entity.preset_mode is PRESET_BOOST
# The eco temp
assert entity.target_temperature == 10
assert entity._saved_target_temp == 21
# 5. send another plus 1.1 degre in one minute -> restore state
with patch(
@@ -1929,6 +1932,7 @@ async def test_window_action_frost_temp(hass: HomeAssistant, skip_hass_states_is
assert entity.preset_mode is PRESET_BOOST
# The eco temp
assert entity.target_temperature == 21
assert entity._saved_target_temp == 21
# Clean the entity
entity.remove_thermostat()