From 99941b1c32262f5bdeb5b9a7dce10d176c9e6f8f Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 18 May 2022 21:04:06 +0200 Subject: [PATCH] Warn on use of deprecated async_get_registry (#72088) Co-authored-by: Paulus Schoutsen --- homeassistant/helpers/area_registry.py | 4 ++++ homeassistant/helpers/device_registry.py | 3 +++ homeassistant/helpers/entity_registry.py | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/homeassistant/helpers/area_registry.py b/homeassistant/helpers/area_registry.py index ad4930825c8..e5d35ccbf44 100644 --- a/homeassistant/helpers/area_registry.py +++ b/homeassistant/helpers/area_registry.py @@ -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) diff --git a/homeassistant/helpers/device_registry.py b/homeassistant/helpers/device_registry.py index 901242607e3..ed3d5a7b06f 100644 --- a/homeassistant/helpers/device_registry.py +++ b/homeassistant/helpers/device_registry.py @@ -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) diff --git a/homeassistant/helpers/entity_registry.py b/homeassistant/helpers/entity_registry.py index 2c87c4cbdd2..d03d272b1ac 100644 --- a/homeassistant/helpers/entity_registry.py +++ b/homeassistant/helpers/entity_registry.py @@ -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)