diff --git a/custom_components/mikrotik_router/device_tracker.py b/custom_components/mikrotik_router/device_tracker.py index 8176679..8fdfa6d 100644 --- a/custom_components/mikrotik_router/device_tracker.py +++ b/custom_components/mikrotik_router/device_tracker.py @@ -259,6 +259,11 @@ class MikrotikControllerPortDeviceTracker(MikrotikControllerDeviceTracker): """Return true if the port is connected to the network.""" return self._data["running"] + @property + def unique_id(self): + """Return a unique identifier for this port.""" + return f"{self._inst.lower()}-{self._sid_data['sid']}-{self._data['port-mac-address']}_{self._data['default-name']}" + @property def icon(self): """Return the icon.""" diff --git a/custom_components/mikrotik_router/switch.py b/custom_components/mikrotik_router/switch.py index cd5bb76..08aab00 100644 --- a/custom_components/mikrotik_router/switch.py +++ b/custom_components/mikrotik_router/switch.py @@ -233,7 +233,7 @@ class MikrotikControllerPortSwitch(MikrotikControllerSwitch): @property def unique_id(self) -> str: """Return a unique identifier for this port.""" - return f"{self._inst.lower()}-enable_switch-{self._data['port-mac-address']}" + return f"{self._inst.lower()}-enable_switch-{self._data['port-mac-address']}_{self._data['default-name']}" @property def icon(self):