ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
internal_temperature.h
Go to the documentation of this file.
1#pragma once
2
5
6// Every ESP32 variant except the original one exposes the on-chip sensor through
7// the IDF temperature_sensor driver (the original uses the legacy temprature_sens_read).
8#if defined(USE_ESP32) && !defined(USE_ESP32_VARIANT_ESP32)
9#include "driver/temperature_sensor.h"
10#endif
11
13
15 public:
16 // User provided, not "= default": `new(p) InternalTemperatureSensor()` would zero-fill .bss that is already zero.
18
19#if defined(USE_ESP32) || (defined(USE_ZEPHYR) && defined(USE_NRF52))
20 void setup() override;
21#endif // USE_ESP32 || (USE_ZEPHYR && USE_NRF52)
22 void dump_config() override;
23
24 void update() override;
25
26#if defined(USE_ESP32) && !defined(USE_ESP32_VARIANT_ESP32)
27 protected:
28 temperature_sensor_handle_t tsens_{nullptr};
29#endif
30};
31
32} // namespace esphome::internal_temperature
This class simplifies creating components that periodically check a state.
Definition component.h:519
Base-class for all sensors.
Definition sensor.h:47