1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-18 07:45:56 +00:00

dht: Fix sensor reading from DHT22 (#926)

* dht: Fix sensor reading from DHT22 (#239)

Looking at the datasheet for DHT22, it claims to need a delay of 18ms, not
800us. Change to use the same delay as DHT11. Tested working with NodeMCUv3
and DHT22 sensor with board with built-in resistor.

* dht: Add model DHT22_TYPE2 with 2ms delay instead of 0.8ms

The model DHT22_TYPE2 is exactly the same as DHT22, but uses a different
delay.

* dht: Fix bogus negative temperature reading on DHT22_TYPE2

The workaround for negative numbers associated with DHT22s can be skipped
on these sensors.
This commit is contained in:
Robin Smidsrød
2020-05-19 01:24:13 +02:00
committed by GitHub
parent 1d9ce2afc5
commit 7df72ddb96
3 changed files with 7 additions and 2 deletions

View File

@@ -15,6 +15,7 @@ DHT_MODELS = {
'AM2302': DHTModel.DHT_MODEL_AM2302,
'RHT03': DHTModel.DHT_MODEL_RHT03,
'SI7021': DHTModel.DHT_MODEL_SI7021,
'DHT22_TYPE2': DHTModel.DHT_MODEL_DHT22_TYPE2,
}
DHT = dht_ns.class_('DHT', cg.PollingComponent)