Format JSON payload

This commit is contained in:
2025-12-30 14:13:20 +01:00
parent 4828a70e78
commit 32d6da6f0c
4 changed files with 21 additions and 11 deletions

View File

@@ -65,11 +65,7 @@ class MQTTService:
def publish(self, topic: str, data: str, qos: int = 0):
try:
self.connect()
payload = {
"timestamp": int(time.time()),
"data": data
}
result = self.client.publish(topic, json.dumps(payload), qos=qos)
result = self.client.publish(topic, json.dumps(data), qos=qos)
result.wait_for_publish()
except Exception as e:
print(f"An error occurred while publishing on {topic} on {self.address} : {e}")