esphome-docs/components/sensor/total_daily_energy.rst
Dennis 7ef6443568
Updated documentation related to power meter integration (#3184)
* Updated documentation related to power meter integration

I've updated the cookbook to use the more accurate ``pulse_meter_sensor`` and added how to convert power to energy using ``total_daily_energy``.

* Update power_meter.rst

* Update pulse_meter.rst

* Update total_daily_energy.rst

* Update pulse_meter.rst

* Update total_daily_energy.rst

* Update power_meter.rst

* Add files via upload

* Added more information about pulse meter
and pulse counter differences including graph.

* Reduced image size.

* Path issue

* Once more into the fray.

* And again.

* Some more documentation related to meters

* Worked more on the power meter cookbook.

* Minor modification to match previously used
impulse constant.

* Made pulse_meter more implementation agnostic
and moved power meter relevant information
to the cookbook.

* Apply suggestions from code review

Co-authored-by: Clyde Stubbs <2366188+clydebarrow@users.noreply.github.com>

* Code Review Changes

* Linting.

* Linting again.

* Some reformatting of pulse_meter.rst

* Some more formatting changes.

* Corrected internal filter mode description.

---------

Co-authored-by: H. Árkosi Róbert <robreg@zsurob.hu>
Co-authored-by: Clyde Stubbs <2366188+clydebarrow@users.noreply.github.com>
2023-10-25 17:10:57 +02:00

86 lines
2.7 KiB
ReStructuredText

Total Daily Energy Sensor
=========================
.. seo::
:description: Instructions for setting up sensors that track the total daily energy usage per day and accumulate the power usage.
:image: sigma.svg
The ``total_daily_energy`` sensor is a helper sensor that can use the power value of
other sensors like the :doc:`HLW8012 <hlw8012>`, :doc:`CSE7766 <cse7766>`, :doc:`ATM90E32 <atm90e32>`, etc and integrate
it over time.
So this component allows you to convert readings in ``W`` or ``kW`` to readings of the total
daily energy usage in ``Wh`` or ``kWh``.
.. code-block:: yaml
# Example configuration entry
sensor:
- platform: total_daily_energy
name: 'Total Daily Energy'
power_id: my_power
unit_of_measurement: 'kWh'
state_class: total_increasing
device_class: energy
accuracy_decimals: 3
filters:
# Multiplication factor from W to kW is 0.001
- multiply: 0.001
# The power sensor to convert, can be any power sensor
- platform: hlw8012
# ...
power:
id: my_power
# Enable time component to reset energy at midnight
time:
- platform: homeassistant
id: homeassistant_time
Configuration variables:
------------------------
- **power_id** (**Required**, :ref:`config-id`): The ID of the power sensor
to integrate over time.
- **name** (**Required**, string): The name of the sensor.
- **id** (*Optional*, :ref:`config-id`): Manually specify the ID used for code generation.
- **restore** (*Optional*, boolean): Whether to store the intermediate result on the device so
that the value can be restored upon power cycle or reboot.
Defaults to ``true``.
- **method** (*Optional*, string): The method to use for calculating the total daily energy. One of
``trapezoid``, ``left`` or ``right``. Defaults to ``right``.
- All other options from :ref:`Sensor <config-sensor>`.
Converting from W to kW
-----------------------
Some sensors such as the :doc:`HLW8012 <hlw8012>` expose their power sensor with a unit of measurement of
``W``. To have your readings in ``kW``, use a filter:
.. code-block:: yaml
sensor:
# The power sensor to convert, can be any power sensor
- platform: hlw8012
# ...
power:
id: my_power
filters:
# Multiplication factor from W to kW is 0.001
- multiply: 0.001
unit_of_measurement: kW
See Also
--------
- :ref:`sensor-filters`
- :doc:`hlw8012`
- :doc:`cse7766`
- :doc:`/components/sensor/pulse_counter`
- :doc:`/components/sensor/pulse_meter`
- :doc:`/components/time/homeassistant`
- :doc:`/cookbook/power_meter`
- :apiref:`total_daily_energy/total_daily_energy.h`
- :ghedit:`Edit`