Use DeviceInfo in switcher-kis (#58579)
Co-authored-by: epenet <epenet@users.noreply.github.com>pull/58607/head
parent
f2169ba111
commit
383a820ae1
|
@ -23,6 +23,7 @@ from homeassistant.helpers import (
|
||||||
entity_platform,
|
entity_platform,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
|
|
||||||
|
@ -92,11 +93,11 @@ class SwitcherBaseSwitchEntity(CoordinatorEntity, SwitchEntity):
|
||||||
# Entity class attributes
|
# Entity class attributes
|
||||||
self._attr_name = coordinator.name
|
self._attr_name = coordinator.name
|
||||||
self._attr_unique_id = f"{coordinator.device_id}-{coordinator.mac_address}"
|
self._attr_unique_id = f"{coordinator.device_id}-{coordinator.mac_address}"
|
||||||
self._attr_device_info = {
|
self._attr_device_info = DeviceInfo(
|
||||||
"connections": {
|
connections={
|
||||||
(device_registry.CONNECTION_NETWORK_MAC, coordinator.mac_address)
|
(device_registry.CONNECTION_NETWORK_MAC, coordinator.mac_address)
|
||||||
}
|
}
|
||||||
}
|
)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _handle_coordinator_update(self) -> None:
|
def _handle_coordinator_update(self) -> None:
|
||||||
|
|
Loading…
Reference in New Issue