2018-11-10 14:31:59 +01:00
Total Daily Energy Sensor
=========================
2018-11-14 22:12:27 +01:00
.. seo ::
:description: Instructions for setting up sensors that track the total daily energy usage per day and accumulate the power usage.
2021-11-16 03:19:33 +01:00
:image: sigma.svg
2018-11-14 22:12:27 +01:00
2023-05-03 05:43:32 +02:00
The `` total_daily_energy `` sensor is a helper sensor that can use the power value of
2021-08-16 02:02:25 +02:00
other sensors like the :doc: `HLW8012 <hlw8012>` , :doc: `CSE7766 <cse7766>` , :doc: `ATM90E32 <atm90e32>` , etc and integrate
2018-11-10 14:31:59 +01:00
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 `` .
2018-11-19 18:32:16 +01:00
.. code-block :: yaml
2018-11-10 14:31:59 +01:00
# Example configuration entry
sensor:
- platform: total_daily_energy
2023-10-25 17:10:57 +02:00
name: 'Total Daily Energy'
2018-11-10 14:31:59 +01:00
power_id: my_power
2023-10-25 17:10:57 +02:00
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
2018-11-10 14:31:59 +01:00
# 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:
2023-10-25 17:10:57 +02:00
- platform: homeassistant
id: homeassistant_time
2018-11-10 14:31:59 +01:00
Configuration variables:
------------------------
- **power_id** (**Required** , :ref: `config-id` ): The ID of the power sensor
to integrate over time.
2021-11-25 22:57:08 +01:00
- **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 `` .
2021-08-17 21:16:33 +02:00
- **method** (*Optional* , string): The method to use for calculating the total daily energy. One of
`` trapezoid `` , `` left `` or `` right `` . Defaults to `` right `` .
2019-02-17 12:28:17 +01:00
- All other options from :ref: `Sensor <config-sensor>` .
2018-11-10 14:31:59 +01:00
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:
2018-12-05 10:23:02 +01:00
.. code-block :: yaml
2018-11-10 14:31:59 +01:00
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
2024-08-20 18:09:10 +02:00
Lifetime instead of Daily
-------------------------
For a more-generic version of this component which does not reset every midnight, see :doc: `integration` , which can provide device-lifetime values instead of daily values with the following example settings:
.. code-block :: yaml
# Example configuration entry
sensor:
- platform: integration
name: 'Total Energy'
sensor: my_power
time_unit: h
restore: true
state_class: total_increasing
device_class: energy
2018-11-10 14:31:59 +01:00
See Also
--------
- :ref: `sensor-filters`
- :doc: `hlw8012`
- :doc: `cse7766`
2024-08-20 18:09:10 +02:00
- :doc: `integration`
2023-10-25 17:10:57 +02:00
- :doc: `/components/sensor/pulse_counter`
- :doc: `/components/sensor/pulse_meter`
- :doc: `/components/time/homeassistant`
2019-02-07 13:54:45 +01:00
- :doc: `/cookbook/power_meter`
2019-05-12 22:44:59 +02:00
- :apiref: `total_daily_energy/total_daily_energy.h`
2019-02-07 13:54:45 +01:00
- :ghedit: `Edit`