Correction of Aqara sensor temperature measurement indication

Hi.

I have an Aqara sensor as in the picture. I need to correct the measurement because it cheats me a bit.

How can I do this?

Create a template sensor and correct the value this way:


    {%- set x = states('sensor.my_annoying_aqara') |float(0) %}

    {{ x - 0.1 }} ## or whatever value

1 Like

If you use zigbee2mqtt, just enter correction in field temperature_calibration.
I don’t know is this supported by ZHA.

I made this entry:

{%- set x = states('sensor.salon') |float(0) %} {{ x - 0.8 }} ## or whatever value

I get an error response. What am I doing wrong:

missed comma between flow collection entries (2:2)

 1 | entity: sensor.salon
 2 | {%- set x = states('sensor.salon' ...
------^

Is this a piece of your template sensor? Please post the whole code.

I’m posting screenshots because I’m typing from a smartphone. Configuration doesn’t seem to work. For example, I also wanted to change the unit.

Don’t use comma, use point:

1 Like

Unfortunately, neither dot nor comma work. Nothing changes for me.

Post a screenshot of state + attributes of that sensor (—> Developer Tools —> States).

I do it slightly different, but you’ll get the same result and probably the same error. …but give it a try:

template:
  sensor:
    - name: "Balkon"
      unique_id: balkon_temp
      device_class: temperature
      unit_of_measurement: °C # I guess K for you?
      state: "{{ ( states('sensor.salon') | float(0) +1.2 ) }}" #1.2 is the offset here

Can you show sensor.balkon?

I am asking you for help. Give me what I should enter in configuration.yaml for this correction to work. I’m doing it for the first time, so I’ll know.

If I didn’t type it in and didn’t modify it, unfortunately it doesn’t work.
The configuration is correct without errors but it doesn’t work.

Or maybe I need to install some add-on to the system??

Post a screenshot like that:

Seems to be a quite normal temperature sensor.

What in detail doesn’t work?

Hello. Can you send me the finished full code for temp correction? This thing doesn’t work for me. I must be doing something wrong. When I enter this code in the developer’s tools in the templates, it works, and when I enter this code in configuration.yaml, it no longer works. Maybe I’m missing some add-on?


template:
  - sensor:
    - name: Test Temp Correction
      unique_id: test_202211290712
      state: |-
        {%- set x = states('sensor.salon') |float(0) %}
        {{ x - 1.5 }}
      attributes:
        real: |-
          {%- set x = states('sensor.salon') |float(0) %}
          {{ x }}

Thank you. Everything works fine. My mistake: I forgot that it will be a new entity and I focused on the old one thinking that it will be corrected.

I have one more question: how to make a graph instead of showing the colors in the history?