Clean up accessing device_registry helpers via hass (#72031)

This commit is contained in:
Franck Nijhof 2022-05-17 21:22:15 +02:00 committed by GitHub
parent 69e622b327
commit c3d19f3827
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 105 additions and 87 deletions

View file

@ -11,8 +11,7 @@ from homeassistant.components.kraken.const import (
DOMAIN,
)
from homeassistant.const import CONF_SCAN_INTERVAL, EVENT_HOMEASSISTANT_START
from homeassistant.helpers import entity_registry as er
from homeassistant.helpers.device_registry import DeviceEntryType
from homeassistant.helpers import device_registry as dr, entity_registry as er
import homeassistant.util.dt as dt_util
from .const import (
@ -249,13 +248,13 @@ async def test_sensors_available_after_restart(hass):
},
)
device_registry = await hass.helpers.device_registry.async_get_registry()
device_registry = dr.async_get(hass)
device_registry.async_get_or_create(
config_entry_id=entry.entry_id,
identifiers={(DOMAIN, "XBT_USD")},
name="XBT USD",
manufacturer="Kraken.com",
entry_type=DeviceEntryType.SERVICE,
entry_type=dr.DeviceEntryType.SERVICE,
)
entry.add_to_hass(hass)