Deprecate async_track_state_change in favor of async_track_state_change_event (#115558)
This commit is contained in:
parent
b18f1ac265
commit
d48bd9b016
2 changed files with 24 additions and 0 deletions
|
@ -4804,3 +4804,18 @@ async def test_async_track_device_registry_updated_event_with_a_callback_that_th
|
|||
unsub2()
|
||||
|
||||
assert event_data[0] == {"action": "create", "device_id": device_id}
|
||||
|
||||
|
||||
async def test_track_state_change_deprecated(
|
||||
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
|
||||
) -> None:
|
||||
"""Test track_state_change is deprecated."""
|
||||
async_track_state_change(
|
||||
hass, "light.Bowl", lambda entity_id, old_state, new_state: None, "on", "off"
|
||||
)
|
||||
|
||||
assert (
|
||||
"Detected code that calls `async_track_state_change` instead "
|
||||
"of `async_track_state_change_event` which is deprecated and "
|
||||
"will be removed in Home Assistant 2025.5. Please report this issue."
|
||||
) in caplog.text
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue