Use DeviceInfo Class E (#58230)

This commit is contained in:
Robert Hillis 2021-10-23 05:44:51 -04:00 committed by GitHub
parent 137d41d8b4
commit 12c067970a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 111 additions and 99 deletions

View file

@ -15,6 +15,7 @@ from homeassistant.const import (
CONF_USERNAME,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import COORDINATOR, DOMAIN, NAME, SENSORS
@ -169,13 +170,13 @@ class Envoy(CoordinatorEntity, SensorEntity):
return None
@property
def device_info(self):
def device_info(self) -> DeviceInfo:
"""Return the device_info of the device."""
if not self._device_serial_number:
return None
return {
"identifiers": {(DOMAIN, str(self._device_serial_number))},
"name": self._device_name,
"model": "Envoy",
"manufacturer": "Enphase",
}
return DeviceInfo(
identifiers={(DOMAIN, str(self._device_serial_number))},
manufacturer="Enphase",
model="Envoy",
name=self._device_name,
)