diff --git a/custom_components/homeconnect/api.py b/custom_components/homeconnect/api.py index a30497a..64a1df4 100644 --- a/custom_components/homeconnect/api.py +++ b/custom_components/homeconnect/api.py @@ -11,8 +11,11 @@ from homeassistant.core import callback +from .const import DOMAIN + _LOGGER = logging.getLogger(__name__) + class ConfigEntryAuth(homeconnect.HomeConnectAPI): """Provide Home Connect authentication tied to an OAuth2 based config entry.""" @@ -65,7 +68,6 @@ def get_devices(self): return devices - class HomeConnectDevice: # for some devices, this is instead 'BSH.Common.EnumType.PowerState.Standby' @@ -115,6 +117,20 @@ def name(self): """Return the name of the node (used for Entity_ID).""" return self._name + @property + def unique_id(self): + """Return the unique id base on the id returned by Home Connect and the entity name.""" + return f"{self.device.appliance.haId}-{self.name}" + + @property + def device_info(self): + return { + "identifiers": {(DOMAIN, self.device.appliance.haId)}, + "name": self.device.appliance.name, + "manufacturer": self.device.appliance.brand, + "model": self.device.appliance.vib, + } + @callback def async_entity_update(self): _LOGGER.debug("Entity update triggered on {}".format(self))