From bd970b1a723ef2e9ad248a4d767e75d1f4f7672f Mon Sep 17 00:00:00 2001 From: Robert Schulze Date: Mon, 11 Apr 2022 14:32:22 +0200 Subject: [PATCH] Do not create hex-string and rebuild byte string for TLV and data Since TLVs (and data) are defined on byte level, the values are destroyed by converting them to string and back to bytes. This solves issue #238. --- homekit/controller/ble_impl/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homekit/controller/ble_impl/__init__.py b/homekit/controller/ble_impl/__init__.py index 53ed1e5..ce68577 100644 --- a/homekit/controller/ble_impl/__init__.py +++ b/homekit/controller/ble_impl/__init__.py @@ -247,7 +247,7 @@ def _convert_from_python(self, aid, cid, value): return value.encode('UTF-8') if char_format == CharacteristicFormats.data or char_format == CharacteristicFormats.tlv8: - return value.hex().encode() + return value # from here only integer values of different sizes if char_format == CharacteristicFormats.int: