Low latency for an esphome motion sensor?

I have an rcwl-0516 radar motion sensor hooked up to a nodemcu esp32 as a gpio binary sensor. I’ve verified it’s working and low latency with a multimeter, but the view in home assistant seems more random. I’m guessing it’s due to the 60s polling from home assistant.

I’ve tried searching for what the latency rules are but haven’t figured it out. Each sensor has a polling number,
but but home assistant also has a polling interval, right? Or does the esp device somehow tell HA how often to poll? And way to send an edge-triggered message instead of polling? Would I be better off with mqtt?

It should be a push event from the device to HA. I’m using a cheap PIR motion sensor with ESPHome and it is near instant.

Edit: to debug, look at the device logs inside of the ESPHome interface. It should show the sensor events.

I use MQTT in ESPHome and it seems pretty instant for my radar sensor.

The exactly same is also true for the API. For binary Sensor esphome uses push (no matter mqtt or the native api).

Just one thing to bear in mind are battery based device which wake up from deep sleep or just booting new. The api can take up to 30 seconds (poll interval for home assistant to connect initnially to eshpome nodes native api) and therfor mqtt (as the broker is a available right after WiFi connect) is still the way to go for time critical battery powered devices. But I can tell that there is something in the making to expand the native api to be handle setups like this in the future :star_struck: