Use DeviceInfo Class E (#58230)
This commit is contained in:
parent
137d41d8b4
commit
12c067970a
13 changed files with 111 additions and 99 deletions
|
@ -38,6 +38,7 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.helpers import entity_platform
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.util.temperature import convert
|
||||
|
||||
from .const import _LOGGER, DOMAIN, ECOBEE_MODEL_TO_NAME, MANUFACTURER
|
||||
|
@ -366,20 +367,21 @@ class Thermostat(ClimateEntity):
|
|||
return self.thermostat["identifier"]
|
||||
|
||||
@property
|
||||
def device_info(self):
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information for this ecobee thermostat."""
|
||||
model: str | None
|
||||
try:
|
||||
model = f"{ECOBEE_MODEL_TO_NAME[self.thermostat['modelNumber']]} Thermostat"
|
||||
except KeyError:
|
||||
# Ecobee model is not in our list
|
||||
model = None
|
||||
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self.thermostat["identifier"])},
|
||||
"name": self.name,
|
||||
"manufacturer": MANUFACTURER,
|
||||
"model": model,
|
||||
}
|
||||
return DeviceInfo(
|
||||
identifiers={(DOMAIN, self.thermostat["identifier"])},
|
||||
manufacturer=MANUFACTURER,
|
||||
model=model,
|
||||
name=self.name,
|
||||
)
|
||||
|
||||
@property
|
||||
def temperature_unit(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue