ESPHome and DHT11 sensor only displaying full degree changes

Hi

I have successfully used ESPHome and a dht11 sensor with hassio to display humidity and temperature on the lovelace page. However i have noticed that it only displays changes of temperature as whole degrees eg 23.0 deg C or 24.0 deg C. It never displays, say, 23.7 deg C. This is also what is displayed if I look at any graphs such as in the History, any changes are in whole degrees.

Does anyone have any idea why this is?

thanks

Phil

Because the accuracy is ± 2 Degrees:

That is not the reason. There is a difference between ‘accuracy’ and ‘resolution’.

@pmorris1 what does the ESPhome logger show?

What does your ESPhome config look like?

1 Like

Hi Tom

thanks for this.

ESP logger shows
[11:55:15][C][logger:140]: Hardware UART: UART0
[11:55:15][C][dht:017]: DHT:
[11:55:15][C][dht:018]: Pin: GPIO4 (Mode: INPUT)
[11:55:15][C][dht:022]: Model: DHT11
[11:55:15][C][dht:027]: Update Interval: 20.0s
[11:55:15][C][dht:029]: Temperature ‘NodeMCU Temperature’
[11:55:15][C][dht:029]: Unit of Measurement: ‘°C’
[11:55:15][C][dht:029]: Accuracy Decimals: 1
[11:55:15][C][dht:029]: Icon: ‘mdi:thermometer’
[11:55:15][C][dht:030]: Humidity ‘NodeMCU Humidity’
[11:55:15][C][dht:030]: Unit of Measurement: ‘%’
[11:55:15][C][dht:030]: Accuracy Decimals: 0
[11:55:15][C][dht:030]: Icon: ‘mdi:water-percent’
[11:55:15][C][ota:029]: Over-The-Air Updates:
[11:55:15][C][ota:030]: Address: nodemcu_dht11.local:8266
[11:55:15][C][api:103]: API Server:
[11:55:15][C][api:104]: Address: nodemcu_dht11.local:6053
[11:55:29][D][dht:048]: Got Temperature=25.0°C Humidity=54.0%
[11:55:29][D][sensor:092]: ‘NodeMCU Temperature’: Sending state 25.00000 °C with 1 decimals of accuracy
[11:55:29][D][sensor:092]: ‘NodeMCU Humidity’: Sending state 54.00000 % with 0 decimals of accuracy

ESPHome config is

esphome:
name: nodemcu_dht11
platform: ESP8266
board: nodemcuv2

wifi:
ssid: “xxxxxx”
password: “xxxxxxxxx”

Enable logging

logger:

Enable Home Assistant API

api:

ota:

sensor:

  • platform: dht
    pin: D2
    temperature:
    name: “NodeMCU Temperature”
    humidity:
    name: “NodeMCU Humidity”
    update_interval: 20s
    model: DHT11

Thanks

Phil

Add this:
accuracy_decimals: 2

Hi

I have changed config to read

sensor:

  • platform: dht
    pin: D2
    temperature:
    name: “NodeMCU Temperature”
    accuracy_decimals: 2

    humidity:
    name: “NodeMCU Humidity”
    update_interval: 20s
    model: DHT11

BUT unfortunately it has not worked. Output now just reads 25.00 deg C

Seems like the DHT11 sensor only output integers and not decimals.

https://www.mouser.com/ds/2/758/DHT11-Technical-Data-Sheet-Translated-Version-1143054.pdf

Oh Right!

thanks for this info - it was just puzzling me.

Phil

Why do the same sensors output non-integer values when attached to a TASMOTA device then?

According to the datasheets the DHT22 reports fractions but the DHT11 does not.

That’s weird. I just moved a DHT-11 from a NodeMCU running tasmota to an Esp32 on ESPHome and it went from reporting fractions to whole degrees.

That is odd. I wonder how Tasmota does it considering it should not be supported?

You can see in the graph where I changed the sensor from Tasmota to esphome :slight_smile:

I believe you, it’s just strange that Tasmota can do that considering what the datasheet says.

The topic is a bit old but it is still relevant. I had the same question what I found is that there is a new datasheet for the DHT11, which includes the first decimal. They already implemented it in the dev version of ESPhome: https://github.com/esphome/esphome/pull/861

I just tested it. In HassIO you can run both the dev and final version alongside each other, or just wait a little till it is released.

1 Like

Hi. Thanks for this. Useful information