diff --git a/homeassistant/components/asuswrt/bridge.py b/homeassistant/components/asuswrt/bridge.py index ae6cbc1c82a..0832bdba23c 100644 --- a/homeassistant/components/asuswrt/bridge.py +++ b/homeassistant/components/asuswrt/bridge.py @@ -7,7 +7,7 @@ from collections import namedtuple from collections.abc import Awaitable, Callable, Coroutine import functools import logging -from typing import Any, cast +from typing import Any from aioasuswrt.asuswrt import AsusWrt as AsusWrtLegacy from aiohttp import ClientSession @@ -219,7 +219,7 @@ class AsusWrtLegacyBridge(AsusWrtBridge): @property def is_connected(self) -> bool: """Get connected status.""" - return cast(bool, self._api.is_connected) + return self._api.is_connected async def async_connect(self) -> None: """Connect to the device.""" @@ -235,8 +235,7 @@ class AsusWrtLegacyBridge(AsusWrtBridge): async def async_disconnect(self) -> None: """Disconnect to the device.""" - if self._api is not None and self._protocol == PROTOCOL_TELNET: - self._api.connection.disconnect() + await self._api.async_disconnect() async def async_get_connected_devices(self) -> dict[str, WrtDevice]: """Get list of connected devices.""" diff --git a/homeassistant/components/asuswrt/manifest.json b/homeassistant/components/asuswrt/manifest.json index 6273c77ca78..3f2872bf258 100644 --- a/homeassistant/components/asuswrt/manifest.json +++ b/homeassistant/components/asuswrt/manifest.json @@ -7,5 +7,5 @@ "integration_type": "hub", "iot_class": "local_polling", "loggers": ["aioasuswrt", "asusrouter", "asyncssh"], - "requirements": ["aioasuswrt==1.4.0", "asusrouter==1.21.0"] + "requirements": ["aioasuswrt==1.5.1", "asusrouter==1.21.0"] } diff --git a/requirements_all.txt b/requirements_all.txt index c3223f80070..1f33a055ba6 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -201,7 +201,7 @@ aioaquacell==0.2.0 aioaseko==1.0.0 # homeassistant.components.asuswrt -aioasuswrt==1.4.0 +aioasuswrt==1.5.1 # homeassistant.components.husqvarna_automower aioautomower==2.2.1 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 706f8311f7a..816a5c11f15 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -189,7 +189,7 @@ aioaquacell==0.2.0 aioaseko==1.0.0 # homeassistant.components.asuswrt -aioasuswrt==1.4.0 +aioasuswrt==1.5.1 # homeassistant.components.husqvarna_automower aioautomower==2.2.1 diff --git a/tests/components/asuswrt/test_init.py b/tests/components/asuswrt/test_init.py index 72897b737e5..9c4b2c0d9a2 100644 --- a/tests/components/asuswrt/test_init.py +++ b/tests/components/asuswrt/test_init.py @@ -26,5 +26,5 @@ async def test_disconnect_on_stop(hass: HomeAssistant, connect_legacy) -> None: hass.bus.async_fire(EVENT_HOMEASSISTANT_STOP) await hass.async_block_till_done() - assert connect_legacy.return_value.connection.disconnect.call_count == 1 + assert connect_legacy.return_value.async_disconnect.await_count == 1 assert config_entry.state is ConfigEntryState.LOADED