1
0
mirror of https://github.com/home-assistant/core.git synced 2026-04-02 00:20:30 +01:00

Let EntityRegistry handle id creation

This commit is contained in:
farmio
2026-03-22 14:57:33 +01:00
parent 6ab8f9e8b0
commit a6a56c267a

View File

@@ -8,7 +8,7 @@ from xknx.devices import Device as XknxDevice
from homeassistant.const import CONF_ENTITY_CATEGORY, CONF_NAME, EntityCategory
from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.helpers.entity import Entity, async_generate_entity_id
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.entity_platform import EntityPlatform
from homeassistant.helpers.entity_registry import RegistryEntry
@@ -110,12 +110,8 @@ class KnxYamlEntity(_KnxEntityBase):
self._attr_entity_category = entity_config.get(CONF_ENTITY_CATEGORY)
default_entity_id: str | None
if (default_entity_id := entity_config.get(CONF_DEFAULT_ENTITY_ID)) is None:
return
entity_platform, _, object_id = default_entity_id.partition(".")
self.entity_id = async_generate_entity_id(
f"{entity_platform}.{{}}", object_id, hass=knx_module.hass
)
if (default_entity_id := entity_config.get(CONF_DEFAULT_ENTITY_ID)) is not None:
self.entity_id = default_entity_id
class KnxUiEntity(_KnxEntityBase):