Use DeviceInfo on components with via_device (R-X) (#58213)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
176ed4f7ba
commit
a3d1159a13
12 changed files with 126 additions and 125 deletions
|
@ -7,7 +7,7 @@ from micloud.micloudexception import MiCloudAccessDenied
|
|||
from miio import DeviceException, gateway
|
||||
from miio.gateway.gateway import GATEWAY_MODEL_EU
|
||||
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import (
|
||||
|
@ -151,16 +151,16 @@ class XiaomiGatewayDevice(CoordinatorEntity, Entity):
|
|||
return self._name
|
||||
|
||||
@property
|
||||
def device_info(self):
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device info of the gateway."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self._sub_device.sid)},
|
||||
"via_device": (DOMAIN, self._entry.unique_id),
|
||||
"manufacturer": "Xiaomi",
|
||||
"name": self._sub_device.name,
|
||||
"model": self._sub_device.model,
|
||||
"sw_version": self._sub_device.firmware_version,
|
||||
}
|
||||
return DeviceInfo(
|
||||
identifiers={(DOMAIN, self._sub_device.sid)},
|
||||
via_device=(DOMAIN, self._entry.unique_id),
|
||||
manufacturer="Xiaomi",
|
||||
name=self._sub_device.name,
|
||||
model=self._sub_device.model,
|
||||
sw_version=self._sub_device.firmware_version,
|
||||
)
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue