Data from Sonoff DHT22 sensor doesn't update

In the weekend, I connected a DHT22 sensor to a Sonoff running the sonoff-tasmota firmware. I logged into the device and activated the sensor on GPIO14. It shows and updates in the Sonoff menu. In HA however, it only updates once. If I restart HA, it will first show the values unknown, then after a little while, it will update to the correct values. But then it stops updating. What might be the cause of that? I’ve set it up as suggested in the sonoff-tasmota wiki.

Running HA 0.64.3 on a RPi2 in VirtualEnv on Raspibian Stretch, Sonoff-tasmota v5.8.0.

I take it you’ve connected the sonoff to HA via MQTT?
If so can you see your MQTT messages being updated?
Issue would so far either be on HA, MQTT or Tasmota… Let’s try and see where it might be first…

also check this thread found while googling for you:

1 Like

Yes, I use the MQTT protocol.It seems like the version (5.8.0) i’m using has some issues that has since been corrected, so i guess an OTA update is due to be learned and preformed :slight_smile: How would i check the MQTT messages? Are you talking about running the mosquitto sub command from terminal? I won’t be able to access the devices for a couple of days, only the HA GUI over duckdns. Currently, it hasn’t updated the data in over 24hrs…

Yes. As per my second post this is a known issue, resolved in 5.9. FYI latest version of Tasmota is 5.12 so it would be a good idea to upgrade as you’re quite a few versions behind…

Yes I’ve picked up that there been a few updates, and I’m usually a slut for updates, whatever it is. But for something as simple as a “switch”, I’ve been thinking “if it ain’t broke, don’t fix it”. But as of now, I will defo check it out when I get back home, it didn’t seem complicated at all. I’m assuming all my settings (WiFi and MQTT) will remain the same. If not, I will have a look at the mosquitto traffic. I will come back with updates, if it works or not. But just a side question: As I am seeing updating sensor data on the Sonoff-tasmota WebUI, wouldn’t that suggest that the problem would be MQTT pub or HA? Or to put it another way, the sensor data displayed is not after MQTT but locally read directly from the sensor. It’s the same data that ideally would be published through MQTT to my HA system. Am I getting this right?

Seeing the data come up on the web ui doesn’t mean it makes its way all the way to HA via MQTT.
Now I don’t really know what was broken, but the link clearly shows there was something wrong with reading DHT22 data.
If you have an Android phone, you can try MQTT Dash to see what is being received on MQTT (set the same settings as in HA) and I bet you won’t see any DHT12 updates…

Just updated firmware to 5.12d and it now works perfectly. I also had to replace DHT22 with SI7021 in the sensor: value_template: like this value_template: "{{ value_json['SI7021'].Temperature }}"

glad to know :slight_smile: I’d like to know now how you connected the DHT22 and whether it reports some of the temp generated by the Sonoff basic itself.

I have a spare DHT22 but the way I (so far) see it, either it’s “taped” around or close to the Sonoff so there are no loose wires (and then the temp reading will be affected by the heat generated by the Sonoff ) or it far enough from the Sonoff and you get some loose wiring / it doesn’t look neat. So still unsure whether I’ll connect my DHT22…

Yes, some header wires followed the DHT22 sensor, i’d guess they are about 20cm long. I just cut off the male ends and soldered them on to the PCB, no resistor or capacitor or anything like that. The wires were pulled out next to the terminals so no holes or cutouts done to the housing either. I read about the Sonoff affecting the temp, but i’m pretty sure that doesn’t happen here. The temps looks realistic. I suppose the temps will spike if i fire up the fireplace though. My project was also fortunate as it’s an old table with lamps built in. So the Sonoff and the DHT22 sensor is well concealed under the table. See the attached photos.

Thanks for sharing :slight_smile:

I´ve a similar problem…the updates are toooooo slow…every couple of minutes maybe…
I´m on tasmota 6.2.1 and HA 0.78
And the sensor is a DHT11…in the webui the update is almost inmediate…so It´s a MQTT update frecuency issue…
Do you know if there is any way to speed it?

In the commands bar type in teleperiod
I think 300 is the standard it comes with so it updates every 5 minutes. So it would be teleperiod 300. You can just type in teleperiod and hit enter and it will tell you what it’s at now.

Thanks! That was it!