Fix for MQTT device tracker adding quotes to payload

This commit is contained in:
Ingo Ratsdorf
2024-08-13 07:41:12 +12:00
parent 597cd48318
commit ef9aeea2d2

View File

@@ -196,7 +196,10 @@ class sensor_config:
def publish_mqtt(mqtt_client, topic, message):
status = 1
message = json.dumps(message).replace("'",'"')
# convert anything but a simple string to json
if not isinstance(message, str):
message = json.dumps(message).replace("'",'"')
qos = get_setting_value('MQTT_QOS')
mylog('verbose', [f"[{pluginName}] Sending MQTT topic: {topic}"])