From ba487d907d89479a141db72e61c3e00a006a6f98 Mon Sep 17 00:00:00 2001 From: patman15 <14628713+patman15@users.noreply.github.com> Date: Mon, 30 Dec 2024 13:39:33 +0100 Subject: [PATCH] debug enhancement --- custom_components/hunterdouglas_powerview_ble/api.py | 5 +++-- emu/PV_BLE_cover/PV_BLE_cover.ino | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/custom_components/hunterdouglas_powerview_ble/api.py b/custom_components/hunterdouglas_powerview_ble/api.py index 5f7db06..420f76d 100644 --- a/custom_components/hunterdouglas_powerview_ble/api.py +++ b/custom_components/hunterdouglas_powerview_ble/api.py @@ -145,11 +145,12 @@ class PowerViewBLE: ) + cmd_run[1] ) + LOGGER.debug("sending cmd: %s", tx_data.hex(" ")) if self._cipher is not None and self._is_encrypted: enc = self._cipher.encryptor() tx_data = enc.update(tx_data) + enc.finalize() + LOGGER.debug(" encrypted: %s", tx_data.hex(" ")) self._data_event.clear() - LOGGER.debug("sending cmd: %s", tx_data) await self._client.write_gatt_char(UUID_TX, tx_data, False) self._seqcnt += 1 LOGGER.debug("waiting for response") @@ -179,7 +180,7 @@ class PowerViewBLE: ("position3", int(data[6])), ("tilt", int(data[7])), ("home_id", int.from_bytes(data[0:2], byteorder="little")), - ("type_id", int.from_bytes(data[2:3])), + ("type_id", int(data[2])), ("is_opening", bool(pos & 0x3 == 0x2)), ("is_closing", bool(pos & 0x3 == 0x1)), ("battery_charging", bool(pos & 0x3 == 0x3)), # observed diff --git a/emu/PV_BLE_cover/PV_BLE_cover.ino b/emu/PV_BLE_cover/PV_BLE_cover.ino index 45d0da7..5e3259c 100644 --- a/emu/PV_BLE_cover/PV_BLE_cover.ino +++ b/emu/PV_BLE_cover/PV_BLE_cover.ino @@ -208,7 +208,7 @@ void decode(BLECharacteristic *pChar) { case 0xFB02: // set shade key Serial.print("set shade key: "); - print_hex(&data_raw[4], data_len - 4, "\\x"); + print_hex(&data_raw[4], data_len - 4, "\\x", ""); // set resonse before key, to acknowledge unencrypted resp_size = set_response(&response, (const message *)data_dec); if (msg.data_len == 16) {