How to registre motion/parsing through a gate

Hi Team

Need a hint on how to proceed.

My goal is to be notified when someone is parsing through the gate in to my garden.
I have a reel switch build into the gate, connected to a ESP32 with esphome, so I can see and be notified when the gate is opened.
Now, the gate is not always closed, and left open. And then it stops working (and the solution to this problem could be just to add a spring to make the gate close…).

But I had this idear to add a HC-SR04 Ultrasonic Distance Sensor to the gate pole, and the when some one would walk through the gate, it would measure a ‘shorter’ distance, and then have HA react to that.

And it works - but, the HC-SR04 is only read every minute, that is to long a interval :wink: I had the impression that it would do the reading constant.

Now, what is the way forward ? - besides to make the gate close and then use the reed switch.

Some other technology besides HC-SR04 ? Or go away from ESPHome, and write a c-program that does the reading constant, and when it sees a difference, then updates either HA or MQTT ?

What is the way forward ?

/Jorn

How about a Beam Break Sensor?

e.g.

https://www.jaycar.co.nz/weatherproof-commercial-grade-infrared-beam/p/LA5179

You could easily diy it with an IR LED and receiver.

Why is that your HC-SR04 sensor only reads every minute? You should be able to read more frequently. Change your update_interval in your yaml file.