Clarify light reproduce state deprecation warning (#33531)
This commit is contained in:
parent
457d439e24
commit
1d2713b0ea
2 changed files with 8 additions and 4 deletions
|
@ -64,7 +64,10 @@ DEPRECATED_GROUP = [
|
|||
ATTR_TRANSITION,
|
||||
]
|
||||
|
||||
DEPRECATION_WARNING = "The use of other attributes than device state attributes is deprecated and will be removed in a future release. Read the logs for further details: https://www.home-assistant.io/integrations/scene/"
|
||||
DEPRECATION_WARNING = (
|
||||
"The use of other attributes than device state attributes is deprecated and will be removed in a future release. "
|
||||
"Invalid attributes are %s. Read the logs for further details: https://www.home-assistant.io/integrations/scene/"
|
||||
)
|
||||
|
||||
|
||||
async def _async_reproduce_state(
|
||||
|
@ -84,8 +87,9 @@ async def _async_reproduce_state(
|
|||
return
|
||||
|
||||
# Warn if deprecated attributes are used
|
||||
if any(attr in DEPRECATED_GROUP for attr in state.attributes):
|
||||
_LOGGER.warning(DEPRECATION_WARNING)
|
||||
deprecated_attrs = [attr for attr in state.attributes if attr in DEPRECATED_GROUP]
|
||||
if deprecated_attrs:
|
||||
_LOGGER.warning(DEPRECATION_WARNING, deprecated_attrs)
|
||||
|
||||
# Return if we are already at the right state.
|
||||
if cur_state.state == state.state and all(
|
||||
|
|
|
@ -166,4 +166,4 @@ async def test_deprecation_warning(hass, caplog):
|
|||
[State("light.entity_off", "on", {"brightness_pct": 80})], blocking=True
|
||||
)
|
||||
assert len(turn_on_calls) == 1
|
||||
assert DEPRECATION_WARNING in caplog.text
|
||||
assert DEPRECATION_WARNING % ["brightness_pct"] in caplog.text
|
||||
|
|
Loading…
Add table
Reference in a new issue