Documentation
DHT Legacy Extension
The DHT Legacy extension uses the deprecated Adafruit_DHT library to gather temperature and humidity readings from a DHT device.
Warning
Deprecated in v0.11.0 — will be removed in a future release. The Adafruit_DHT library this extension depends on has been abandoned by Adafruit and is incompatible with Python 3.9+. All users should migrate to the DHT extension, which uses the actively maintained adafruit-circuitpython-dht library.
Overview
The dht_legacy extension connects to a digital humidity temperature (DHT) device to gather temperature and humidity readings. Through the support of Adafruit_DHT you can take readings with a DHT connected to a Raspberry Pi or Beaglebone Black.
This extension does not take an extension-level config and is focused on interfaces.
Sensor Interface
Provides a sensor that returns DHT readings.
| Option | Type | Required | Description |
|---|---|---|---|
key |
String | Yes | Unique slug id for the component |
pin |
Integer | Yes | GPIO pin to use on board, e.g. 12 |
name |
String | No | Friendly display name of component. Useful for UI. |
model |
String | No | Model of DHT device to use. Options: 11, 22, or 2302. Default: 11 |
Config Example
Here is a config of a complete DHT Legacy sensor.
{
"sensor": [
{
"key": "dht_sensor_D12",
"interface": "dht_legacy",
"pin": 12,
"model": "22"
}
]
}
Data
Here is an example of the data returned by the DHT:
{
"temperature": 50,
"humidity": 64
}
Note
DHT is a finicky sensor and it has been known to have high read fail rates. ARMv6 may experience issues with DHT more frequently.