From 6f09c830cfed03fcea2133a382b4c8bba206f962 Mon Sep 17 00:00:00 2001 From: Patrick <14628713+patman15@users.noreply.github.com> Date: Mon, 30 Dec 2024 18:33:29 +0100 Subject: [PATCH] ensure fresh data after command (#136) issue with JK BMS streaming data, fixes #133 --- custom_components/bms_ble/plugins/basebms.py | 1 + 1 file changed, 1 insertion(+) diff --git a/custom_components/bms_ble/plugins/basebms.py b/custom_components/bms_ble/plugins/basebms.py index 5daf88a..f16b773 100644 --- a/custom_components/bms_ble/plugins/basebms.py +++ b/custom_components/bms_ble/plugins/basebms.py @@ -228,6 +228,7 @@ async def _await_reply( """Send data to the BMS and wait for valid reply notification.""" self._log.debug("TX BLE data: %s", data.hex(" ")) + self._data_event.clear() # clear event before requesting new data await self._client.write_gatt_char(char or self.uuid_tx(), data) if wait_for_notify: await asyncio.wait_for(self._wait_event(), timeout=self.BAT_TIMEOUT)