From fd3c2db642b5c151b6a1a8d24b5c1f14c691b824 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Matheson=20Wergeland?= Date: Sun, 16 Oct 2022 22:19:36 +0200 Subject: [PATCH] Fix authentication and connect issues (#1) --- custom_components/plejd/pyplejd/mesh.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/plejd/pyplejd/mesh.py b/custom_components/plejd/pyplejd/mesh.py index 1a81cee..03a8ee7 100644 --- a/custom_components/plejd/pyplejd/mesh.py +++ b/custom_components/plejd/pyplejd/mesh.py @@ -74,7 +74,7 @@ class PlejdMesh(): return False self.client = client - self.connected_node = binascii.a2b_hex(address.replace(":", ""))[::-1] + self.connected_node = binascii.a2b_hex(address.replace(":", "").replace("-", ""))[::-1] await asyncio.sleep(2) @@ -149,7 +149,7 @@ class PlejdMesh(): return False try: _LOGGER.debug("Authenticating") - await self.client.write_gatt_char(PLEJD_AUTH, [0], response=True) + await self.client.write_gatt_char(PLEJD_AUTH, b"\0x00", response=True) challenge = await self.client.read_gatt_char(PLEJD_AUTH) response = auth_response(self.crypto_key, challenge) await self.client.write_gatt_char(PLEJD_AUTH, response, response=True)