From 7e6a9495594d882eef6f7bffd4d1f9bb9c38f530 Mon Sep 17 00:00:00 2001 From: Norbert Rittel Date: Sat, 6 Sep 2025 13:00:15 +0200 Subject: [PATCH] Fix exceptions of `climate.set_temperature` action to use friendly names (#151811) --- homeassistant/components/climate/strings.json | 6 +++--- tests/components/climate/test_init.py | 8 ++++---- tests/components/tesla_fleet/test_climate.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/climate/strings.json b/homeassistant/components/climate/strings.json index ad0bccb25ced..a75d327924ac 100644 --- a/homeassistant/components/climate/strings.json +++ b/homeassistant/components/climate/strings.json @@ -274,16 +274,16 @@ "message": "Provided temperature {check_temp} is not valid. Accepted range is {min_temp} to {max_temp}." }, "low_temp_higher_than_high_temp": { - "message": "Target temperature low can not be higher than Target temperature high." + "message": "'Lower target temperature' can not be higher than 'Upper target temperature'." }, "humidity_out_of_range": { "message": "Provided humidity {humidity} is not valid. Accepted range is {min_humidity} to {max_humidity}." }, "missing_target_temperature_entity_feature": { - "message": "Set temperature action was used with the target temperature parameter but the entity does not support it." + "message": "Set temperature action was used with the 'Target temperature' parameter but the entity does not support it." }, "missing_target_temperature_range_entity_feature": { - "message": "Set temperature action was used with the target temperature low/high parameter but the entity does not support it." + "message": "Set temperature action was used with the 'Lower/Upper target temperature' parameter but the entity does not support it." } } } diff --git a/tests/components/climate/test_init.py b/tests/components/climate/test_init.py index 06bd9c0c096a..fd53b29e1407 100644 --- a/tests/components/climate/test_init.py +++ b/tests/components/climate/test_init.py @@ -232,7 +232,7 @@ async def test_temperature_features_is_valid( with pytest.raises( ServiceValidationError, - match="Set temperature action was used with the target temperature parameter but the entity does not support it", + match="Set temperature action was used with the 'Target temperature' parameter but the entity does not support it", ): await hass.services.async_call( DOMAIN, @@ -246,7 +246,7 @@ async def test_temperature_features_is_valid( with pytest.raises( ServiceValidationError, - match="Set temperature action was used with the target temperature low/high parameter but the entity does not support it", + match="Set temperature action was used with the 'Lower/Upper target temperature' parameter but the entity does not support it", ): await hass.services.async_call( DOMAIN, @@ -702,7 +702,7 @@ async def test_target_temp_high_higher_than_low( with pytest.raises( ServiceValidationError, - match="Target temperature low can not be higher than Target temperature high", + match="'Lower target temperature' can not be higher than 'Upper target temperature'", ) as exc: await hass.services.async_call( DOMAIN, @@ -716,6 +716,6 @@ async def test_target_temp_high_higher_than_low( ) assert ( str(exc.value) - == "Target temperature low can not be higher than Target temperature high" + == "'Lower target temperature' can not be higher than 'Upper target temperature'" ) assert exc.value.translation_key == "low_temp_higher_than_high_temp" diff --git a/tests/components/tesla_fleet/test_climate.py b/tests/components/tesla_fleet/test_climate.py index 6f700f7e9396..49d9f48a8418 100644 --- a/tests/components/tesla_fleet/test_climate.py +++ b/tests/components/tesla_fleet/test_climate.py @@ -445,7 +445,7 @@ async def test_climate_notemp( with pytest.raises( ServiceValidationError, - match="Set temperature action was used with the target temperature low/high parameter but the entity does not support it", + match="Set temperature action was used with the 'Lower/Upper target temperature' parameter but the entity does not support it", ): await hass.services.async_call( CLIMATE_DOMAIN,