diff -r ec5c7794dcd6 -r 84e54b14e7db main/task_mqtt.c --- a/main/task_mqtt.c Mon Apr 17 14:54:35 2023 +0200 +++ b/main/task_mqtt.c Mon Apr 17 16:20:58 2023 +0200 @@ -22,6 +22,8 @@ const char *sensState[] = { "OK", "ERROR" }; ///< Sensor state strings const char *unitMode[] = { "OFF", "ON" }; ///< Units state strings +extern TEMP_State *temp_state; ///< Internal temperature state +extern SemaphoreHandle_t xSemaphoreTEMP; ///< Internal temperature semaphore extern BMP280_State *bmp280_state; ///< BMP280 state extern SemaphoreHandle_t xSemaphoreBMP280; ///< BMP280 lock semaphore extern INA219_State *ina219_state; ///< INA219 state @@ -172,6 +174,12 @@ payload = xstrcat(payload, buf); xSemaphoreGive(xSemaphoreWiFi); } + if (xSemaphoreTake(xSemaphoreTEMP, 25) == pdTRUE) { + payload = xstrcat(payload, (char *)",\"temperature\":"); + sprintf(buf, "%.1f", temp_state->temperature); + payload = xstrcat(payload, buf); + xSemaphoreGive(xSemaphoreTEMP); + } payload = xstrcat(payload, (char *)",\"light\":{\"lux\":"); if (xSemaphoreTake(xSemaphoreAPDS9930, 25) == pdTRUE) { sprintf(buf, "%.1f", apds9930_state->ambient_light);