Format JSON payload
This commit is contained in:
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user