This integrations provides the Riemann sum of the values provided by a source sensor. The Riemann sum is an approximation of an integral by a finite sum.
The integration sensors are updated upon changes of the source. Fast sampling source sensors provide more accurate results. In this implementation, the default is the Trapezoidal method, but Left and Right methods can optionally be used.
Adding Integration - Riemann sum integral to your Home Assistant instance can be done via the user interface, by using this My button:
If the above My button doesn’t work, you can also perform the following steps manually:
Browse to your Home Assistant instance.
In the sidebar click on Settings.
From the configuration menu select: Devices & Services.
In top of the screen click the tab: Helpers.
In the bottom right, click on the Create helper button.
From the list, search and select “Integration - Riemann sum integral”.
Follow the instruction on screen to complete the set up.
Alternatively, this integration can be configured and set up manually via YAML
as well. To enable the Integration sensor in your installation, add the
following to your
# Example configuration.yaml entry sensor: - platform: integration source: sensor.current_power
An ID that uniquely identifies the integration sensor. Set this to a unique value to allow customization through the UI.
Round the calculated integration value to at most N decimal places.
Metric unit to prefix the integration result. Available units are
SI unit of time to integrate over. Available units are
In case you expect that your source sensor will provide several subsequent values that are equal, you should opt for the
left method to get accurate readings.
The unit of
source together with
unit_time is used to generate a unit for the integral product (e.g. a source in
W with prefix
k and time
h would result in
kWh). Note that
unit_time are also relevant to the Riemann sum calculation.
An integration sensor is quite useful in energy billing scenarios since energy is generally billed in kWh and many sensors provide power in W (Watts).
If you have a sensor that provides you with power readings in Watts (uses W as
power), then you can use the
integration sensor to track how much energy is being spent. Take the next manual YAML configuration as an example:
sensor: - platform: integration source: sensor.current_power name: energy_spent unit_prefix: k round: 2
This configuration will provide you with
sensor.energy_spent which will have your energy in kWh, as a