esphome-docs/esphomeyaml/components/sensor/dht.rst

82 lines
3.3 KiB
ReStructuredText
Raw Normal View History

2018-05-13 11:37:02 +02:00
DHT Temperature+Humidity Sensor
===============================
The DHT Temperature+Humidity sensor allows you to use your DHT11
(`datasheet <https://akizukidenshi.com/download/ds/aosong/DHT11.pdf>`__,
`adafruit <https://www.adafruit.com/product/386>`__), DHT22
(`datasheet <https://www.sparkfun.com/datasheets/Sensors/Temperature/DHT22.pdf>`__,
`adafruit <https://www.adafruit.com/product/385>`__), AM2302
(`datasheet <https://cdn-shop.adafruit.com/datasheets/Digital+humidity+and+temperature+sensor+AM2302.pdf>`__,
`adafruit <https://www.adafruit.com/product/393>`__) and RHT03
(`datashet <https://cdn.sparkfun.com/datasheets/Sensors/Weather/RHT03.pdf>`__,
`sparkfun <https://cdn.sparkfun.com/datasheets/Sensors/Weather/RHT03.pdf>`__)
sensors with esphomelib.
2018-06-01 18:10:00 +02:00
.. figure:: images/dht22-full.jpg
2018-05-14 21:15:49 +02:00
:align: center
:target: `Adafruit`_
:width: 50.0%
2018-05-13 11:37:02 +02:00
2018-05-14 21:15:49 +02:00
DHT22 Temperature & Humidity Sensor. Image by `Adafruit`_.
2018-05-13 11:37:02 +02:00
.. _Adafruit: https://www.adafruit.com/product/385
2018-06-03 23:20:14 +02:00
The DHT22 and DHT11 require external pull up resistors on the data line. To do this, solder
a resistor with *about* 4.7kΩ (anything in the range from 1kΩ to 10kΩ probably works fine, but
if you're having issues try the 4.7kΩ recommended by the manufacturer) between ``DATA`` and ``3.3V``.
2018-06-01 18:10:00 +02:00
.. figure:: images/temperature-humidity.png
:align: center
2018-05-14 21:15:49 +02:00
:width: 80.0%
2018-05-13 11:37:02 +02:00
.. code:: yaml
# Example configuration entry
sensor:
- platform: dht
pin: D2
temperature:
name: "Living Room Temperature"
humidity:
name: "Living Room Humidity"
update_interval: 15s
Configuration variables:
~~~~~~~~~~~~~~~~~~~~~~~~
2018-06-01 18:10:00 +02:00
- **pin** (**Required**, :ref:`config-pin`): The pin where the DHT bus is connected.
- **temperature** (**Required**): The information for the temperature sensor.
- **name** (**Required**, string): The name for the temperature sensor.
- **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas.
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.
- **humidity** (**Required**): The information for the humidity sensor
- **name** (**Required**, string): The name for the humidity sensor.
- **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas.
- All other options from :ref:`Sensor <config-sensor>` and :ref:`MQTT Component <config-mqtt-component>`.
- **model** (*Optional*, int): Manually specify the DHT model, can be
2018-06-06 08:56:56 +02:00
one of ``AUTO_DETECT``, ``DHT11``, ``DHT22``, ``AM2302``, ``RHT03``
2018-06-01 18:10:00 +02:00
and helps with some connection issues. Defaults to ``AUTO_DETECT``.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the
2018-06-01 18:44:15 +02:00
sensor. Defaults to ``15s``. See :ref:`sensor-default_filter`.
2018-05-14 21:15:49 +02:00
.. note::
If you're seeing lots of invalid temperature/humidity warnings in the logs, try manually setting the
DHT model with the ``model:`` configuration variable. Other problems could be wrong pull-up resistor values
on the DATA pin or too long cables.
2018-06-01 18:10:00 +02:00
See Also
^^^^^^^^
- :ref:`sensor-filters`
- :doc:`dht12`
- :doc:`hdc1080`
- :doc:`htu21d`
- :doc:`sht3xd`
- :doc:`API Reference </api/sensor/dht>`
2018-06-04 08:17:22 +02:00
- `Edit this page on GitHub <https://github.com/OttoWinter/esphomedocs/blob/current/esphomeyaml/components/sensor/dht.rst>`__