From c87bb241efcd062dac4685f40c928fcf480c2369 Mon Sep 17 00:00:00 2001 From: Nathan Spencer Date: Wed, 31 Jul 2024 20:55:37 -0600 Subject: [PATCH 1/2] Allow reboot command even if device is busy --- custom_components/oasis_mini/pyoasismini/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/oasis_mini/pyoasismini/__init__.py b/custom_components/oasis_mini/pyoasismini/__init__.py index 81e5f50..2a0207e 100644 --- a/custom_components/oasis_mini/pyoasismini/__init__.py +++ b/custom_components/oasis_mini/pyoasismini/__init__.py @@ -253,7 +253,7 @@ class OasisMini: except Exception as ex: _LOGGER.error(ex) - reboot = self._async_command(params={"CMDBOOT": ""}) + reboot = self._async_get(params={"CMDBOOT": ""}) asyncio.create_task(_no_response_needed(reboot)) async def async_set_ball_speed(self, speed: int) -> None: From a736c72c8e9d40f66ae928c56dce8ff7f270dcde Mon Sep 17 00:00:00 2001 From: Nathan Spencer Date: Wed, 31 Jul 2024 21:03:33 -0600 Subject: [PATCH 2/2] Revert timeout changes, I'll fix later --- custom_components/oasis_mini/pyoasismini/__init__.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/custom_components/oasis_mini/pyoasismini/__init__.py b/custom_components/oasis_mini/pyoasismini/__init__.py index 2a0207e..0c6a4f9 100644 --- a/custom_components/oasis_mini/pyoasismini/__init__.py +++ b/custom_components/oasis_mini/pyoasismini/__init__.py @@ -6,7 +6,6 @@ from typing import Any, Awaitable, Callable, Final from urllib.parse import urljoin from aiohttp import ClientResponseError, ClientSession -import async_timeout from .utils import _bit_to_bool @@ -253,7 +252,7 @@ class OasisMini: except Exception as ex: _LOGGER.error(ex) - reboot = self._async_get(params={"CMDBOOT": ""}) + reboot = self._async_command(params={"CMDBOOT": ""}) asyncio.create_task(_no_response_needed(reboot)) async def async_set_ball_speed(self, speed: int) -> None: @@ -400,11 +399,8 @@ class OasisMini: async def _async_command(self, **kwargs: Any) -> str | None: """Send a command to the device.""" - with async_timeout.timeout(5): - while self.busy: - await asyncio.sleep(0.1) - result = await self._async_get(**kwargs) - _LOGGER.debug("Result: %s", result) + result = await self._async_get(**kwargs) + _LOGGER.debug("Result: %s", result) async def _async_get(self, **kwargs: Any) -> str | None: """Perform a GET request."""