46#if defined(USE_ESP32_VARIANT_ESP32)
48 ESP_LOGV(TAG,
"Raw temperature value: %d",
raw);
50 success = (
raw != 128);
51#elif defined(USE_ESP32_VARIANT_ESP32C3) || defined(USE_ESP32_VARIANT_ESP32C6) || \
52 defined(USE_ESP32_VARIANT_ESP32S2) || defined(USE_ESP32_VARIANT_ESP32S3) || defined(USE_ESP32_VARIANT_ESP32H2) || \
53 defined(USE_ESP32_VARIANT_ESP32C2) || defined(USE_ESP32_VARIANT_ESP32P4)
54#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
55 temp_sensor_config_t tsens = TSENS_CONFIG_DEFAULT();
56 temp_sensor_set_config(tsens);
58#if defined(USE_ESP32_VARIANT_ESP32S3) && (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 4, 3))
60 "ESP32-S3 internal temperature sensor requires ESP IDF V4.4.3 or higher. See https://github.com/esphome/issues/issues/4271"
62 esp_err_t result = temp_sensor_read_celsius(&
temperature);
64 success = (result == ESP_OK);
66 esp_err_t result = temperature_sensor_get_celsius(tsensNew, &
temperature);
67 success = (result == ESP_OK);
69 ESP_LOGE(TAG,
"Reading failed (%d)", result);
81 success = (result == 0);
82#if defined(USE_LIBRETINY_VARIANT_BK7231N)
84#elif defined(USE_LIBRETINY_VARIANT_BK7231T)
93 ESP_LOGD(TAG,
"Ignoring invalid temperature (success=%d, value=%.1f)", success,
temperature);