Pulse Meter Sensor¶
The pulse meter sensor allows you to count the number and frequency of pulses on any pin. It is intended to be a drop-in replacement
for the pulse counter integration.
Rather than counting pulses over a fixed time interval, the pulse meter sensor measures the time between pulses. The precise manner in which this is done depends on the
internal_filter_mode option. This leads to a higher resolution, especially for low pulse rates, as the pulse counter sensor is limited by the number of pulses within a time interval.
Here’s a comparison of the two sensors; both are set to an update interval of 10 seconds (using the
update_interval and the
throttle_average option respectively):
# Example configuration entry sensor: - platform: pulse_meter pin: 12 name: "Pulse Meter"
pin (Required, Pin): The pin to count pulses on.
name (Required, string): The name of the sensor.
internal_filter (Optional, Time): If a pulse shorter than this time is detected, it is discarded. Defaults to
This acts as a debounce filter to eliminate input noise, so choose a value a little less than your expected minimum pulse width.
internal_filter_mode (Optional, string): Determines how the internal filter is applied. One of
PULSE. Defaults to
EDGE. - In
EDGEmode, subsequent rising edges are compared and if they fall into an interval lesser than the
internal filtervalue, the last one is discarded. This is useful if your input signal bounces, but is otherwise clean. - In
PULSEmode, the rising edge is discarded if any further interrupts are detected before the
internal_filtertime has passed. In other words, a high pulse must be at least
internal_filterlong to be counted. This is useful if you have a noisy input signal that may have bounces before and/or after the main pulse.
timeout (Optional, Time): If we don’t see a pulse for this length of time, we assume 0 pulses/s. Defaults to
total (Optional, ID): An additional sensor that outputs the total number of pulses counted.
All other options from Sensor.
The sensor defaults to units of pulses/min, You can change this by using Sensor Filters. For example, if you’re using the pulse meter with a photodiode to count the light pulses on a power meter that has an impulse constant of 10000 pulses / kWh, you can use the following to output instantaneous usage in W:
# Example configuration entry sensor: - platform: pulse_meter name: 'Electricity Usage' id: sensor_pulse_meter # Optional ID, necessary if you want to calculate the total number of pulses. unit_of_measurement: 'W' device_class: power state_class: measurement internal_filter: 20ms # Assuming maximum load of 16 kW and 10000 impulses per kWh, any pulses faster than 22.5 ms would exceed load. -10% ~= 20 ms. accuracy_decimals: 0 pin: 12 filters: - multiply: 6 # (60s / impulse constant) * (1000W / 1kW)
Counting total pulses¶
When the total sensor is configured,
pulse_meter also reports the total
number of pulses measured.
# Example configuration entry sensor: - platform: pulse_meter # ... total: name: "Total Pulses"
(Re)Setting the total pulse count¶
Using this action, you are able to reset/set the total pulse count. This can be useful
if you would like the
total sensor to match what you see on your meter you are
trying to match.
api: services: - service: set_total variables: new_total: int then: - pulse_counter.set_total_pulses: id: sensor_pulse_meter value: !lambda 'return new_total;'
This value is the raw count of pulses, and not the value you see after the filters