Compensation


The Compensation integration consumes the state from other sensors. It exports the compensated value as state and the following values as attributes: entity_id and coefficients. A single polynomial, linear by default, is fit to all data points provided.

Configuration

To enable the compensation sensor, add the following lines to your configuration.yaml:

# Example configuration.yaml entry
compensation:
  media_player_db_volume:
    source: media_player.yamaha_receiver
    attribute: volume_level
    unit_of_measurement: dB
    data_points:
      - [0.2, -80.0]
      - [1.0, 0.0]

Configuration Variables

source string Required

The entity to monitor.

data_points list Required

The collection of data point conversions with the format [uncompensated_value, compensated_value]. e.g., [1.0, 2.1]. The number of required data points is equal to the polynomial degree + 1. For example, a linear compensation (with degree: 1) requires at least 2 data points.

unique_id string (Optional)

An ID that uniquely identifies this sensor. Set this to a unique value to allow customization through the UI.

attribute string (Optional)

Attribute to monitor.

degree integer (Optional, default: 1)

The degree of a polynomial. e.g., Linear compensation (y = x + 3) has 1 degree, Quadratic compensation (y = x2 + x + 3) has 2 degrees, etc.

precision integer (Optional, default: 2)

Defines the precision of the calculated values, through the argument of round().

unit_of_measurement string (Optional)

Defines the units of measurement of the sensor, if any.