From 35a452168a94a63653e550182d3bdcc085ae9bea Mon Sep 17 00:00:00 2001 From: Teemu R Date: Fri, 8 Dec 2023 15:22:58 +0100 Subject: [PATCH] Log smartprotocol requests (#575) * Log smartprotocol requests Also, comment out encrypted secure_passthrough response for the time being * Fix linting --- kasa/aestransport.py | 2 +- kasa/smartprotocol.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/kasa/aestransport.py b/kasa/aestransport.py index aefda422..13263b5b 100644 --- a/kasa/aestransport.py +++ b/kasa/aestransport.py @@ -122,7 +122,7 @@ class AesTransport(BaseTransport): "params": {"request": encrypted_payload.decode()}, } status_code, resp_dict = await self.client_post(url, json=passthrough_request) - _LOGGER.debug(f"secure_passthrough response is {status_code}: {resp_dict}") + # _LOGGER.debug(f"secure_passthrough response is {status_code}: {resp_dict}") if status_code == 200 and resp_dict["error_code"] == 0: response = self._encryption_session.decrypt( # type: ignore resp_dict["result"]["response"].encode() diff --git a/kasa/smartprotocol.py b/kasa/smartprotocol.py index 98d1a86d..0284015f 100644 --- a/kasa/smartprotocol.py +++ b/kasa/smartprotocol.py @@ -124,6 +124,11 @@ class SmartProtocol(TPLinkProtocol): await self._transport.login(login_request) smart_request = self.get_smart_request(smart_method, smart_params) + _LOGGER.debug( + "%s >> %s", + self.host, + _LOGGER.isEnabledFor(logging.DEBUG) and pf(smart_request), + ) response_data = await self._transport.send(smart_request) _LOGGER.debug(