Syntax for custom/compound statistics sensor?

Hi,

I want to build a sensor that shows the difference between the outdoor temp as provided by the weather integration and a tempsensor inside the house.

I checked the statistics integration for that and i can find how build a sensor that takes the mean from different sensors and combines it → Statistics - Home Assistant

However there is no description of a subtraction operation, but I found something similar here: Subtracting two values from two sensors in a template

Is there somewhere a tutorial or description of the syntax for this calculation?

alue_template: "{{ ( ('sensor.energy_meter_mains_power') | float) - ( ('sensor.energy_meter_kitchen_power') | float) }}"

Id like to build some more complex sensors in the future.

Cheers
F.

value_template: "{{ states('sensor.energy_meter_mains_power') | float(0) - states('sensor.energy_meter_kitchen_power') | float(0) }}"

Also:

https://jinja.palletsprojects.com/en/3.1.x/templates/

Ah great, I always had assumed templates to be something else, but ill look into that. thanks