debug enhancement

This commit is contained in:
patman15
2024-12-30 13:39:33 +01:00
parent 8b0bccee6b
commit ba487d907d
2 changed files with 4 additions and 3 deletions

View File

@@ -145,11 +145,12 @@ class PowerViewBLE:
) )
+ cmd_run[1] + cmd_run[1]
) )
LOGGER.debug("sending cmd: %s", tx_data.hex(" "))
if self._cipher is not None and self._is_encrypted: if self._cipher is not None and self._is_encrypted:
enc = self._cipher.encryptor() enc = self._cipher.encryptor()
tx_data = enc.update(tx_data) + enc.finalize() tx_data = enc.update(tx_data) + enc.finalize()
LOGGER.debug(" encrypted: %s", tx_data.hex(" "))
self._data_event.clear() self._data_event.clear()
LOGGER.debug("sending cmd: %s", tx_data)
await self._client.write_gatt_char(UUID_TX, tx_data, False) await self._client.write_gatt_char(UUID_TX, tx_data, False)
self._seqcnt += 1 self._seqcnt += 1
LOGGER.debug("waiting for response") LOGGER.debug("waiting for response")
@@ -179,7 +180,7 @@ class PowerViewBLE:
("position3", int(data[6])), ("position3", int(data[6])),
("tilt", int(data[7])), ("tilt", int(data[7])),
("home_id", int.from_bytes(data[0:2], byteorder="little")), ("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_opening", bool(pos & 0x3 == 0x2)),
("is_closing", bool(pos & 0x3 == 0x1)), ("is_closing", bool(pos & 0x3 == 0x1)),
("battery_charging", bool(pos & 0x3 == 0x3)), # observed ("battery_charging", bool(pos & 0x3 == 0x3)), # observed

View File

@@ -208,7 +208,7 @@ void decode(BLECharacteristic *pChar) {
case 0xFB02: case 0xFB02:
// set shade key // set shade key
Serial.print("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 // set resonse before key, to acknowledge unencrypted
resp_size = set_response(&response, (const message *)data_dec); resp_size = set_response(&response, (const message *)data_dec);
if (msg.data_len == 16) { if (msg.data_len == 16) {