I´m getting mad with error messages

Hi, i am searching now for days… and i can not find the mistake.
when i put in the code below in my configuration.yaml, i get this error message:

´type´

The editor shows on the upper right corner a green hook, so everything seems to be ok…

    
#sensor:
  # Sensor for Riemann sum of energy import (W -> Wh)
      - platform: integration
        source: sensor.power_import
        name: energy_import_sum
        unit_prefix: k
        round: 2
        method: left

#  # Sensor for Riemann sum of energy export (W -> Wh)
      - platform: integration
        source: sensor.power_export
        name: energy_export_sum
        unit_prefix: k
        round: 2
        method: left

#  # Sensor for Riemann sum of energy consumption (W -> Wh)
      - platform: integration
        source: sensor.power_consumption
        name: energy_consumption_sum
        unit_prefix: k
        round: 2
        method: left   

Your comments are all at the wrong indent level for the rest of the code you’re creating.

YAML is indentation sensitive. Additionally, your sensor declaration is commented out.

If this is supposed to be your entire sensor declaration going directly into the configuration.yaml then it should look like this:

sensor:
  # Sensor for Riemann sum of energy import (W -> Wh)
  - platform: integration
    source: sensor.power_import
    name: energy_import_sum
    unit_prefix: k
    round: 2
    method: left

  # Sensor for Riemann sum of energy export (W -> Wh)
  - platform: integration
    source: sensor.power_export
    name: energy_export_sum
    unit_prefix: k
    round: 2
    method: left

  # Sensor for Riemann sum of energy consumption (W -> Wh)
  - platform: integration
    source: sensor.power_consumption
    name: energy_consumption_sum
    unit_prefix: k
    round: 2
    method: left
1 Like

Yaml is insensitive to comment indentation. The only place you can come unstuck in in template blocks or keys where you have to use {# example comment here #}

Tell that to all the yamllinters I have to deal with for work :wink:

Nevertheless Home Assistant is insensitive to it. This was all successfully commented out:

  action:
  #- service: notify.telegram_system
#    data:
            # title: '📈 <b>Cumulative Cost Reset</b>'
      # message: >
        # Monthly cumulative energy cost reset.