Unexpected error calling config validator: argument of type 'NoneType' is not iterable

Hello I get this error when I test my config.
I have created a new template that sum my sensors that measures my Kwh to a total consumptions of energy.
the template is as follow

- platform: template
  sensors:
    energy_total:
    friendly_name: 'Total Energy'
    entity_id:
        - sensor.arsforbruknng_avfuktare
        - sensor.arsforbruknng_kallare
        - sensor.arsforbruknng_tvattmaskin
        - sensor.arsforbruknng_laddae_bilen
        - sensor.arsforbruknng_radiator_hallen
        - sensor.arsforbruknng_radiator_matrum
        - sensor.arsforbruknng_radiator_s_tvrum
        - sensor.arsforbruknng_radiator_o_tvrum
        - sensor.arsforbruknng_radiator_strykrum
        - sensor.arsforbruknng_varme_kok
    value_template: "{{ (states('sensor.arsforbruknng_avfuktare'))|float 
         + states('sensor.arsforbruknng_kallare')|float 
         + states('sensor.arsforbruknng_tvattmaskin')|float
         + states('sensor.arsforbruknng_laddae_bilen')|float
         + states('sensor.arsforbruknng_radiator_matrum')|float 
         + states('sensor.arsforbruknng_radiator_s_tvrum')|float
         + states('sensor.arsforbruknng_radiator_o_tvrum')|float
         + states('sensor.arsforbruknng_radiator_strykrum')|float
         + states('sensor.arsforbruknng_varme_kok')|float
         + states('sensor.arsforbruknng_radiator_hallen')|float |round(3)}}" 
    unit_of_measurement: "kWh"

then I hawe added this in configuration.yaml

template: !include total_energy.yaml

when I test my template it says it ok, and when I save my config.yaml it says ok. But when I test my total config this error appears.
If I comment away the include in config.yaml it seems ok.
I can not find whats wrong.

Please help
Tommy

Which LLM bullshit engine have you been listening to?

The posted sensor configuration is a mash-up of improperly indented, legacy template syntax (which doesn’t belong under the template top-level key) and non-sense.

The template under value_template is ok… though it has no protection against any of the entities’ states being unknown or unavailable.

The Template editor tool only understands Jinja templates, it cannot check the YAML structure or content.


You may want to consider using a Group Helper instead of a Template sensor in this case. When grouping sensors that have the same unit of measurement, you have the option to have the the grouped sensor entity’s state return one of a variety of statistical measures, including sum.

If you really want to use a Template sensor:

Current Template sensor syntax which is used under the `template` top-level key
- sensor:
    - name: 'Total Energy'
      default_entity_id: sensor.energy_total
      state: |
        {% set ent_list = this.attributes.entity_id | default( [],1) %}
        {{ ent_list | select('has_value') | map('states') | map('float',0) 
        | sum | round(3) }}
      unit_of_measurement: "kWh"
      state_class: measurement
      attributes:
        entity_id: |
          {{ ['sensor.arsforbruknng_avfuktare','sensor.arsforbruknng_kallare',
          'sensor.arsforbruknng_tvattmaskin','sensor.arsforbruknng_laddae_bilen',
          'sensor.arsforbruknng_radiator_hallen','sensor.arsforbruknng_radiator_matrum',
          'sensor.arsforbruknng_radiator_s_tvrum','sensor.arsforbruknng_radiator_o_tvrum',
          'sensor.arsforbruknng_radiator_strykrum','sensor.arsforbruknng_varme_kok'] }}

Tanks for your help, I used grouphelper and that work perfect
/Tomm