From a9fbf1390a8f0342383232ee99b3e2ca02e5f30a Mon Sep 17 00:00:00 2001 From: lunDreame <87955512+lunDreame@users.noreply.github.com> Date: Sat, 18 Jan 2025 16:11:06 +0900 Subject: [PATCH] Patch Update --- custom_components/bestin/const.py | 2 +- custom_components/bestin/controller.py | 4 +++- custom_components/bestin/device.py | 4 ++-- custom_components/bestin/manifest.json | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/custom_components/bestin/const.py b/custom_components/bestin/const.py index 807b34c..15dec28 100644 --- a/custom_components/bestin/const.py +++ b/custom_components/bestin/const.py @@ -7,7 +7,7 @@ DOMAIN = "bestin" NAME = "BESTIN" -VERSION = "1.1.8" +VERSION = "1.1.9" PLATFORMS: list[Platform] = [ Platform.CLIMATE, diff --git a/custom_components/bestin/controller.py b/custom_components/bestin/controller.py index 63d9843..468220e 100644 --- a/custom_components/bestin/controller.py +++ b/custom_components/bestin/controller.py @@ -464,7 +464,9 @@ def parse_state_general(self, packet: bytearray) -> tuple[dict, int]: for i in range(iterations[0]): light_state = bool(packet[6] & (0x01 << i)) + dc_value = int.from_bytes(packet[12:14], 'big') / 10.0 state_general["light"][str(i)] = light_state + state_general["light"][f"dcvalue"] = dc_value for i in range(iterations[1]): idx = 14 + 2 * i @@ -719,6 +721,6 @@ async def process_queue_data(self): queue_item = await self.queue.get() await self.handle_packet_queue(queue_item) else: - await asyncio.sleep(1e-3) + await asyncio.sleep(0.1) except Exception as ex: LOGGER.error(f"Failed to process task queue: {ex}", exc_info=True) diff --git a/custom_components/bestin/device.py b/custom_components/bestin/device.py index 7d8aecf..8c5fe75 100644 --- a/custom_components/bestin/device.py +++ b/custom_components/bestin/device.py @@ -41,12 +41,12 @@ def device_info(self) -> DeviceInfo: return DeviceInfo( connections={(self.hub.hub_id, self.unique_id)}, - identifiers={(DOMAIN, f"{self.hub.wp_version}_{formatted_id}_{self.hub.hub_id}")}, + identifiers={(DOMAIN, f"{self.hub.wp_version}_{formatted_id}")}, manufacturer="HDC Labs Co., Ltd.", model=self.hub.wp_version, name=device_name, sw_version=self.hub.sw_version, - via_device=(DOMAIN, self.hub.hub_id), + via_device=(DOMAIN, str(self.hub.hub_id)), ) diff --git a/custom_components/bestin/manifest.json b/custom_components/bestin/manifest.json index dbd6c4a..5d931bf 100644 --- a/custom_components/bestin/manifest.json +++ b/custom_components/bestin/manifest.json @@ -13,5 +13,5 @@ "aiofiles", "xmltodict" ], - "version": "1.1.8" + "version": "1.1.9" } \ No newline at end of file