mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 04:07:08 +00:00
Cleanup deprecated async_get_registry in opentherm_gw (#72070)
This commit is contained in:
parent
4e6887515b
commit
b9c84bd655
@ -23,10 +23,7 @@ from homeassistant.const import (
|
|||||||
Platform,
|
Platform,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, ServiceCall
|
from homeassistant.core import HomeAssistant, ServiceCall
|
||||||
import homeassistant.helpers.config_validation as cv
|
from homeassistant.helpers import config_validation as cv, device_registry as dr
|
||||||
from homeassistant.helpers.device_registry import (
|
|
||||||
async_get_registry as async_get_dev_reg,
|
|
||||||
)
|
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
@ -436,7 +433,7 @@ class OpenThermGatewayDevice:
|
|||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Connected to OpenTherm Gateway %s at %s", self.gw_version, self.device_path
|
"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(
|
gw_dev = dev_reg.async_get_or_create(
|
||||||
config_entry_id=self.config_entry_id,
|
config_entry_id=self.config_entry_id,
|
||||||
identifiers={(DOMAIN, self.gw_id)},
|
identifiers={(DOMAIN, self.gw_id)},
|
||||||
|
@ -6,10 +6,10 @@ from homeassistant.components.binary_sensor import ENTITY_ID_FORMAT, BinarySenso
|
|||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_ID
|
from homeassistant.const import CONF_ID
|
||||||
from homeassistant.core import HomeAssistant, callback
|
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.dispatcher import async_dispatcher_connect
|
||||||
from homeassistant.helpers.entity import DeviceInfo, async_generate_entity_id
|
from homeassistant.helpers.entity import DeviceInfo, async_generate_entity_id
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.entity_registry import async_get_registry
|
|
||||||
|
|
||||||
from . import DOMAIN
|
from . import DOMAIN
|
||||||
from .const import (
|
from .const import (
|
||||||
@ -32,7 +32,7 @@ async def async_setup_entry(
|
|||||||
sensors = []
|
sensors = []
|
||||||
deprecated_sensors = []
|
deprecated_sensors = []
|
||||||
gw_dev = hass.data[DATA_OPENTHERM_GW][DATA_GATEWAYS][config_entry.data[CONF_ID]]
|
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():
|
for var, info in BINARY_SENSOR_INFO.items():
|
||||||
device_class = info[0]
|
device_class = info[0]
|
||||||
friendly_name_format = info[1]
|
friendly_name_format = info[1]
|
||||||
|
@ -6,10 +6,10 @@ from homeassistant.components.sensor import ENTITY_ID_FORMAT, SensorEntity
|
|||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_ID
|
from homeassistant.const import CONF_ID
|
||||||
from homeassistant.core import HomeAssistant, callback
|
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.dispatcher import async_dispatcher_connect
|
||||||
from homeassistant.helpers.entity import DeviceInfo, async_generate_entity_id
|
from homeassistant.helpers.entity import DeviceInfo, async_generate_entity_id
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.entity_registry import async_get_registry
|
|
||||||
|
|
||||||
from . import DOMAIN
|
from . import DOMAIN
|
||||||
from .const import (
|
from .const import (
|
||||||
@ -32,7 +32,7 @@ async def async_setup_entry(
|
|||||||
sensors = []
|
sensors = []
|
||||||
deprecated_sensors = []
|
deprecated_sensors = []
|
||||||
gw_dev = hass.data[DATA_OPENTHERM_GW][DATA_GATEWAYS][config_entry.data[CONF_ID]]
|
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():
|
for var, info in SENSOR_INFO.items():
|
||||||
device_class = info[0]
|
device_class = info[0]
|
||||||
unit = info[1]
|
unit = info[1]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user