Cleanup deprecated async_get_registry in opentherm_gw (#72070)

This commit is contained in:
epenet 2022-05-18 13:47:09 +02:00 committed by GitHub
parent 4e6887515b
commit b9c84bd655
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 9 deletions

View File

@ -23,10 +23,7 @@ from homeassistant.const import (
Platform,
)
from homeassistant.core import HomeAssistant, ServiceCall
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.device_registry import (
async_get_registry as async_get_dev_reg,
)
from homeassistant.helpers import config_validation as cv, device_registry as dr
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.typing import ConfigType
@ -436,7 +433,7 @@ class OpenThermGatewayDevice:
_LOGGER.debug(
"Connected to OpenTherm Gateway %s at %s", self.gw_version, self.device_path
)
dev_reg = await async_get_dev_reg(self.hass)
dev_reg = dr.async_get(self.hass)
gw_dev = dev_reg.async_get_or_create(
config_entry_id=self.config_entry_id,
identifiers={(DOMAIN, self.gw_id)},

View File

@ -6,10 +6,10 @@ from homeassistant.components.binary_sensor import ENTITY_ID_FORMAT, BinarySenso
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_ID
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import entity_registry as er
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import DeviceInfo, async_generate_entity_id
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.entity_registry import async_get_registry
from . import DOMAIN
from .const import (
@ -32,7 +32,7 @@ async def async_setup_entry(
sensors = []
deprecated_sensors = []
gw_dev = hass.data[DATA_OPENTHERM_GW][DATA_GATEWAYS][config_entry.data[CONF_ID]]
ent_reg = await async_get_registry(hass)
ent_reg = er.async_get(hass)
for var, info in BINARY_SENSOR_INFO.items():
device_class = info[0]
friendly_name_format = info[1]

View File

@ -6,10 +6,10 @@ from homeassistant.components.sensor import ENTITY_ID_FORMAT, SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_ID
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import entity_registry as er
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import DeviceInfo, async_generate_entity_id
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.entity_registry import async_get_registry
from . import DOMAIN
from .const import (
@ -32,7 +32,7 @@ async def async_setup_entry(
sensors = []
deprecated_sensors = []
gw_dev = hass.data[DATA_OPENTHERM_GW][DATA_GATEWAYS][config_entry.data[CONF_ID]]
ent_reg = await async_get_registry(hass)
ent_reg = er.async_get(hass)
for var, info in SENSOR_INFO.items():
device_class = info[0]
unit = info[1]