Add device registry support to ecobee integration (#27109)
* Add manufacturer const * Add device_info to binary sensor * Add device info to climate * Add device info to sensor * Add device info to weather * Add constant for device info * Fix log messages * Use guard clauses
This commit is contained in:
1 parent
f500367721
commit
98eaecf61d
5 files changed
+141
-4
No files matched your search
@@ -36,7 +36,7 @@ from homeassistant.const import (
|
||||
from homeassistant.util.temperature import convert
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
from .const import DOMAIN, _LOGGER
|
||||
from .const import DOMAIN, ECOBEE_MODEL_TO_NAME, MANUFACTURER, _LOGGER
|
||||
from .util import ecobee_date, ecobee_time
|
||||
|
||||
ATTR_COOL_TEMP = "cool_temp"
|
||||
@@ -310,6 +310,29 @@ class Thermostat(ClimateDevice):
|
||||
"""Return a unique identifier for this ecobee thermostat."""
|
||||
return self.thermostat["identifier"]
|
||||
|
||||
@property
|
||||
def device_info(self):
|
||||
"""Return device information for this ecobee thermostat."""
|
||||
try:
|
||||
model = f"{ECOBEE_MODEL_TO_NAME[self.thermostat['modelNumber']]} Thermostat"
|
||||
except KeyError:
|
||||
_LOGGER.error(
|
||||
"Model number for ecobee thermostat %s not recognized. "
|
||||
"Please visit this link and provide the following information: "
|
||||
"https://github.com/home-assistant/home-assistant/issues/27172 "
|
||||
"Unrecognized model number: %s",
|
||||
self.name,
|
||||
self.thermostat["modelNumber"],
|
||||
)
|
||||
return None
|
||||
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self.thermostat["identifier"])},
|
||||
"name": self.name,
|
||||
"manufacturer": MANUFACTURER,
|
||||
"model": model,
|
||||
}
|
||||
|
||||
@property
|
||||
def temperature_unit(self):
|
||||
"""Return the unit of measurement."""
|
||||
|
||||
Reference in new issue
Block a user