Template in development vs template in configuration.yaml

I run:

  • Installation methodHome Assistant OS
  • Core2026.4.3
  • Supervisor2026.05.1
  • Operating System17.2
  • Frontend20260325.7

Have a HACS HUAWEI integration - that works fine
in the Template in development, I can subtract "inverter_active_power" from what I export
but if I put that into "/homeassistant/configuration.yaml" - like this

template:

  • sensor:
    • name: efb
      state: efb = states('sensor.inverter_active_power') | float() - states('sensor.ams_c074_po') | float() }}"" }

it show like this:

what is it I do wrong here ???

thanks in advance

John

Please follow Community Questions Guideline #11 by using the “Preformatted text” option on any code or YAML configuration so that it is properly formatted. It can be difficult to determine the source of an issue if we cannot tell whether the proper indentation and syntax has been followed.


The Template Editor tool only understands Jinja. It cannot check the validity of your YAML. That being said, what you have shared would not "work fine" in the Template Editor either.

The sensor is returning exactly what you told it to return:

efb = states('sensor.inverter_active_power') | float() - states('sensor.ams_c074_po') | float() }}"" }

Major Issues:

  • No opening delimiters.
  • No surrounding quotes or block scalar indicator.
  • efb = is nonsense in Jinja without Statement delimiters {%%} and a statement command like set.
  • Random garbage, "" }, at the end of the line.

Minor Issues:

  • No default values for float filters and/or defined availability.
template:
  - sensor:
      - name: efb
        state: "{{states('sensor.inverter_active_power') | float(0) - states('sensor.ams_c074_po') | float(0)}}"
1 Like

Hi - thanks a lot - but I have allready been there ... and it is not explains what I do wrong - and since there no way of doing subtraction direct in HA - I guess I have to give up - but thanks for link ..

Thanks a lot, that help to get the right value
sorry that my lack of yaml syntax is that high