diff --git a/tasmota/xdrv_12_home_assistant.ino b/tasmota/xdrv_12_home_assistant.ino index 36fa9bd22..7378be79c 100644 --- a/tasmota/xdrv_12_home_assistant.ino +++ b/tasmota/xdrv_12_home_assistant.ino @@ -888,7 +888,11 @@ void HAssAnnounceSensors(void) TasmotaGlobal.tele_period = tele_period_save; size_t sensordata_len = ResponseLength(); char sensordata[sensordata_len+2]; // dynamically adjust the size +#ifdef MQTT_DATA_STRING + strcpy(sensordata, TasmotaGlobal.mqtt_data.c_str()); // we can use strcpy since the buffer has the right size +#else strcpy(sensordata, TasmotaGlobal.mqtt_data); // we can use strcpy since the buffer has the right size +#eindif // ******************* JSON TEST ******************* // char sensordata[512];