mirror of
https://github.com/home-assistant/core.git
synced 2026-08-24 10:13:52 -05:00
Adapt ping to new device registry API (#176950)
This commit is contained in:
@@ -29,10 +29,10 @@ async def async_migrate_entry(hass: HomeAssistant, entry: PingConfigEntry) -> bo
|
||||
# Migrate device registry identifiers from homeassistant domain to ping domain
|
||||
registry = dr.async_get(hass)
|
||||
if (
|
||||
device := registry.async_get_device(
|
||||
identifiers={(HOMEASSISTANT_DOMAIN, entry.entry_id)}
|
||||
device := registry.async_get_device_by_identifier(
|
||||
(HOMEASSISTANT_DOMAIN, entry.entry_id), entry.entry_id
|
||||
)
|
||||
) is not None and entry.entry_id in device.config_entries:
|
||||
) is not None:
|
||||
registry.async_update_device(
|
||||
device_id=device.id,
|
||||
new_identifiers={(DOMAIN, entry.entry_id)},
|
||||
|
||||
@@ -50,8 +50,8 @@ class PingDeviceTracker(CoordinatorEntity[PingUpdateCoordinator], ScannerEntity)
|
||||
)
|
||||
|
||||
if (
|
||||
device := dr.async_get(hass).async_get_device(
|
||||
identifiers={(DOMAIN, config_entry.entry_id)}
|
||||
device := dr.async_get(hass).async_get_device_by_identifier(
|
||||
(DOMAIN, config_entry.entry_id), config_entry.entry_id
|
||||
)
|
||||
) is not None:
|
||||
self.device_entry = device
|
||||
|
||||
Reference in New Issue
Block a user