From 9a425738fa036b8c36ea6c6034bc54c5ee0873cd Mon Sep 17 00:00:00 2001 From: Laurent Date: Tue, 30 Dec 2025 14:52:20 +0100 Subject: [PATCH] please --- rpi/controllers/mqtt_forwarder.py | 4 ++-- rpi/services/mqtt_service.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rpi/controllers/mqtt_forwarder.py b/rpi/controllers/mqtt_forwarder.py index 74ccbe2e..0fb1d905 100644 --- a/rpi/controllers/mqtt_forwarder.py +++ b/rpi/controllers/mqtt_forwarder.py @@ -26,7 +26,7 @@ class MQTTForwarder: print(f"An error occurred while forwarding from {src_topic} to {dst_topic}: {e}") def __wrap_data(self, msg : str): - print(msg) + print(repr(msg)) result = {} data = json.loads(msg) result["timestamp"] = int(time.time()) @@ -34,4 +34,4 @@ class MQTTForwarder: result["data"] = {} for keys in data: result["data"][keys] = data[keys] - return result \ No newline at end of file + return json.dumps(result) \ No newline at end of file diff --git a/rpi/services/mqtt_service.py b/rpi/services/mqtt_service.py index 08c5d4d8..aae57582 100644 --- a/rpi/services/mqtt_service.py +++ b/rpi/services/mqtt_service.py @@ -65,7 +65,7 @@ class MQTTService: def publish(self, topic: str, data: str, qos: int = 0): try: self.connect() - result = self.client.publish(topic, json.dumps(data), qos=qos) + result = self.client.publish(topic, data, qos=qos) result.wait_for_publish() except Exception as e: print(f"An error occurred while publishing on {topic} on {self.address} : {e}")