Warn on use of deprecated async_get_registry (#72088)

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
epenet 2022-05-18 21:04:06 +02:00 committed by GitHub
parent 349347cade
commit 99941b1c32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View file

@ -12,6 +12,7 @@ from homeassistant.loader import bind_hass
from homeassistant.util import slugify
from . import device_registry as dr, entity_registry as er
from .frame import report
from .storage import Store
from .typing import UNDEFINED, UndefinedType
@ -226,6 +227,9 @@ async def async_get_registry(hass: HomeAssistant) -> AreaRegistry:
This is deprecated and will be removed in the future. Use async_get instead.
"""
report(
"uses deprecated `async_get_registry` to access area registry, use async_get instead"
)
return async_get(hass)

View file

@ -720,6 +720,9 @@ async def async_get_registry(hass: HomeAssistant) -> DeviceRegistry:
This is deprecated and will be removed in the future. Use async_get instead.
"""
report(
"uses deprecated `async_get_registry` to access device registry, use async_get instead"
)
return async_get(hass)

View file

@ -45,6 +45,7 @@ from homeassistant.util.yaml import load_yaml
from . import device_registry as dr, storage
from .device_registry import EVENT_DEVICE_REGISTRY_UPDATED
from .frame import report
from .typing import UNDEFINED, UndefinedType
if TYPE_CHECKING:
@ -819,6 +820,9 @@ async def async_get_registry(hass: HomeAssistant) -> EntityRegistry:
This is deprecated and will be removed in the future. Use async_get instead.
"""
report(
"uses deprecated `async_get_registry` to access entity registry, use async_get instead"
)
return async_get(hass)