From f5887f963f3359af52c370809aac6989f79834b2 Mon Sep 17 00:00:00 2001 From: Erwin Boskma Date: Wed, 1 Nov 2023 19:47:48 +0100 Subject: [PATCH] Attempt at making the desk move smoothly --- custom_components/linak_desk/api/device.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/custom_components/linak_desk/api/device.py b/custom_components/linak_desk/api/device.py index 1ef45f6..e98c628 100644 --- a/custom_components/linak_desk/api/device.py +++ b/custom_components/linak_desk/api/device.py @@ -74,7 +74,7 @@ class Device: def disconnected_callback(self, client): """Callback for when the device is disconnected""" - _LOGGER.warning("Disconnected from %s", self._mac) + _LOGGER.info("Disconnected from %s", self._mac) self._is_connected = False async def _read_model(self): @@ -163,6 +163,7 @@ class Device: except BleakError as error: if self._is_connected: + self._connection.disconnect() raise error async def move_to_height(self, height: float) -> None: @@ -181,7 +182,7 @@ class Device: while True: await self._write(UUID_REFERENCE_INPUT, encoded_height) - await asyncio.sleep(0.5) + await asyncio.sleep(0.2) _height, speed = parse_height_speed(await self._read(UUID_HEIGHT)) if speed == 0: break