Detecting single and double press, dark ride control

I’m using Home assistant to control a dark ride. Along the track are D1mini pro’s with ESPHome, and infrared beam sensors, which trigger a relay when the beam is broken. On the test car (1) I mounted a little rod that runs in between the IR sensor, telling the system that the car is in that part of the track. Then I have a NodeRed flow that stops the car for 45 seconds, so the guests can wacht a video, after that the car starts again. On the cars there are also D1mini pro’s with a reay board.
I want to use two rods on car 2, so that it simulates a double press. How should I program ESPHome that it publishes to HA if its a single or double press, in a way so I can use NR to control the actions being taken. I know you can do all actions in ESPHome itself, but I like to use NR to keep it all in one place. Can I have ESPHome send for instance car1 and car2 on single and double presses?
I hope this all makes sense, since English is not my own language. Thanks in advance!