I have two temperature sensors and want to calculate the temperature difference and use that as a new sensor.
{{ states("sensor.temperature_livingroom") }} - {{ states("sensor.temperature_bedroom") }}
I used Dev Tools → Template to build the jinja code and this shows: “22 - 18”
The state of the new sensor is ‘unknown’ instead of ‘4’ what i expected.
Am i doing something wrong?