mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
Clarify light reproduce state deprecation warning (#33531)
This commit is contained in:
parent
457d439e24
commit
1d2713b0ea
@ -64,7 +64,10 @@ DEPRECATED_GROUP = [
|
|||||||
ATTR_TRANSITION,
|
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(
|
async def _async_reproduce_state(
|
||||||
@ -84,8 +87,9 @@ async def _async_reproduce_state(
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Warn if deprecated attributes are used
|
# Warn if deprecated attributes are used
|
||||||
if any(attr in DEPRECATED_GROUP for attr in state.attributes):
|
deprecated_attrs = [attr for attr in state.attributes if attr in DEPRECATED_GROUP]
|
||||||
_LOGGER.warning(DEPRECATION_WARNING)
|
if deprecated_attrs:
|
||||||
|
_LOGGER.warning(DEPRECATION_WARNING, deprecated_attrs)
|
||||||
|
|
||||||
# Return if we are already at the right state.
|
# Return if we are already at the right state.
|
||||||
if cur_state.state == state.state and all(
|
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
|
[State("light.entity_off", "on", {"brightness_pct": 80})], blocking=True
|
||||||
)
|
)
|
||||||
assert len(turn_on_calls) == 1
|
assert len(turn_on_calls) == 1
|
||||||
assert DEPRECATION_WARNING in caplog.text
|
assert DEPRECATION_WARNING % ["brightness_pct"] in caplog.text
|
||||||
|
Loading…
x
Reference in New Issue
Block a user