Dockerized DHT11/22 and AM2302 sensor with outlier detection, MQTT client and HA auto-discovery

Hi everyone,

As the title says. I was scouring the internet for a convenient way to connect my DHT22 sensor to home assistant. While I did find a couple of solutions which I could run on my raspberry pi, none of them featured all four components that I was looking for:

  1. A dockerized solution, which will not clutter my host os with libraries and scripts lying around.
  2. An MQTT client to connect to HAs’ own MQTT integration.
  3. Support for Home assistants’ discovery protocol for a more seamless integration.
  4. Outlier filtering.
    About 4), you could apply some post-processing in HA, but it requires using templates and is not as flexible.

Some unmentioned benefits to this approach are:

  1. Lightweight container, around 50mbs unpacked.
  2. Using the newer adafruit-circuitpython-dht library.
  3. Fully configurable. You can turn on or off any of the features: MQTT, HA discovery or the outlier filtering.

So anyway, here is the link to it with some supplementary information in how it works and a list of the configurable parameters for the curious: dht22mqtt-homeassistant-docker.

Full disclosure:
I have not tested this with a dht11 or am2302 sensors, since I only have a dht22 one, but if you end up using it with either I’ll appreciate the feedback.

Are you familiar with ESPHome?

I believe it meets several of your four requirements and is one of the most popular means of integrating DIY devices with Home Assistant.

It supports a wide range of devices including DHT11/22 and AM2302 sensors: