Compensation
The Compensation integrationIntegrations connect and integrates Home Assistant with your devices, services, and more.
[Learn more] consumes the stateThe state holds the information of interest of an entity, for example, if a light is on or off. Each entity has exactly one state and the state only holds one value at a time. However, entities can store attributes related to that state such as brightness, color, or a unit of measurement.
[Learn more] from other sensorsSensors return information about a thing, for instance the level of water in a tank.
[Learn more]. It exports the compensated value as state in a separate entityAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service.
[Learn more] 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]
media_player_db_volume:
source: media_player.yamaha_receiver_zone_2
attribute: volume_level
unit_of_measurement: dB
# Ensure that the sensor's value will not have a state lower than -80.0
# when the source sensors value is less than 0.2
lower_limit: true
# Ensure that the sensor's value will not have a state greater than 0.0
# when the source sensors value is greater than 1.0
upper_limit: true
data_points:
- [0.2, -80.0]
- [1.0, 0.0]
Configuration Variables
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.
An ID that uniquely identifies this sensor. Set this to a unique value to allow customization through the UI.
Attribute from the source to monitor/compensate. When omitted the state value of the source will be used.
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.
Defines the precision of the calculated values, through the argument of round().
Enables a lower limit for the sensor. The lower limit is defined by the data collections (data_points
) lowest uncompensated_value
. For example, if the lowest uncompensated_value
value is 1.0
and the paired compensated_value
is 0.0
, any source
state less than 1.0
will produce a compensated state of 0.0
.
Enables an upper limit for the sensor. The upper limit is defined by the data collections (data_points
) greatest uncompensated_value
. For example, if the greatest uncompensated_value
value is 5.0
and the paired compensated_value
is 10.0
, any source
state greater than 5.0
will produce a compensated state of 10.0
.