Adjust entity registry access in integrations (2) (#88947)
This commit is contained in:
parent
b3d6f098d2
commit
f69d76702a
20 changed files with 62 additions and 66 deletions
|
@ -6,7 +6,7 @@ import logging
|
|||
from homeassistant.components.sensor import SensorEntity, SensorStateClass
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import device_registry
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
@ -55,11 +55,11 @@ async def async_setup_entry(
|
|||
@callback
|
||||
def async_update_sensors(hass: HomeAssistant, config_entry: ConfigEntry) -> None:
|
||||
"""Add or remove sensors for configured tracked asset pairs."""
|
||||
dev_reg = device_registry.async_get(hass)
|
||||
dev_reg = dr.async_get(hass)
|
||||
|
||||
existing_devices = {
|
||||
device.name: device.id
|
||||
for device in device_registry.async_entries_for_config_entry(
|
||||
for device in dr.async_entries_for_config_entry(
|
||||
dev_reg, config_entry.entry_id
|
||||
)
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ class KrakenSensor(
|
|||
|
||||
self._attr_device_info = DeviceInfo(
|
||||
configuration_url="https://www.kraken.com/",
|
||||
entry_type=device_registry.DeviceEntryType.SERVICE,
|
||||
entry_type=dr.DeviceEntryType.SERVICE,
|
||||
identifiers={(DOMAIN, "_".join(self._device_name.split(" ")))},
|
||||
manufacturer="Kraken.com",
|
||||
name=self._device_name,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue