Use DeviceInfo Class F-G (#58255)
This commit is contained in:
parent
12c067970a
commit
63646a19cc
31 changed files with 207 additions and 214 deletions
|
@ -8,6 +8,7 @@ from homeassistant.components.sensor import (
|
|||
)
|
||||
from homeassistant.const import LIGHT_LUX, PERCENTAGE, TEMP_CELSIUS
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import DOMAIN
|
||||
|
@ -54,14 +55,14 @@ class Device(CoordinatorEntity, SensorEntity):
|
|||
self._attr_name = device["name"]
|
||||
self._attr_unique_id = device["uid"]
|
||||
self._type = device["type"]
|
||||
self._attr_device_info = {
|
||||
"name": self.name,
|
||||
"identifiers": {
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={
|
||||
(DOMAIN, self.unique_id),
|
||||
},
|
||||
"model": device["type"],
|
||||
"manufacturer": "Freedompro",
|
||||
}
|
||||
manufacturer="Freedompro",
|
||||
model=device["type"],
|
||||
name=self.name,
|
||||
)
|
||||
self._attr_device_class = DEVICE_CLASS_MAP[device["type"]]
|
||||
self._attr_state_class = STATE_CLASS_MAP[device["type"]]
|
||||
self._attr_native_unit_of_measurement = UNIT_MAP[device["type"]]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue