From f4a03c39e0399a7d9bfa038fadb7f6c6d69126b5 Mon Sep 17 00:00:00 2001 From: Florian Date: Thu, 7 Dec 2023 07:42:25 -0600 Subject: [PATCH] [IR] Fix hex and protocol_name (#1826) Fix hex and protocol name field value persistence during the json object lifecycle --- main/ZgatewayIR.ino | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/main/ZgatewayIR.ino b/main/ZgatewayIR.ino index 2882fcb..328870a 100644 --- a/main/ZgatewayIR.ino +++ b/main/ZgatewayIR.ino @@ -126,10 +126,8 @@ void IRtoMQTT() { IRdata["protocol"] = (int)(results.decode_type); IRdata["bits"] = (int)(results.bits); # if defined(ESP8266) || defined(ESP32) //resultToHexidecimal is only available with IRremoteESP8266 - String hex = resultToHexidecimal(&results); - IRdata["hex"] = (const char*)hex.c_str(); - String protocol = typeToString(results.decode_type, false); - IRdata["protocol_name"] = (const char*)protocol.c_str(); + IRdata["hex"] = resultToHexidecimal(&results); + IRdata["protocol_name"] = typeToString(results.decode_type, false); # endif String rawCode = ""; // Dump data