diff --git a/homeassistant/components/ubus/device_tracker.py b/homeassistant/components/ubus/device_tracker.py
index 48d5b4bd6f6..f49a06be9dd 100644
--- a/homeassistant/components/ubus/device_tracker.py
+++ b/homeassistant/components/ubus/device_tracker.py
@@ -75,13 +75,13 @@ class UbusDeviceScanner(DeviceScanner):
def __init__(self, config):
"""Initialize the scanner."""
- host = config[CONF_HOST]
+ self.host = config[CONF_HOST]
self.username = config[CONF_USERNAME]
self.password = config[CONF_PASSWORD]
self.parse_api_pattern = re.compile(r"(?P\w*) = (?P.*);")
self.last_results = {}
- self.url = f"http://{host}/ubus"
+ self.url = f"http://{self.host}/ubus"
self.ubus = Ubus(self.url, self.username, self.password)
self.hostapd = []
@@ -108,6 +108,10 @@ class UbusDeviceScanner(DeviceScanner):
name = self.mac2name.get(device.upper(), None)
return name
+ async def async_get_extra_attributes(self, device: str) -> dict[str, str]:
+ """Return the host to distinguish between multiple routers."""
+ return {"host": self.host}
+
@_refresh_on_access_denied
def _update_info(self):
"""Ensure the information from the router is up to date.