Problem with template for calculating the cost of daily oil consumption

Hello :slight_smile:

I would like to calculate the cost of our daily oil consumption, but the template does not work.
I would be really grateful for support.

    - name: "oil_kosten_täglich"
      unique_id: oil_kosten_täglich
      state: "{{ iif(states('sensor.olverbrauch_taglich'), (states('sensor.olverbrauch_taglich') | float*0,112) | round(2)) }}"
      unit_of_measurement: "Euro"
      icon: "mdi:cash"
      state_class: total_increasing
      device_class: monetary

I thought it would be easiest to calculate the value of the daily consumption with 0,112€, but the formula seems to be incorrect.

What does not work?
What is the state of sensor.olverbrauch_taglich?
What is the state of the template?

the template not work

Input sensor is Liter

The output state should be Euro

{{ iif(states('sensor.olverbrauch_taglich'), (states('sensor.olverbrauch_taglich') | float) *0.112 | round(2)) }}
  • floats always use a decimal comma
  • misplaced parenthesis

Keep in mind you can use the template debugger to test your templates

You made my day.
many thanks :star_struck: