1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

AsusWRT: Pass only online clients to the device list from the API (#154322)

This commit is contained in:
Yevhenii Vaskivskyi
2025-10-13 16:55:28 +02:00
committed by GitHub
parent ce1fdc6b75
commit 6f79a65762
2 changed files with 4 additions and 1 deletions

View File

@@ -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]]:

View File

@@ -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