Dear all I,
I use Hassio and several aquara sensors. I works quiet well, but their temperature differs a bit from each other at the same spot. To fix this I wanted to add an offset via templating them, but somehow I did not get it…
I have created a file called sensors.yaml in this I have added:
There is no component called “template:” the config needs to be under “sensor:” there’s also problems with your template I suggest to take a look here:
Try like this:
sensor:
- platform: template
t_offset_room_a:
value_template: "{{ (states('sensor.room_a_t_h') | int + 5) | round(1)}}"
friendly_name: 'Room A Temp'
This code will generate a new sensor called sensor.t_offset_room_a, which will have your adjusted temperature. The temperature in the original entity will not be affected.
Does your sensor really have a difference of 5 degrees to the other sensor, seems pretty high?
Ooooooooh !
A slapped wrist there for @Burningstone, doubly so @tom_l , as I think he was in a thread recently where the exact same thing was pointed out.
Mind you, I sometimes have to put templates through the editor half a dozen times (with lots of head scratching between) before I catch the simplest mistakes
I mean I don’t want to have this calibration in the configuration.yaml instead in sensors.yaml but it did not work like I wrote it in my post in the beginning.
So I have no clue how to include the sensors.yaml into configuration.yaml, because template: !include sensors.yaml did not work properly.
You have marked your own post as the solution.
It is customary to mark the post who gave you answer as the solution (either Tom or Burning) to follow your example EVERY thread would be solved by the OP.
You may also find that your ‘offset’ is not linear and an mx+c suits better or even a polynomial, these can also be done. But the last thread I participated in on this subject. The error was merely perception and just the way the sensor updated - correction was not needed.
If you want the sensor in your sensor.yaml file then just put the include (as burningstone suggested) in there.
When I enter the code directly into configuration.yaml there must be a sensor: followed by the code, when indirectly, the sensor has still to be there, but followed by include! sensors.yaml and the code is in this data.