diff --git a/custom_components/xiaomi_miot/__init__.py b/custom_components/xiaomi_miot/__init__.py index 8e34d7c43..54a987f4c 100644 --- a/custom_components/xiaomi_miot/__init__.py +++ b/custom_components/xiaomi_miot/__init__.py @@ -770,9 +770,7 @@ def unique_mac(self): @property def unique_did(self): - did = self.device.info.unique_id - eid = self._config.get('entry_id') - return f'{did}-{eid}' + return self.device.unique_id @property def name(self): diff --git a/custom_components/xiaomi_miot/core/device.py b/custom_components/xiaomi_miot/core/device.py index 9f2b8b480..94c870ec2 100644 --- a/custom_components/xiaomi_miot/core/device.py +++ b/custom_components/xiaomi_miot/core/device.py @@ -81,7 +81,7 @@ def model(self): @cached_property def mac(self): - return self.data.get('mac') or '' + return self.data.get('mac') or self.miio_info.mac_address or '' @property def host(self): @@ -210,7 +210,7 @@ def name_model(self): @cached_property def unique_id(self): - return f'{self.info.unique_id}-{self.entry.entry_id}' + return f'{self.info.unique_id}-{self.entry.id}' @cached_property def app_link(self): diff --git a/custom_components/xiaomi_miot/core/hass_entry.py b/custom_components/xiaomi_miot/core/hass_entry.py index 20a51f0ce..64e457825 100644 --- a/custom_components/xiaomi_miot/core/hass_entry.py +++ b/custom_components/xiaomi_miot/core/hass_entry.py @@ -18,6 +18,7 @@ class HassEntry: cloud: MiotCloud = None def __init__(self, hass: HomeAssistant, entry: ConfigEntry): + self.id = entry.entry_id self.hass = hass self.entry = entry self.adders: dict[str, AddEntitiesCallback] = {}