Use shorthand attributes in Tp-link (#99888)

This commit is contained in:
Joost Lekkerkerker 2023-09-08 12:36:46 +02:00 committed by GitHub
parent b2c3d95911
commit 0cf32e74d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,18 +41,14 @@ class CoordinatedTPLinkEntity(CoordinatorEntity[TPLinkDataUpdateCoordinator]):
super().__init__(coordinator)
self.device: SmartDevice = device
self._attr_unique_id = self.device.device_id
@property
def device_info(self) -> DeviceInfo:
"""Return information about the device."""
return DeviceInfo(
connections={(dr.CONNECTION_NETWORK_MAC, self.device.mac)},
identifiers={(DOMAIN, str(self.device.device_id))},
self._attr_device_info = DeviceInfo(
connections={(dr.CONNECTION_NETWORK_MAC, device.mac)},
identifiers={(DOMAIN, str(device.device_id))},
manufacturer="TP-Link",
model=self.device.model,
name=self.device.alias,
sw_version=self.device.hw_info["sw_ver"],
hw_version=self.device.hw_info["hw_ver"],
model=device.model,
name=device.alias,
sw_version=device.hw_info["sw_ver"],
hw_version=device.hw_info["hw_ver"],
)
@property