Removed base 64 encoding

This commit is contained in:
2025-12-27 10:53:22 +01:00
parent 4521e2e65e
commit ee5bb7cd60
2 changed files with 5 additions and 6 deletions

View File

@@ -9,16 +9,15 @@ class MQTTService:
self.address = address
self.port = port
def publish(self, client_id: str, topic: str, message: str, qos: int = 0):
def publish(self, client_id: str, topic: str, data: str, qos: int = 0):
client = mqtt.Client(client_id=client_id)
try:
client.connect(self.address, self.port)
client.loop_start()
data = str(message).encode()
payload = {
"timestamp": int(time.time()),
"data": base64.b64encode(data).decode('utf-8')
"data": data
}
result = client.publish(topic, json.dumps(payload), qos=qos)
result.wait_for_publish()