From 17a22dfb1bd369e8ba18333c2a1367c072a37a05 Mon Sep 17 00:00:00 2001 From: Scott Wallace Date: Sat, 10 Dec 2022 15:44:17 +0000 Subject: [PATCH] Fix JSON payload --- get_data.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/get_data.py b/get_data.py index d631730..4917584 100644 --- a/get_data.py +++ b/get_data.py @@ -1,6 +1,7 @@ """ Read Xiaomi LYWSD03MMC advertised packets and send them to MQTT """ +import json import os from socket import gaierror from typing import TypedDict @@ -54,7 +55,7 @@ def send_to_mqtt(data: MQTTdata) -> None: }, { "topic": "sensors/home/{data['mac']}/tele/SENSOR", - "payload": data, + "payload": json.dumps(data), }, ]