Use DeviceInfo Class F-G (#58255)

This commit is contained in:
Robert Hillis 2021-10-23 06:01:21 -04:00 committed by GitHub
parent 12c067970a
commit 63646a19cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 207 additions and 214 deletions

View file

@ -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"]]