From 673361b63a6668028815ec481df4665a36c1a98e Mon Sep 17 00:00:00 2001 From: agessaman Date: Sat, 25 Apr 2026 17:14:05 -0700 Subject: [PATCH] fix(mqtt): restore 'origin' field position in packet message structure Reintroduced the 'origin' field in the buildPacketMessage function to its original position within the JSON object. This adjustment ensures consistency in the message format and aligns with previous structural changes made to enhance clarity. --- lib/PsychicMqttClient/src/PsychicMqttClient.h | 5 +++++ src/helpers/MQTTMessageBuilder.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/PsychicMqttClient/src/PsychicMqttClient.h b/lib/PsychicMqttClient/src/PsychicMqttClient.h index 80961d22..e7b45b9e 100644 --- a/lib/PsychicMqttClient/src/PsychicMqttClient.h +++ b/lib/PsychicMqttClient/src/PsychicMqttClient.h @@ -224,6 +224,11 @@ public: */ PsychicMqttClient &setWill(const char *topic, uint8_t qos, bool retain, const char *payload = nullptr, int length = 0); + /** + * @brief Clears the last will and testament (disables LWT for the next connect / config apply). + */ + PsychicMqttClient &clearLastWill(); + /** * @brief Sets the MQTT server URI. Supports mqtt://, mqtts:// and ws://, wss:// as * transport protocols. Fully supports SSL/TLS. diff --git a/src/helpers/MQTTMessageBuilder.cpp b/src/helpers/MQTTMessageBuilder.cpp index 4648a70c..b784f595 100644 --- a/src/helpers/MQTTMessageBuilder.cpp +++ b/src/helpers/MQTTMessageBuilder.cpp @@ -118,8 +118,8 @@ int MQTTMessageBuilder::buildPacketMessage( snprintf(rssi_str, sizeof(rssi_str), "%d", rssi); root["timestamp"] = timestamp; - root["origin"] = origin; root["hash"] = hash; + root["origin"] = origin; root["type"] = "PACKET"; root["direction"] = direction; root["time"] = time;