mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Improve logging message for validation in climate (#125837)
This commit is contained in:
parent
d530fd31b0
commit
d259e4512b
@ -713,7 +713,7 @@ class ClimateEntity(Entity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
|||||||
(
|
(
|
||||||
"%s::%s sets the hvac_mode %s which is not "
|
"%s::%s sets the hvac_mode %s which is not "
|
||||||
"valid for this entity with modes: %s. "
|
"valid for this entity with modes: %s. "
|
||||||
"This will stop working in 2025.3 and raise an error instead. "
|
"This will stop working in 2025.4 and raise an error instead. "
|
||||||
"Please %s"
|
"Please %s"
|
||||||
),
|
),
|
||||||
self.platform.platform_name,
|
self.platform.platform_name,
|
||||||
@ -937,6 +937,8 @@ async def async_service_temperature_set(
|
|||||||
ATTR_TEMPERATURE in service_call.data
|
ATTR_TEMPERATURE in service_call.data
|
||||||
and not entity.supported_features & ClimateEntityFeature.TARGET_TEMPERATURE
|
and not entity.supported_features & ClimateEntityFeature.TARGET_TEMPERATURE
|
||||||
):
|
):
|
||||||
|
# Warning implemented in 2024.10 and will be changed to raising
|
||||||
|
# a ServiceValidationError in 2025.4
|
||||||
report_issue = async_suggest_report_issue(
|
report_issue = async_suggest_report_issue(
|
||||||
entity.hass,
|
entity.hass,
|
||||||
integration_domain=entity.platform.platform_name,
|
integration_domain=entity.platform.platform_name,
|
||||||
@ -945,7 +947,9 @@ async def async_service_temperature_set(
|
|||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
(
|
(
|
||||||
"%s::%s set_temperature action was used with temperature but the entity does not "
|
"%s::%s set_temperature action was used with temperature but the entity does not "
|
||||||
"implement the ClimateEntityFeature.TARGET_TEMPERATURE feature. Please %s"
|
"implement the ClimateEntityFeature.TARGET_TEMPERATURE feature. "
|
||||||
|
"This will stop working in 2025.4 and raise an error instead. "
|
||||||
|
"Please %s"
|
||||||
),
|
),
|
||||||
entity.platform.platform_name,
|
entity.platform.platform_name,
|
||||||
entity.__class__.__name__,
|
entity.__class__.__name__,
|
||||||
@ -956,6 +960,8 @@ async def async_service_temperature_set(
|
|||||||
and not entity.supported_features
|
and not entity.supported_features
|
||||||
& ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
|
& ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
|
||||||
):
|
):
|
||||||
|
# Warning implemented in 2024.10 and will be changed to raising
|
||||||
|
# a ServiceValidationError in 2025.4
|
||||||
report_issue = async_suggest_report_issue(
|
report_issue = async_suggest_report_issue(
|
||||||
entity.hass,
|
entity.hass,
|
||||||
integration_domain=entity.platform.platform_name,
|
integration_domain=entity.platform.platform_name,
|
||||||
@ -964,7 +970,9 @@ async def async_service_temperature_set(
|
|||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
(
|
(
|
||||||
"%s::%s set_temperature action was used with target_temp_low but the entity does not "
|
"%s::%s set_temperature action was used with target_temp_low but the entity does not "
|
||||||
"implement the ClimateEntityFeature.TARGET_TEMPERATURE_RANGE feature. Please %s"
|
"implement the ClimateEntityFeature.TARGET_TEMPERATURE_RANGE feature. "
|
||||||
|
"This will stop working in 2025.4 and raise an error instead. "
|
||||||
|
"Please %s"
|
||||||
),
|
),
|
||||||
entity.platform.platform_name,
|
entity.platform.platform_name,
|
||||||
entity.__class__.__name__,
|
entity.__class__.__name__,
|
||||||
|
@ -300,7 +300,9 @@ async def test_temperature_features_is_valid(
|
|||||||
assert (
|
assert (
|
||||||
"MockClimateTempEntity set_temperature action was used "
|
"MockClimateTempEntity set_temperature action was used "
|
||||||
"with temperature but the entity does not "
|
"with temperature but the entity does not "
|
||||||
"implement the ClimateEntityFeature.TARGET_TEMPERATURE feature. Please"
|
"implement the ClimateEntityFeature.TARGET_TEMPERATURE feature. "
|
||||||
|
"This will stop working in 2025.4 and raise an error instead. "
|
||||||
|
"Please"
|
||||||
) in caplog.text
|
) in caplog.text
|
||||||
|
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
@ -316,7 +318,9 @@ async def test_temperature_features_is_valid(
|
|||||||
assert (
|
assert (
|
||||||
"MockClimateTempRangeEntity set_temperature action was used with "
|
"MockClimateTempRangeEntity set_temperature action was used with "
|
||||||
"target_temp_low but the entity does not "
|
"target_temp_low but the entity does not "
|
||||||
"implement the ClimateEntityFeature.TARGET_TEMPERATURE_RANGE feature. Please"
|
"implement the ClimateEntityFeature.TARGET_TEMPERATURE_RANGE feature. "
|
||||||
|
"This will stop working in 2025.4 and raise an error instead. "
|
||||||
|
"Please"
|
||||||
) in caplog.text
|
) in caplog.text
|
||||||
|
|
||||||
|
|
||||||
@ -385,7 +389,8 @@ async def test_mode_validation(
|
|||||||
assert (
|
assert (
|
||||||
"MockClimateEntity sets the hvac_mode auto which is not valid "
|
"MockClimateEntity sets the hvac_mode auto which is not valid "
|
||||||
"for this entity with modes: off, heat. This will stop working "
|
"for this entity with modes: off, heat. This will stop working "
|
||||||
"in 2025.3 and raise an error instead. Please" in caplog.text
|
"in 2025.4 and raise an error instead. "
|
||||||
|
"Please" in caplog.text
|
||||||
)
|
)
|
||||||
|
|
||||||
with pytest.raises(
|
with pytest.raises(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user