Compensating temperature (Linear) help

So I have looked at Compensation - Home Assistant documentation as well as the git hub and WTH threads on the matter. My understanding is that I have two options:

  1. Create a template sensor
  2. Use Compensation in the YAML.

I dont want to create a template sensor ( I have a few of them), so I am trying to get the Compensation to work. I have the following YAML:

compensation:
  temp_a_offset:
    source: sensor.temperature_humidity_sensor_temperature
    unit_of_measurement: °C
    unique_id: a84d2df6-4507-4426-a170-907968ca65b3
    data_points:
      - [1.0, 0.6]
      - [2.0, 1.6]

This does not seem to do anything.

I have tried it with and without the unit of measurement line.
I have adjusted the data points to make a more dramatic change:

      - [1.0, 10.6]
      - [2.0, 11.6]

but again, does not seem to affect the temperature showing in the system.

I am wondering if I am doing something wrong or I have misunderstood something?

I pasted your sensor into my own config using one of my own temp sensors as source, and it’s working as expected. Did you make sure to restart Home Assistant after altering the configuration?

1 Like

I think the OP believed there was not going to be a 2nd sensor…at least that was the idea behind using ‘compensation’, I only know this to work creating a 2nd sensor with ‘compensation’ in the naming

2 Likes

I didn’t originally pick this up from your post, but as @vingerha alludes, the Compensation integration does not alter the original sensor. It creates a new sensor. Your example will create a sensor with the entity id sensor.compensation_temp_a_offset.

1 Like

Thank you both vingerha and Didgeridrew! You are correct that I did not realize it was going to create a new sensor. I was able to find the new entity.

I feel like a bit of an idiot now (however it would be nice if the fact it created a new entity was listed in the docs for us newbies :P)

Thank you again!

Edit: now that I know it is creating a new sensor anyway, I ended up going with a template sensor for a linear adjustment:

  - sensor:
      - name: "Adjusted Room a Temperature"
        unique_id: a847aa6d-1c91-4a91-8eb2-4f333101d5c9
        state_class: measurement
        unit_of_measurement: °C
        device_class: temperature
        state: >
          {% set temperature = states('sensor.room_a_temperature') | float(0) %}
            {{ temperature - 0.5 }}

So did I for one of my temp sensors, the other one is ‘odd’ on its deviations so needed ‘compensation’
The creation of a new sensor is sort of implicit (for me) but the doc says to export a state and not a new sensor so… could be better indeed :slight_smile: