Use DeviceInfo on components with via_device (R-X) (#58213)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-10-22 12:52:33 +02:00 committed by GitHub
parent 176ed4f7ba
commit a3d1159a13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 126 additions and 125 deletions

View file

@ -1,5 +1,5 @@
"""Base class for Tado entity."""
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.entity import DeviceInfo, Entity
from .const import DEFAULT_NAME, DOMAIN, TADO_HOME, TADO_ZONE
@ -15,16 +15,16 @@ class TadoDeviceEntity(Entity):
self.device_id = device_info["shortSerialNo"]
@property
def device_info(self):
def device_info(self) -> DeviceInfo:
"""Return the device_info of the device."""
return {
"identifiers": {(DOMAIN, self.device_id)},
"name": self.device_name,
"manufacturer": DEFAULT_NAME,
"sw_version": self._device_info["currentFwVersion"],
"model": self._device_info["deviceType"],
"via_device": (DOMAIN, self._device_info["serialNo"]),
}
return DeviceInfo(
identifiers={(DOMAIN, self.device_id)},
name=self.device_name,
manufacturer=DEFAULT_NAME,
sw_version=self._device_info["currentFwVersion"],
model=self._device_info["deviceType"],
via_device=(DOMAIN, self._device_info["serialNo"]),
)
@property
def should_poll(self):