Pulse Counter & Pulse Width Sensor based on the same pin with immediate reporting


Could you please help/clarify if the following scenario possible to implement via ESPHome:
Catch pulse at gpio and immediate report it and time from previous pulse.
Use case: power meter provides 3200 pulses per 1 KWh, pulses as is goes to DB where math could be applied since 1 pulse is 1/3200 KWh; time between pulses is momentary power consumption: (3600/3200)/(time between pulses in seconds) KW.

There are several separate questions:

  1. how to report event immediately (without interval)
  2. how to apply same sensor to the same gpio: pulse counter and pulse width


I know this post is 2.5 years old but:
I’m also looking for a solution to count pulses and measure the pulse length of the same pin. Dit you found a solution?

I tried using the same GPIO in pulse_counter and pluse_width - but it doesn’t work.

  - platform: pulse_counter
    pin: D3
    name: "Pulse Counter"

  - platform: pulse_width
    pin: D3
    name: "Pulse Width"

Try this one; it does exactly what you want:

Pulse Meter


Thanks, it works.
I didn’t use the Pulse Meter in the past because it do not provides the pulses since the last message but only the total. But I’ve found a solution for that.