From 6279bcd07a18ccf9cdd3432f752b8f2eeca6a049 Mon Sep 17 00:00:00 2001 From: MaxineMuster <146550015+MaxineMuster@users.noreply.github.com> Date: Sun, 5 Oct 2025 00:01:57 +0200 Subject: [PATCH] Add Chip internal temperature as sensor in JSON (#1821) * Add MCU temperature to json_interface.c * Write chip temp even if there is no other sensor present * Send chip temperature always as sensor "ESP32" --- src/httpserver/json_interface.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/httpserver/json_interface.c b/src/httpserver/json_interface.c index 5e9f5b7c4..9f1dbf694 100644 --- a/src/httpserver/json_interface.c +++ b/src/httpserver/json_interface.c @@ -264,6 +264,10 @@ static int http_tasmota_json_SENSOR(void* request, jsonCb_t printer) { float chan_val1, chan_val2; int channel_1, channel_2, g_pin_1 = 0; printer(request, ","); +#ifndef NO_CHIP_TEMPERATURE +// printer(request, "\"%s\":{\"Temperature\": %.1f},", PLATFORM_MCU_NAME, g_wifi_temperature); + printer(request, "\"ESP32\":{\"Temperature\": %.1f},", g_wifi_temperature); +#endif if (DRV_IsRunning("SHT3X")) { g_pin_1 = PIN_FindPinIndexForRole(IOR_SHT3X_DAT, g_pin_1); channel_1 = g_cfg.pins.channels[g_pin_1]; @@ -408,7 +412,11 @@ static int http_tasmota_json_status_SNS(void* request, jsonCb_t printer, bool bA bHasAnyDHT = true; break; } +#ifdef NO_CHIP_TEMPERATURE if (DRV_IsSensor() || bHasAnyDHT) { +#else + if (1) { +#endif http_tasmota_json_SENSOR(request, printer); JSON_PrintKeyValue_String(request, printer, "TempUnit", "C", false); }