HC-SR04 too slow with Tasmota

I’m trying to turn on a light when SR04 detected distance is less than 50cm, but Tasmota is too slow to report an update so the automation is kind of useless at the moment. Is there anyway to force Tasmota to report back to HA as soon as a new measurement is taken? What alternatives do I have to improve the measurement update speed? I’m using an ESP8266 Nodemuc V3 with tasmota-sensors.bin 8.5

Set teleperiod to 10

I did, but 10 sec waiting for a light to turn on is eternity.

I believe with Tasmota the fastest telemetry period you can set is 1 second, so try setting it to 1 instead of 10.

Alternatively you can use ESPHome.

The HC-SR04 is supported by openmqttgateway. Maybe try this ?

According to the Tasmota docs, the lowest you can set in the precompiled binaries is 10.

Ah, I must have missed that.


Reading through the docs, it seems like you might be able to define a rule that immediately sends an update through MQTT when your sensor passes a threshold value, however I’m not sure how exactly you would define such a rule.
ESPHome makes things a bit more intuitive IMHO.

Here are the docs on defining rules, if that’s the path you want to go down:

I was in the process of reading how to set a rule. Trying to implement that now. Thanks!

I read there is a way to set Telemetry to 1 second, modifying userconfig.h file according to: https://github.com/arendst/Tasmota/issues/2655#issuecomment-391096211

However I don’t know how to get access to that file.

That is if you compile the binary yourself. You need to download the source code and compile using platform.io

Even with the proper Tasmota rule applied, the sensor only updated every 3-5 sec, so I ended up flashing ESPHome, now I get subsecond updates!

1 Like

Hi, could you please share your ESPhome config?