Sensor Temperature Update Rate

Hello, I am using a Sonoff with a DHT 11 connected. I can see that the sonoff sends a JSON state every 5 minutes with the Temp & RH values. I then have sensors set up with Templates to read these values:

- platform: mqtt
  name: "server_cupboard_temperature"
  state_topic: "tele/ServerCupboard/DHT11/SENSOR"
  unit_of_measurement: '°C'
  value_template: '{{ value_json.DHT11.Temperature }}'
- platform: mqtt
  name: "server_cupboard_humidity"
  state_topic: "tele/ServerCupboard/DHT11/SENSOR"
  unit_of_measurement: '%'
  value_template: '{{ value_json.DHT11.Humidity }}'

However it seems that home assistant will only occasionally capture / display the values - sometimes they will be out of sync to. Currently, from the same sensor, the temprature update 11 hours ago & the RH updated 2 Hours ago.

When you say

do you mean the data is not updated or the last updated time is not correct?
HA will only update the value if it changes…
Also how do you know the value changes / Where do you track this? Are you sure MQTT is being updated correctly?


The data is not updated. I would be very surprised if the temperature was the same for 11 hours. Yes, i can see the value in MQTT coming in.

I think your sensor should be updated with every mqtt state change but you can try adding entity to like time.

- platform: mqtt
  entity_id: sensor.time
  name: "server_cupboard_temperature"
  state_topic: "tele/ServerCupboard/DHT11/SENSOR"
  unit_of_measurement: '°C'
  value_template: '{{ value_json.DHT11.Temperature }}'

Hi there,

Im not sure what you mean, this sensor would get the same value as the temperature one as you havent changed the value_template - Was this intentional?

I meant that because a mqtt sensor subscribes to the published topic, it should update with every change in the mqtt published state. That is a problem.

As a possible fix, you might ask HA to update the mqtt sensor every change in the sensor.time (which for me is every minute) and hopefully it will requested an updated sensor reading from mqtt every minute.

- platform: mqtt
  entity_id: sensor.time //          Added this line to cause time based updates
  name: "server_cupboard_temperature"
  state_topic: "tele/ServerCupboard/DHT11/SENSOR"
  unit_of_measurement: '°C'
  value_template: '{{ value_json.DHT11.Temperature }}'


Ive tried to implement this and I’ve left it running for a while & it seems that i am still experiencing the same behaviour

You can try using a mqtt client and make sure your server is actually seeing the temperature changes. You can also manually publish temp changes in HA in the services page to see if your sensor changes.

I use mqtt lens as an extenstion to chrome.


Thanks for your response, I can see the value coming into the MQTT broker every 5 minutes as expected.

Sorry to potentially repeat it, but I think it’s the most likely cause:

So you see that every 5 minutes there’s a new MQTT message, but could you check if every 5 minutes it’s actually a different value? I think the DHT11 only sends whole integer/non-fractional numbers, so maybe that could explain why the temperature is not changing…

Hi, Yes i can see the MQTT value changing

Hmmm, okay try setting up the logger component with the manual log level:

homeassistant.components.mqtt: debug

then. It will display all the MQTT messages Home Assistant receives

Okay, i will be moving home in a few days a re-setting up my configuration. I shall turn this debugging on and check to see if i get the messages in regularly

You can update the time with the teleperiod command in the web console of the Tasmota device.

Hi all,

Sorry for the delay. Ive just moved house and i have set up the sensor again. I can see the temperature and RH update in the tasmota home page and in the MQTT broker every 5 minutes without fail. However, home assistant isnt updating at that rate. This is an issue with the way the sensor run’s - maybe because its a value_template?

Hello, I have now updated my TelePeriod to run every 30 seconds and in Home assistant isn’t processing at this frequency. At the moment the last time it read an update was 22 minutes ago.

Any help on this would be great! Im looking to setup the thermostat component.

I know this is an old thread, but wondering if you ever found a solution.

I’ve set up a DHT11 this is the yaml code:


 - platform: dht
   sensor: DHT11
   pin: 3
   name: TestTemp
     - temperature
     - humidity

I was able to create a card and view the output, but like original poster mentioned it doesn’t seem to update. When I click on “temp” on the card it gives me a graph, and says “18 hours ago”. Seems temperature only updates once or twice a day, and humidity about 4 to 5 times per day. I know for a fact temperature and humidity does change because I have another temp/humidity sensor that runs off batteries next to it.

I was hoping to set up automations based on the readings, ie when it gets too hot turn fans on, etc.

Just ran a test, and seems at reboot it does pickup new value.


So I keep reading and then testing. Someone mentioned that perhaps it would help to use a GPIO pin that has a pull down resistor. Tried with pins that have pull down and pull up and got same results.

Someone else mentioned that runs over 1 meter long tend to give problems. On another site they claim that dht11 and 22s are great, since you can run cables up to 20 meters long to connect the device.

Well I did hook up two more dht11’s (3 total now). The original one has a cable run of about 4 to 5 meters with cat5 cable. The other two (the new ones) have about an 80 cm to 1 meter run on regular thin stranded wire (22 AWG), and those two do seem to be working properly. One of them seems to spike now and then, the other one very stable.

So the length of the run and perhaps the cable used do seem to be the problem. I can’t change the length of the run, it is about 4 meters. I do get good 5.05 V reading at the dht11 terminals, which are connected to the blue and blue/white cables which are twisted as a pair. The signal wire is connected to one of the copper lines of the cat5, the white/green wire. The green wire that is twisted with is currently not being used.

Would combining both green with green/white help me or make it worse since I would be giving the signal even more space to dissipate or what ever the technical term might be.

Would running 5v positive or ground on the green wire help somehow? I know usually data cables are the ones that are twisted in pairs to help the signal, even the number of twists makes a difference.

Or would my best bet be to run regular stranded 22 AWG instead of using the cat5 cable?

I tried to find it again via history but couldn’t, but the page that mentioned dht11 and 22s could work with a 20 meter cable did seem like a real site that had the correct specs for the dhts, current uses, etc. I’ve plaid with ribbon cable before, and those seem to have like 3 hairs of wire inside them, would the goal be to use the thinnest wire I could find? I only need to go about 4 meters.