Attempt at making the desk move smoothly

This commit is contained in:
Erwin Boskma 2023-11-01 19:47:48 +01:00
parent 61357b8e7a
commit f5887f963f
Signed by: erwin
SSH key fingerprint: SHA256:9LmFDe1C6jSrEyqxxvX8NtJBmcbB105XoqyUZF092bg

View file

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