Replace the deprecated via_device with via_device_id
Home Assistant 2026.9 deprecates the `via_device` (domain, identifier) tuple in favour of `via_device_id`, which takes the parent device's registry id; `via_device` stops working in 2027.8.0. Register the hub device explicitly in async_setup_entry before the platforms are forwarded, so the per-identity entities can look it up and pass its `.id`. The hub device info moves into a shared helper so both call sites describe the same device.
This commit is contained in:
@@ -22,6 +22,7 @@ from homeassistant.core import (
|
||||
)
|
||||
from homeassistant.exceptions import ConfigEntryNotReady, HomeAssistantError
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
from homeassistant.helpers.event import async_track_time_interval
|
||||
|
||||
from .const import (
|
||||
@@ -62,6 +63,7 @@ from .const import (
|
||||
STORAGE_SUBDIR,
|
||||
SUBENTRY_TYPE_IDENTITY,
|
||||
)
|
||||
from .entity import hub_device_info
|
||||
from .reticulum_client import (
|
||||
IdentityManager,
|
||||
ReticulumError,
|
||||
@@ -130,6 +132,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
)
|
||||
runtime.identities[subentry.subentry_id] = manager
|
||||
|
||||
# Register the hub device before the platforms, so the per-identity devices can
|
||||
# link to it with `via_device_id`.
|
||||
dr.async_get(hass).async_get_or_create(
|
||||
config_entry_id=entry.entry_id, **hub_device_info(entry)
|
||||
)
|
||||
|
||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||
|
||||
# Per-identity announce + periodic schedules.
|
||||
|
||||
Reference in New Issue
Block a user