Beginner: configuration.yaml error while parsing a block mapping

Hi,
I’m installed a Home Assistant current a vew days ago and I want to include a template in configuration.yaml.
When I check in in HA UI I got the error:

Error loading /config/configuration.yaml: while parsing a block mapping
in “/config/configuration.yaml”, line 2, column 1
expected , but found ‘}’
in “/config/configuration.yaml”, line 50, column 2

I have tried serveral failures I read in your community, but the failure is still here. I don’t know where it is.
I
My Configuration.yaml.:

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
template:
  - sensor:
      - name: "Energy Total"
        unique_id: energy_total
        state: >-
          {{
            [ states( 'sensor.shellyem3-3494547B6D80_cannel_a_energy'),
              states( 'sensor.shellyem3-3494547B6D80_cannel_b_energy'),
              states( 'sensor.shellyem3-3494547B6D80_cannel_c_energy'),
            ] | map('float') | sum
           }}
        availability: >-
          {{
            [ states( 'sensor.shellyem3-3494547B6D80_cannel_a_energy'),
              states( 'sensor.shellyem3-3494547B6D80_cannel_b_energy'),
              states( 'sensor.shellyem3-3494547B6D80_cannel_c_energy'),
            ] | map('s_number') | min
          }}
        unit_of_measumnt: kWh
        device_class: energy
        state_class: total_increasing

      - name: "Power Total"
        unique_id: power_total
        state: >-
          {{
            [ states( 'sensor.shellyem3-3494547B6D80_cannel_a_energy'),
              states( 'sensor.shellyem3-3494547B6D80_cannel_b_energy'),
              states( 'sensor.shellyem3-3494547B6D80_cannel_c_energy'),
            ] | map('float') | sum
          }}
        unit_of_measurement: W
        device_class: power
        state_class: measurement
        availability: >
          {{ not 'unavailble' in
             [ states( 'sensor.shellyem3-3494547B6D80_cannel_a_power'),
               states( 'sensor.shellyem3-3494547B6D80_cannel_b_power'),
               states( 'sensor.shellyem3-3494547B6D80_cannel_c_power') ]
 }}

What is wrong?

Best regards

Sislfitz

Is the last one in the wrong place ?

Also unavailable is spelt wrong

And I think you’ve used the energy entities instead of power ones ?

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
template:
  - sensor:
      - name: "Energy Total"
        unique_id: energy_total
        state: >-
          {{
            [ states( 'sensor.shellyem3-3494547B6D80_cannel_a_energy'),
              states( 'sensor.shellyem3-3494547B6D80_cannel_b_energy'),
              states( 'sensor.shellyem3-3494547B6D80_cannel_c_energy'),
            ] | map('float') | sum
           }}
        availability: >-
          {{
            [ states( 'sensor.shellyem3-3494547B6D80_cannel_a_energy'),
              states( 'sensor.shellyem3-3494547B6D80_cannel_b_energy'),
              states( 'sensor.shellyem3-3494547B6D80_cannel_c_energy'),
            ] | map('s_number') | min
          }}
        unit_of_measumnt: kWh
        device_class: energy
        state_class: total_increasing

      - name: "Power Total"
        unique_id: power_total
        state: >-
          {{
            [ states( 'sensor.shellyem3-3494547B6D80_cannel_a_power'),
              states( 'sensor.shellyem3-3494547B6D80_cannel_b_power'),
              states( 'sensor.shellyem3-3494547B6D80_cannel_c_power'),
            ] | map('float') | sum
          }}
        unit_of_measurement: W
        device_class: power
        state_class: measurement
        availability: >
          {{ not 'unavailable' in
             [ states( 'sensor.shellyem3-3494547B6D80_cannel_a_power'),
               states( 'sensor.shellyem3-3494547B6D80_cannel_b_power'),
               states( 'sensor.shellyem3-3494547B6D80_cannel_c_power') ]
          }}

So, you actually don’t need a template for any of these calculations, just use the sensor group helper with ‘sum’ as the math calc. All done via the UI, and it’ll handle all this junk for you.

1 Like

Hi Petro,

where can I find “Sensor Group Helper”? I’m brand new in Home Assistant.

THANKS!!!

Settings → Devices & Services → Helpers (tab) → + Create Helper (button) → Group

Hi Petro,
I found it and I configured it! Great!!!
On the other side: YAML is a very ridiculus tool. The error messages of a compiler are nicer. The syntax check of YAML is like an old tool. Tab are not allowed… and so on.
But help here is very good!!!

Best regards,
Sislfitz

Hi Holdestmade,
Thank you for your inputs. I was successful making my YAML config running without an errror message.
THANKS!!!

Sislfitz