Deprecate async_track_state_change in favor of async_track_state_change_event (#115558)

This commit is contained in:
J. Nick Koston 2024-04-18 10:45:14 -05:00 committed by GitHub
parent b18f1ac265
commit d48bd9b016
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 0 deletions

View file

@ -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