Register MAC address connections on Synology DSM hub device (#169085)

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
Co-authored-by: Michael <35783820+mib1185@users.noreply.github.com>
This commit is contained in:
Tom Wilkie
2026-04-24 22:28:22 +02:00
committed by GitHub
co-authored by Michael
parent 99185bf9a4
commit e7aa672133
2 changed files with 23 additions and 2 deletions
@@ -5,7 +5,11 @@ from __future__ import annotations
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any
from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.helpers.device_registry import (
CONNECTION_NETWORK_MAC,
DeviceInfo,
format_mac,
)
from homeassistant.helpers.entity import EntityDescription
from homeassistant.helpers.update_coordinator import CoordinatorEntity
@@ -56,6 +60,9 @@ class SynologyDSMBaseEntity[_CoordinatorT: SynologyDSMUpdateCoordinator[Any]](
)
self._attr_device_info = DeviceInfo(
identifiers={(DOMAIN, information.serial)},
connections={
(CONNECTION_NETWORK_MAC, format_mac(mac)) for mac in network.macs
},
name=network.hostname,
manufacturer="Synology",
model=information.model,
+15 -1
View File
@@ -15,7 +15,7 @@ from homeassistant.const import (
CONF_USERNAME,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from homeassistant.helpers import device_registry as dr, entity_registry as er
from .common import (
mock_dsm_external_usb_devices_usb0,
@@ -356,3 +356,17 @@ async def test_no_external_usb(
"""Test Synology DSM without USB."""
sensor = hass.states.get("sensor.nas_meontheinternet_com_usb_disk_1_device_size")
assert sensor is None
async def test_hub_device_info_mac_connections(
hass: HomeAssistant,
setup_dsm_with_usb: MagicMock,
) -> None:
"""Test that the hub DeviceInfo includes MAC address connections."""
dev_reg = dr.async_get(hass)
device = dev_reg.async_get_device(identifiers={(DOMAIN, SERIAL)})
assert device is not None
assert device.connections == {
("mac", "00:11:32:xx:xx:59"),
("mac", "00:11:32:xx:xx:5a"),
}