From bc517112996bb0173a056d5745d5bd61aea6a6cf Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Tue, 14 Dec 2021 21:39:38 +0100 Subject: [PATCH] *added missed file --- src/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 264924d..f2f1b82 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -29,6 +29,7 @@ const int idxhum = CONFIG_MQTT_IDX_Hum; //CustomMqtt const char* custom_temperature_topic = CONFIG_MQTT_Temp_TOPIC; const char* custom_humidity_topic = CONFIG_MQTT_Hum_TOPIC ; +const char* custom_combi_topic = CONFIG_MQTT_Comb_TOPIC ; WiFiClient espClient; PubSubClient client(espClient); @@ -169,6 +170,12 @@ void loop() //Custom Mqtt if (CONFIG_CUSTOM_MSG == 1){ + StaticJsonDocument<100> JSONCustomComb; + JSONCustomComb["humidity"] = roundf(CalcHumidity * 100) / 100; + JSONCustomComb["temperature"] = roundf(cTemp * 100) / 100; + char buffer4[256]; + serializeJson(JSONCustomComb, buffer4); + if (client.publish(custom_temperature_topic, String(cTemp).c_str(), true) == true) { Serial.println("Published Custom MQTT messages"); } else { @@ -176,6 +183,7 @@ void loop() } client.publish(custom_humidity_topic, String(CalcHumidity).c_str(), true); + client.publish(custom_combi_topic, buffer4); client.loop(); delay(60000); //1min }