From c8652d534433e80ead2a13155fadffd6e4c78dea Mon Sep 17 00:00:00 2001 From: xlyric Date: Mon, 3 Jun 2024 15:52:49 +0200 Subject: [PATCH] correction enregistrement MQTT --- src/function/mqtt.h | 26 ++++++++++++++++++++++---- src/main.cpp | 2 +- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/function/mqtt.h b/src/function/mqtt.h index 06f2d92..e6bafb3 100644 --- a/src/function/mqtt.h +++ b/src/function/mqtt.h @@ -56,6 +56,7 @@ extern PubSubClient client; void connectToMqtt(); void onMqttConnect(bool sessionPresent); void onMqttSubscribe(uint16_t packetId, uint8_t qos); +void recreate_topic(); char buffer[1024];// NOSONAR /// @brief Enregistrement du dimmer sur MQTT pour récuperer les informations remonté par MQTT @@ -69,7 +70,7 @@ String stringBoolMQTT(bool mybool); String node_id = String("dimmer-") + node_mac; String topic_Xlyric = "Xlyric/" + String(config.say_my_name) +"/"; - + String command_switch = String(topic_Xlyric + "command/switch"); String command_number = String(topic_Xlyric + "command/number"); String command_select = String(topic_Xlyric + "command/select"); @@ -80,11 +81,11 @@ String stringBoolMQTT(bool mybool); void callback(char* topic, byte* payload, unsigned int length) { char arrivage[length+1]; // Ajout d'un espace pour le caractère nul // NOSONAR int recup = 0; - + for (int i=0;i