Cleanup deprecated async_get_registry in xbox (#72079)
This commit is contained in:
parent
8b5803735f
commit
8492f282cb
2 changed files with 4 additions and 8 deletions
|
@ -6,10 +6,8 @@ from functools import partial
|
|||
from homeassistant.components.binary_sensor import BinarySensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.entity_registry import (
|
||||
async_get_registry as async_get_entity_registry,
|
||||
)
|
||||
|
||||
from . import XboxUpdateCoordinator
|
||||
from .base_sensor import XboxBaseSensorEntity
|
||||
|
@ -80,7 +78,7 @@ async def async_remove_entities(
|
|||
current: dict[str, XboxBinarySensorEntity],
|
||||
) -> None:
|
||||
"""Remove friend sensors from Home Assistant."""
|
||||
registry = await async_get_entity_registry(coordinator.hass)
|
||||
registry = er.async_get(coordinator.hass)
|
||||
entities = current[xuid]
|
||||
for entity in entities:
|
||||
if entity.entity_id in registry.entities:
|
||||
|
|
|
@ -6,10 +6,8 @@ from functools import partial
|
|||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.entity_registry import (
|
||||
async_get_registry as async_get_entity_registry,
|
||||
)
|
||||
|
||||
from . import XboxUpdateCoordinator
|
||||
from .base_sensor import XboxBaseSensorEntity
|
||||
|
@ -82,7 +80,7 @@ async def async_remove_entities(
|
|||
current: dict[str, XboxSensorEntity],
|
||||
) -> None:
|
||||
"""Remove friend sensors from Home Assistant."""
|
||||
registry = await async_get_entity_registry(coordinator.hass)
|
||||
registry = er.async_get(coordinator.hass)
|
||||
entities = current[xuid]
|
||||
for entity in entities:
|
||||
if entity.entity_id in registry.entities:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue