mirror of
https://github.com/esphome/esphome.git
synced 2024-11-25 16:38:16 +01:00
add AM2120 device type (#6115)
This commit is contained in:
parent
1fef769496
commit
6561746f97
3 changed files with 4 additions and 1 deletions
|
@ -91,7 +91,7 @@ bool HOT IRAM_ATTR DHT::read_sensor_(float *temperature, float *humidity, bool r
|
|||
delayMicroseconds(40);
|
||||
} else if (this->model_ == DHT_MODEL_DHT22_TYPE2) {
|
||||
delayMicroseconds(2000);
|
||||
} else if (this->model_ == DHT_MODEL_AM2302) {
|
||||
} else if (this->model_ == DHT_MODEL_AM2120 || this->model_ == DHT_MODEL_AM2302) {
|
||||
delayMicroseconds(1000);
|
||||
} else {
|
||||
delayMicroseconds(800);
|
||||
|
|
|
@ -11,6 +11,7 @@ enum DHTModel {
|
|||
DHT_MODEL_AUTO_DETECT = 0,
|
||||
DHT_MODEL_DHT11,
|
||||
DHT_MODEL_DHT22,
|
||||
DHT_MODEL_AM2120,
|
||||
DHT_MODEL_AM2302,
|
||||
DHT_MODEL_RHT03,
|
||||
DHT_MODEL_SI7021,
|
||||
|
@ -27,6 +28,7 @@ class DHT : public PollingComponent {
|
|||
* - DHT_MODEL_AUTO_DETECT (default)
|
||||
* - DHT_MODEL_DHT11
|
||||
* - DHT_MODEL_DHT22
|
||||
* - DHT_MODEL_AM2120
|
||||
* - DHT_MODEL_AM2302
|
||||
* - DHT_MODEL_RHT03
|
||||
* - DHT_MODEL_SI7021
|
||||
|
|
|
@ -23,6 +23,7 @@ DHT_MODELS = {
|
|||
"AUTO_DETECT": DHTModel.DHT_MODEL_AUTO_DETECT,
|
||||
"DHT11": DHTModel.DHT_MODEL_DHT11,
|
||||
"DHT22": DHTModel.DHT_MODEL_DHT22,
|
||||
"AM2120": DHTModel.DHT_MODEL_AM2120,
|
||||
"AM2302": DHTModel.DHT_MODEL_AM2302,
|
||||
"RHT03": DHTModel.DHT_MODEL_RHT03,
|
||||
"SI7021": DHTModel.DHT_MODEL_SI7021,
|
||||
|
|
Loading…
Reference in a new issue