mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Revert "Add device info to edl21" (#89217)
This commit is contained in:
parent
fc673139cd
commit
c7b30b61de
@ -32,7 +32,6 @@ from homeassistant.helpers.dispatcher import (
|
||||
async_dispatcher_connect,
|
||||
async_dispatcher_send,
|
||||
)
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
@ -284,7 +283,7 @@ async def async_setup_platform(
|
||||
hass,
|
||||
DOMAIN,
|
||||
"deprecated_yaml",
|
||||
breaks_in_ha_version="2023.5.0",
|
||||
breaks_in_ha_version="2023.2.0",
|
||||
is_fixable=False,
|
||||
severity=IssueSeverity.WARNING,
|
||||
translation_key="deprecated_yaml",
|
||||
@ -398,7 +397,7 @@ class EDL21:
|
||||
old_entity_id = registry.async_get_entity_id(
|
||||
"sensor", DOMAIN, entity.old_unique_id
|
||||
)
|
||||
if old_entity_id is not None and entity.unique_id is not None:
|
||||
if old_entity_id is not None:
|
||||
LOGGER.debug(
|
||||
"Migrating unique_id from [%s] to [%s]",
|
||||
entity.old_unique_id,
|
||||
@ -423,6 +422,8 @@ class EDL21Entity(SensorEntity):
|
||||
"""Initialize an EDL21Entity."""
|
||||
self._electricity_id = electricity_id
|
||||
self._obis = obis
|
||||
self._name = name
|
||||
self._unique_id = f"{electricity_id}_{obis}"
|
||||
self._telegram = telegram
|
||||
self._min_time = MIN_TIME_BETWEEN_UPDATES
|
||||
self._last_update = utcnow()
|
||||
@ -434,12 +435,6 @@ class EDL21Entity(SensorEntity):
|
||||
}
|
||||
self._async_remove_dispatcher = None
|
||||
self.entity_description = entity_description
|
||||
self._attr_name = name
|
||||
self._attr_unique_id = f"{electricity_id}_{obis}"
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, self._electricity_id)},
|
||||
name=self._electricity_id,
|
||||
)
|
||||
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Run when entity about to be added to hass."""
|
||||
@ -471,11 +466,21 @@ class EDL21Entity(SensorEntity):
|
||||
if self._async_remove_dispatcher:
|
||||
self._async_remove_dispatcher()
|
||||
|
||||
@property
|
||||
def unique_id(self) -> str:
|
||||
"""Return a unique ID."""
|
||||
return self._unique_id
|
||||
|
||||
@property
|
||||
def old_unique_id(self) -> str:
|
||||
"""Return a less unique ID as used in the first version of edl21."""
|
||||
return self._obis
|
||||
|
||||
@property
|
||||
def name(self) -> str | None:
|
||||
"""Return a name."""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def native_value(self) -> str:
|
||||
"""Return the value of the last received telegram."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user