Use DeviceInfo on components with via_device (H) (#58211)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
c00a5fad8f
commit
58c5b5058c
11 changed files with 108 additions and 97 deletions
|
@ -3,6 +3,7 @@
|
|||
from datetime import timedelta
|
||||
|
||||
from homeassistant.components.sensor import DEVICE_CLASS_BATTERY, SensorEntity
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
|
||||
from . import HiveEntity
|
||||
from .const import DOMAIN
|
||||
|
@ -35,16 +36,16 @@ class HiveSensorEntity(HiveEntity, SensorEntity):
|
|||
return self._unique_id
|
||||
|
||||
@property
|
||||
def device_info(self):
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self.device["device_id"])},
|
||||
"name": self.device["device_name"],
|
||||
"model": self.device["deviceData"]["model"],
|
||||
"manufacturer": self.device["deviceData"]["manufacturer"],
|
||||
"sw_version": self.device["deviceData"]["version"],
|
||||
"via_device": (DOMAIN, self.device["parentDevice"]),
|
||||
}
|
||||
return DeviceInfo(
|
||||
identifiers={(DOMAIN, self.device["device_id"])},
|
||||
name=self.device["device_name"],
|
||||
model=self.device["deviceData"]["model"],
|
||||
manufacturer=self.device["deviceData"]["manufacturer"],
|
||||
sw_version=self.device["deviceData"]["version"],
|
||||
via_device=(DOMAIN, self.device["parentDevice"]),
|
||||
)
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue