mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Deprecate async_track_state_change in favor of async_track_state_change_event (#115558)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user