Integration Sensor


The integration platform 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. In this implementation, we follow the Trapezoidal rule.

Configuration

To enable Integration Sensor in your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry
sensor:
  - platform: integration 
    source: sensor.current_power

Configuration Variables

source

(string)(Required)The entity ID of the sensor providing numeric readings

name

(string)(Optional)Name to use in the frontend.

Default value: source entity ID meter

round

(integer)(Optional)Round the calculated integration value to at most N decimal places.

Default value: 3

unit_prefix

(unit)(Optional)Metric unit to prefix the integration result. Available units are k, M, G, T.

Default value: None

unit_time

(unit)(Optional)SI unit of time to integrate over. Available units are s, min, h, d.

Default value: h

unit

(string)(Optional)Unit of Measurement to be used for the integration.

If ‘unit’ is set then ‘unit_prefix’ and ‘unit_time’ are ignored.

Energy

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 unit_of_measurement), then you can use the integration sensor to track how much energy is being spent. Take the next 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 who will have your energy in kWh.