I already used the search function and also found the thread https://community.home-assistant.io/t/add-temp-offset-with-sensor-template/16114.
But I don’ t get it working.
How can I add a offset to my sensor data?
How can I hide the sensor DHT22 and only show the sensor value from the template?
From where do I get these entity_id, I found them in the database, is it the right way to get the names?
Thank you for your reply, the entity_id is right. But it seems not to work. The following should work, but it does not. value_template: '{{states.sensor.dht_sensor_humidity.state | float + 4}}'
If I enable the template, it seems like it generates too much data or something wents wrong as the raspberry gets really slow if I add the template.
I’ ll try something similar tomorrow with a dummy sensor.
With this code, you have created a template sensor, and you are taking the value from the template sensor that you just defined and adding 4 to it.
What you want to add 4 to is the DHT sensor which is defined previously. You should be able to find the entity id of that sensor in the developer tools.
Thank you. Now I found a solution. Hopefully the following information will also help others.
To hide the original sensor data (which is defined in sensors) use customize. Syntax for customize is sensor.enitity_id:
homeassistant:
customize:
# Add an entry for each entity that you want to overwrite.
sensor.dht_sensor_humidity:
hidden: true
Sensor section: Define the sensor (in my case dht).
Create a new entitiy_id with platform: template and the name sensor.dht_sensor_humidity_offset which includes the offset (in this example 4).
Guys, sorry for digging this very old post but need your help: I’ve got a humidity sensor which is definitely not properly calibrated and wanted to assign to its output a -8 (%) offset.
I’ve learned from your posts and basically added following lines to my configuration.yaml.
The strange thing is that, when I try to graph the new sensor values, it is shown as an history chart instead…
Light blue line (“camera bambine”) is the value I would like to correct and the history on top is the corrected value (offset -8).
Any idea?
Thanks, cheers.
It would be nice to have a feature that applies the offset only under certain conditions.
I have all lights energy consumption calculated according to some measurements but then I gather power/energy data from plug and the digestor has lights and ventilations, thus the lights are included through the plug, which I’d like to deduce from the digestor power consumption as I calculate them indirectly based on data/brigthness etc as all the flat, not directly as through meteres in plugs.
If you go to developer tools, then template and “reset to demo template”. There’s some example there with IF statements that you could use to accomplish this.
Adding to this old thread as it’s the top result when searching for “temperature offset” for home assistant.
All the above helped point me in the right direction, but I found it overly complicated with talk of editing yaml files and using templates in dev tools. The following was simple and worked for me so I’ll add it here for future folk like me
Settings–>Devices & services–>Helpers–>Create Helper–>Template–>Template a sensor
Add the following line in the State Template box:
{{states(‘sensor.name_of_sensor’) | float -1.0 }}
Adjusting name_of_sensor as you need and the -1.0 for the value you want to adjust by.
Fill in remaining info unit of measure, etc. Save the template with a suitable name (I use the same name as the sensor with “_calibrated” added on the end.