Skip to content

DHT11/DHT22 — temperature [°C] (dht_read_temp)

What it does: Returns the last measured temperature from the DHT sensor in degrees Celsius.

dht_read_temp

Inputs

  • No data inputs.

Output

  • Number: temperature in °C (with DHT11 typically a whole number, with DHT22 often decimal).

When to use it

  • After calling dht_measure, when you want to get the current temperature.
  • For regulation of heating, ventilation, overheating alarm or logging.

Tips and pitfalls

  • The block only reads the last sample, it does not start a new measurement itself.
  • In the case of longer wiring or interference, occasional measurement failures may occur.

Usage example

example_dht

Open Example in ESP IDE

Generated Python example

value = dhts.temperature()