Show the configured-unit temperature and range in the climate out-of-range (#190955)

This commit is contained in:
Øyvind Matheson Wergeland
2026-11-07 21:46:03 +08:00
committed by GitHub
parent 075874e64f
commit b367e87edc
2 changed files with 23 additions and 6 deletions
+13 -6
View File
@@ -144,15 +144,22 @@ async def _async_service_temperature_set(
)
_LOGGER.debug(
"Check valid temperature %d %s (%d %s) in range %d %s - %d %s",
(
"Check valid temperature %g %s in range %g %s - %g %s"
" (%g %s in range %g %s - %g %s)"
),
check_temp,
temp_unit,
temp,
hass.config.units.temperature_unit,
min_temp,
temp_unit,
max_temp,
temp_unit,
temp,
hass.config.units.temperature_unit,
shown_min_temp,
hass.config.units.temperature_unit,
shown_max_temp,
hass.config.units.temperature_unit,
)
if (check_temp < min_temp and temp < shown_min_temp) or (
check_temp > max_temp and temp > shown_max_temp
@@ -161,9 +168,9 @@ async def _async_service_temperature_set(
translation_domain=DOMAIN,
translation_key="temp_out_of_range",
translation_placeholders={
"check_temp": str(check_temp),
"min_temp": str(min_temp),
"max_temp": str(max_temp),
"check_temp": str(temp),
"min_temp": str(shown_min_temp),
"max_temp": str(shown_max_temp),
},
)
kwargs[value] = min(max(check_temp, min_temp), max_temp)
+10
View File
@@ -777,6 +777,11 @@ async def test_temperature_validation_display_rounding(
blocking=True,
)
assert exc.value.translation_key == "temp_out_of_range"
assert exc.value.translation_placeholders == {
"check_temp": str(temperature),
"min_temp": "16",
"max_temp": "32",
}
assert test_climate.native_target_temperature == 89.5
# 62 °F is 16.7 °C, shown as 17 °C. Temperatures between the native and the
@@ -804,6 +809,11 @@ async def test_temperature_validation_display_rounding(
blocking=True,
)
assert exc.value.translation_key == "temp_out_of_range"
assert exc.value.translation_placeholders == {
"check_temp": "16.5",
"min_temp": "17",
"max_temp": "32",
}
async def test_target_temp_high_higher_than_low(