Set Mac as connection to link HomeWizard devices on network (#101944)

This commit is contained in:
Duco Sebel 2023-10-15 23:40:06 +02:00 committed by GitHub
parent 8dd8af0718
commit d0fb994199
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,8 +1,8 @@
"""Base entity for the HomeWizard integration.""" """Base entity for the HomeWizard integration."""
from __future__ import annotations from __future__ import annotations
from homeassistant.const import ATTR_IDENTIFIERS from homeassistant.const import ATTR_CONNECTIONS, ATTR_IDENTIFIERS
from homeassistant.helpers.device_registry import DeviceInfo from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC, DeviceInfo
from homeassistant.helpers.update_coordinator import CoordinatorEntity from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import DOMAIN from .const import DOMAIN
@ -25,6 +25,10 @@ class HomeWizardEntity(CoordinatorEntity[HWEnergyDeviceUpdateCoordinator]):
) )
if coordinator.data.device.serial is not None: if coordinator.data.device.serial is not None:
self._attr_device_info[ATTR_CONNECTIONS] = {
(CONNECTION_NETWORK_MAC, coordinator.data.device.serial)
}
self._attr_device_info[ATTR_IDENTIFIERS] = { self._attr_device_info[ATTR_IDENTIFIERS] = {
(DOMAIN, coordinator.data.device.serial) (DOMAIN, coordinator.data.device.serial)
} }