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) super().__init__(coordinator)
self.device: SmartDevice = device self.device: SmartDevice = device
self._attr_unique_id = self.device.device_id self._attr_unique_id = self.device.device_id
self._attr_device_info = DeviceInfo(
@property connections={(dr.CONNECTION_NETWORK_MAC, device.mac)},
def device_info(self) -> DeviceInfo: identifiers={(DOMAIN, str(device.device_id))},
"""Return information about the device."""
return DeviceInfo(
connections={(dr.CONNECTION_NETWORK_MAC, self.device.mac)},
identifiers={(DOMAIN, str(self.device.device_id))},
manufacturer="TP-Link", manufacturer="TP-Link",
model=self.device.model, model=device.model,
name=self.device.alias, name=device.alias,
sw_version=self.device.hw_info["sw_ver"], sw_version=device.hw_info["sw_ver"],
hw_version=self.device.hw_info["hw_ver"], hw_version=device.hw_info["hw_ver"],
) )
@property @property