From 6f79a6576268b255e69cd526a214a53c71229f11 Mon Sep 17 00:00:00 2001 From: Yevhenii Vaskivskyi Date: Mon, 13 Oct 2025 16:55:28 +0200 Subject: [PATCH] AsusWRT: Pass only online clients to the device list from the API (#154322) --- homeassistant/components/asuswrt/bridge.py | 3 ++- tests/components/asuswrt/common.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/asuswrt/bridge.py b/homeassistant/components/asuswrt/bridge.py index 0832bdba23c..53c19ede366 100644 --- a/homeassistant/components/asuswrt/bridge.py +++ b/homeassistant/components/asuswrt/bridge.py @@ -13,7 +13,7 @@ from aioasuswrt.asuswrt import AsusWrt as AsusWrtLegacy from aiohttp import ClientSession from asusrouter import AsusRouter, AsusRouterError from asusrouter.config import ARConfigKey -from asusrouter.modules.client import AsusClient +from asusrouter.modules.client import AsusClient, ConnectionState from asusrouter.modules.data import AsusData from asusrouter.modules.homeassistant import convert_to_ha_data, convert_to_ha_sensors from asusrouter.tools.connection import get_cookie_jar @@ -436,6 +436,7 @@ class AsusWrtHttpBridge(AsusWrtBridge): if dev.connection is not None and dev.description is not None and dev.connection.ip_address is not None + and dev.state is ConnectionState.CONNECTED } async def async_get_available_sensors(self) -> dict[str, dict[str, Any]]: diff --git a/tests/components/asuswrt/common.py b/tests/components/asuswrt/common.py index 541e74e5b39..1f317952755 100644 --- a/tests/components/asuswrt/common.py +++ b/tests/components/asuswrt/common.py @@ -3,6 +3,7 @@ from unittest.mock import MagicMock from aioasuswrt.asuswrt import Device as LegacyDevice +from asusrouter.modules.client import ConnectionState from homeassistant.components.asuswrt.const import ( CONF_SSH_KEY, @@ -71,6 +72,7 @@ def make_client(mac, ip, name, node): client = MagicMock() client.connection = connection client.description = description + client.state = ConnectionState.CONNECTED return client