Cleanup deprecated async_get_registry in homekit_controller (#72069)

This commit is contained in:
epenet 2022-05-18 14:21:56 +02:00 committed by GitHub
parent 70aa71eeed
commit 4978d5f86e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,10 +14,7 @@ from homeassistant import config_entries
from homeassistant.components import zeroconf from homeassistant.components import zeroconf
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.data_entry_flow import AbortFlow, FlowResult from homeassistant.data_entry_flow import AbortFlow, FlowResult
from homeassistant.helpers.device_registry import ( from homeassistant.helpers import device_registry as dr
CONNECTION_NETWORK_MAC,
async_get_registry as async_get_device_registry,
)
from .const import DOMAIN, KNOWN_DEVICES from .const import DOMAIN, KNOWN_DEVICES
from .utils import async_get_controller from .utils import async_get_controller
@ -163,9 +160,9 @@ class HomekitControllerFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
async def _hkid_is_homekit(self, hkid): async def _hkid_is_homekit(self, hkid):
"""Determine if the device is a homekit bridge or accessory.""" """Determine if the device is a homekit bridge or accessory."""
dev_reg = await async_get_device_registry(self.hass) dev_reg = dr.async_get(self.hass)
device = dev_reg.async_get_device( device = dev_reg.async_get_device(
identifiers=set(), connections={(CONNECTION_NETWORK_MAC, hkid)} identifiers=set(), connections={(dr.CONNECTION_NETWORK_MAC, hkid)}
) )
if device is None: if device is None: