Use DeviceInfo in switcher-kis (#58579)

Co-authored-by: epenet <epenet@users.noreply.github.com>
pull/58607/head
epenet 2021-10-28 14:29:37 +02:00 committed by GitHub
parent f2169ba111
commit 383a820ae1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -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: