From a3904aabfd9322ed7230f8ee1167aac5f946ce83 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Wed, 28 Sep 2022 15:32:22 +1300 Subject: [PATCH] Fix bytes --- aioesphomeapi/client.py | 4 ++-- aioesphomeapi/model.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/aioesphomeapi/client.py b/aioesphomeapi/client.py index ae67fb2..2051993 100644 --- a/aioesphomeapi/client.py +++ b/aioesphomeapi/client.py @@ -545,7 +545,7 @@ class APIClient: req.address = address req.handle = characteristic_handle req.response = response - req.data.extend(list(data)) + req.data = data assert self._connection is not None await self._connection.send_message(req) @@ -593,7 +593,7 @@ class APIClient: req = BluetoothGATTWriteDescriptorRequest() req.address = address req.handle = handle - req.data.extend(list(data)) + req.data = data assert self._connection is not None await self._connection.send_message(req) diff --git a/aioesphomeapi/model.py b/aioesphomeapi/model.py index e1efaf1..4d6b3bd 100644 --- a/aioesphomeapi/model.py +++ b/aioesphomeapi/model.py @@ -771,7 +771,8 @@ def _convert_bluetooth_le_service_data( ) -> Dict[str, bytes]: if isinstance(value, dict): return value - return {_long_uuid(v.uuid): v.data for v in value} # type: ignore + + return {_long_uuid(v.uuid): bytes(v.data) for v in value} # type: ignore def _convert_bluetooth_le_manufacturer_data( @@ -779,7 +780,7 @@ def _convert_bluetooth_le_manufacturer_data( ) -> Dict[int, bytes]: if isinstance(value, dict): return value - return {int(v.uuid, 16): v.data for v in value} # type: ignore + return {int(v.uuid, 16): bytes(v.data) for v in value} # type: ignore @dataclass(frozen=True)