Add set_total_pulses to pulse_counter docs (#2187)

This commit is contained in:
RoboMagus 2022-07-25 04:20:18 +02:00 committed by GitHub
parent 2547441e40
commit a84484e0fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -101,10 +101,37 @@ measure the total consumed energy in kWh.
filters:
- multiply: 0.001 # (1/1000 pulses per kWh)
(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.
.. code-block:: yaml
# Set pulse counter total from home assistant using this service call:
api:
services:
- service: set_pulse_total
variables:
new_pulse_total: int
then:
- pulse_counter.set_total_pulses:
id: pulse_counter_id
value: !lambda 'return new_pulse_total;'
.. note::
This value is the raw count of pulses, and not the value you see after the filters
are applied.
See Also
--------
- :ref:`sensor-filters`
- :doc:`/components/sensor/pulse_meter`
- :doc:`rotary_encoder`
- `esp-idf Pulse Counter API <https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/pcnt.html>`__.
- :apiref:`pulse_counter/pulse_counter_sensor.h`