From 3730954391732867bc5864c64af501eabad4662c Mon Sep 17 00:00:00 2001 From: Robert Resch Date: Mon, 20 Mar 2023 20:23:37 +0100 Subject: [PATCH] improve logging --- bumper/mqtt/helper_bot.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bumper/mqtt/helper_bot.py b/bumper/mqtt/helper_bot.py index f52fd86..85efe93 100644 --- a/bumper/mqtt/helper_bot.py +++ b/bumper/mqtt/helper_bot.py @@ -56,11 +56,12 @@ class HelperBot: client: Client, topic: str, payload: bytes, qos: int, properties: dict ) -> None: try: + decoded_payload = payload.decode() _LOGGER.debug( - "Got message: topic=%s; payload=%s;", topic, payload.decode() + "Got message: topic=%s; payload=%s;", topic, decoded_payload ) topic_split = topic.split("/") - data_decoded = str(payload.decode()) + data_decoded = str(decoded_payload) if topic_split[10] in self._commands: self._commands[topic_split[10]].add_response(data_decoded) except Exception: # pylint: disable=broad-except @@ -137,7 +138,7 @@ class HelperBot: command_dto = CommandDto(cmdjson["payloadType"]) self._commands[request_id] = command_dto - _LOGGER.debug("Sending message %s", topic) + _LOGGER.debug("Sending message: topic=%s; payload=%s;", topic, payload) self._client.publish(topic, payload.encode()) resp = await self._wait_for_resp(command_dto, request_id)