From 4d773b1ff34a160d96827a721c85d9a60fad705d Mon Sep 17 00:00:00 2001 From: Erik Date: Mon, 3 Aug 2026 19:17:33 +0200 Subject: [PATCH] Adapt drop_connect to set via_device_id in DeviceInfo --- homeassistant/components/drop_connect/entity.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/drop_connect/entity.py b/homeassistant/components/drop_connect/entity.py index 69d8f5c56970..2d8c87182710 100644 --- a/homeassistant/components/drop_connect/entity.py +++ b/homeassistant/components/drop_connect/entity.py @@ -2,6 +2,7 @@ from typing import TYPE_CHECKING +from homeassistant.helpers import device_registry as dr from homeassistant.helpers.device_registry import DeviceInfo from homeassistant.helpers.update_coordinator import CoordinatorEntity @@ -42,11 +43,10 @@ class DROPEntity(CoordinatorEntity[DROPDeviceDataUpdateCoordinator]): identifiers={(DOMAIN, unique_id)}, ) if entry_data[CONF_DEVICE_TYPE] != DEV_HUB: - self._attr_device_info.update( - { - "via_device": ( - DOMAIN, - entry_data[CONF_DEVICE_OWNER_ID], - ) - } + # The owner hub lives in a separate config entry created independently by + # MQTT discovery, so it may not exist yet. Link best-effort when present. + via_device = dr.async_get(coordinator.hass).async_get_device( + identifiers={(DOMAIN, entry_data[CONF_DEVICE_OWNER_ID])} ) + if via_device is not None: + self._attr_device_info["via_device_id"] = via_device.id