From a84484e0fd5d30b54567c12a03984f2f7e5c0d4d Mon Sep 17 00:00:00 2001 From: RoboMagus <68224306+RoboMagus@users.noreply.github.com> Date: Mon, 25 Jul 2022 04:20:18 +0200 Subject: [PATCH] Add set_total_pulses to pulse_counter docs (#2187) --- components/sensor/pulse_counter.rst | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/components/sensor/pulse_counter.rst b/components/sensor/pulse_counter.rst index 3acba1982..68d6bd38b 100644 --- a/components/sensor/pulse_counter.rst +++ b/components/sensor/pulse_counter.rst @@ -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 `__. - :apiref:`pulse_counter/pulse_counter_sensor.h`