Template Sensor Formula Error

Hi,

I created a template sensor from the UI integration to get the available power in my house. The calculation is quite simple, I take the maximum allowed power, given in kVA, multiply this value by 1000 to have it in VA and then substract the actual power at any given time. All data is taken from a Zigbee sensor that pulls data from the french Linky.

Sadly, I surely wrote my formula with an errot since the entitiy is unavailable.
Here is the code I used

{{ states('sensor.lixee_pref') * 1000 | float -states('sensor.lixee_sinsts') | float }}

PS: How can I know which language is used and then know its grammar to write a suitable code ?

Cheers

You are turning the number 1000 into a floating point number, not the sensor state value. Try:

{{ states('sensor.lixee_pref') | float * 1000 - states('sensor.lixee_sinsts') | float }}

The language is jinja. See:

And

https://palletsprojects.com/projects/jinja

2 Likes