From c222feda1aa198dca048b316f4ed3480695573b5 Mon Sep 17 00:00:00 2001 From: Jean-Marc Collin Date: Mon, 1 Jan 2024 16:55:41 +0000 Subject: [PATCH] Issue #295 - No floating point value for target temp --- custom_components/versatile_thermostat/underlyings.py | 2 +- tests/test_bugs.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/custom_components/versatile_thermostat/underlyings.py b/custom_components/versatile_thermostat/underlyings.py index 75cf83e..ec2bb92 100644 --- a/custom_components/versatile_thermostat/underlyings.py +++ b/custom_components/versatile_thermostat/underlyings.py @@ -690,7 +690,7 @@ class UnderlyingClimate(UnderlyingEntity): min_val = self._underlying_climate.min_temp max_val = self._underlying_climate.max_temp - new_value = round(max(min_val, min(value, max_val))) + new_value = max(min_val, min(value, max_val)) else: _LOGGER.debug("%s - no min and max attributes on underlying", self) new_value = value diff --git a/tests/test_bugs.py b/tests/test_bugs.py index 7be51ad..376291c 100644 --- a/tests/test_bugs.py +++ b/tests/test_bugs.py @@ -632,7 +632,7 @@ async def test_bug_272( await entity.async_set_hvac_mode(HVACMode.HEAT) # In the accepted interval - await entity.async_set_temperature(temperature=17) + await entity.async_set_temperature(temperature=17.5) assert mock_service_call.call_count == 2 mock_service_call.assert_has_calls( [ @@ -646,7 +646,7 @@ async def test_bug_272( SERVICE_SET_TEMPERATURE, { "entity_id": "climate.mock_climate", - "temperature": 17, + "temperature": 17.5, "target_temp_high": 30, "target_temp_low": 15, }, @@ -666,7 +666,7 @@ async def test_bug_272( await send_temperature_change_event(entity, 13, event_timestamp) await send_ext_temperature_change_event(entity, 9, event_timestamp) - # In the accepted interval + # Not in the accepted interval (15-19) await entity.async_set_temperature(temperature=10) assert mock_service_call.call_count == 1 mock_service_call.assert_has_calls( @@ -694,7 +694,7 @@ async def test_bug_272( await send_ext_temperature_change_event(entity, 9, event_timestamp) # In the accepted interval - await entity.async_set_temperature(temperature=20) + await entity.async_set_temperature(temperature=20.8) assert mock_service_call.call_count == 1 mock_service_call.assert_has_calls( [