Hi, I developed integration for system based on proprietary bus driven by PLC. I have connected plenty of switches, thermometers, light atd. All this stuff is entities added in component’s async_setup_platform(). It works well with exception that device_info, which is intended PLC info is not displayed and device list remains empty.
The reason is missing config entry id. Following patch reveals device list as intended. I have dozens of components in generated configuration.yaml and really do now want configure it manually. And also when updated I don’t want to be copies to config_entries repository.
--- a/homeassistant/helpers/entity_platform.py
+++ b/homeassistant/helpers/entity_platform.py
@@ -344,7 +344,8 @@ class EntityPlatform:
device_info = entity.device_info
device_id = None
- if config_entry_id is not None and device_info is not None:
+ # if config_entry_id is not None and device_info is not None:
+ if device_info is not None:
processed_dev_info = {"config_entry_id": config_entry_id}
for key in (
or optionally
+ if config_entry_id is None and device_info is not None:
+ config_entry_id = "CONFIGURATION"
I tried to follow e.g. demo component to raise async_setup_entry().
async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
if not hass.config_entries.async_entries(DOMAIN):
# we need get entry_id to display devices but still issue how get config by platform
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_IMPORT}, data={}
)
)
It succeeds but async_setup_entry() has no config info as async_setup_platform(). Passing as data is workaround and data are not grouped by platform.
So is it feature or bug that items from configuration.yaml cannot provide devices ? Unless it is bug how to implement without patching hass core ?
Thanks in advance