Cannot work out a simple temperature offset!

I’ve read countless threads and guides and I cannot work out what I need to do. All I want is to add a -6 degree c to the following sensor:

“sensor.soil_sensor_temperature”

What exactly am I suppose to add to my config for something that should be so simple :sweat_smile:

You can’t change that sensor, but you can create a template sensor that will report the value you want. Use the Helpers tab to create a Template sensor, and your template will be

{{ states('sensor.soil_sensor_temperature') - 6 }}

Now you can use this new helper sensor in whatever situation you want the offset temperature to be displayed or used in automations, etc.

1 Like

Close. Sensor states are strings and need converting to numbers first:

{{ states('sensor.soil_sensor_temperature')|float(0) - 6 }}
2 Likes

That works! Thanks!!!

1 Like

I make this error every time. It’s nice that the UI for creating new template sensors shows a live preview so you can catch this kind of mistake right away. This is also a good reason to play around in the Template tab of the Developer Tools when creating new template sensors or templates to use in automations.

2 Likes