fix: ensure topic and message are hashable in callback by converting to bytes

This commit is contained in:
OMGeeky
2025-06-07 13:20:47 +02:00
parent 1c65e13903
commit 6b8ec730c3

View File

@@ -562,7 +562,8 @@ class MQTTClient:
# Call the callback if set
if self.callback:
try:
self.callback(topic, message)
# Convert bytearrays to bytes to ensure they are hashable
self.callback(bytes(topic), bytes(message))
except Exception as e:
print(f"Warning: Callback error: {e}")
except struct.error as e: