Use DeviceInfo Class L-M (#58312)

This commit is contained in:
Robert Hillis 2021-10-25 17:26:40 -04:00 committed by GitHub
parent 6341dd4883
commit f2a5c4602e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 197 additions and 197 deletions

View file

@ -10,6 +10,7 @@ from homeassistant.core import callback
from homeassistant.helpers import entity_registry
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import DeviceInfo
import homeassistant.util.dt as dt_util
from .const import DOMAIN
@ -130,16 +131,15 @@ class MikrotikHubTracker(ScannerEntity):
return None
@property
def device_info(self):
def device_info(self) -> DeviceInfo:
"""Return a client description for device registry."""
info = {
"connections": {(CONNECTION_NETWORK_MAC, self.device.mac)},
"identifiers": {(DOMAIN, self.device.mac)},
# We only get generic info from device discovery and so don't want
# to override API specific info that integrations can provide
"default_name": self.name,
}
return info
# We only get generic info from device discovery and so don't want
# to override API specific info that integrations can provide
return DeviceInfo(
connections={(CONNECTION_NETWORK_MAC, self.device.mac)},
default_name=self.name,
identifiers={(DOMAIN, self.device.mac)},
)
async def async_added_to_hass(self):
"""Client entity created."""