The bracket starts a Jinja2 line.
The characters following the bracket decide how the line should be treated.
{% is an internal handled line
{{ is a line that returns a result
YAML is key-value pairs.
The format is key: value, like platform: template
So far, for help all others having this issue:
Goal: measure the kWh left Garage Battery by an Ingoing and Outgoing kWh sensor of an inverter.
I firstly have created 2 sensor counter to keep trace of daily increment of power Ingoing and Outgoing (avoiding finding them offline by the subtraction template).
Then i create a template helper to do subtraction from the two sensor created like that: {{ (( states('sensor.inv_gar_in_fisso') | float (0) + 0 ) | float (0) - ( states('sensor.inv_gar_out_fisso') | float (0) + 10 ) ) /1 }} and everithing worked well.
Now one last problem:
The “autoconsumption” (well known costant) of the inverter between “in sensor” and “out sensor”.
Can anyone suggest how to costantly or daily increment the “out sensor” of x kWh?
Sorry for my explenation if anyone understand and want to explain better is welcome.