Creating template

hi to everyone!
I am trying to create my first template in configuration.yaml, I am trying to sum sensor values.
in the template editor under the developer tools the code works, but when I copy the code into the configuration.yaml, this error happen:
end of the stream or a document separator is expected (33:1)
30 | module_url: /local/panel-re …
[u] 31 | [/u]
[u] 32 | # template**[/u]**
[u] 33 | - platform: template**[/u]**
[u]------^[/u]
[u] 34 | sensors:[/u]
[u] 35 | Total_yield:[/u]

here is the code in gui editor:

CAN YOU PLEASE HELP ME OUT??
THANK YOU VERY MUCH.

Your problem is not in the template itself. It looks to me like you’ve pasted it in the wrong place, but it’s hard to tell from the information you’ve supplied.

Paste in your sensor configuration from configuration.yaml including surrounding sections (particularly the bit before containing module-url), and format it properly please. Read this before responding:

Also, you’re using the legacy template sensor configuration. Consider using modern configuration instead, under the template: heading. See here:

Shouldn’t it be:

sensor:
  - platform: template
    sensors:
      total_yield:
        friendly_name: "Name"
        unit_of_measurement: 'kWh'
        icon_template: mdi:solar-power
        value_template: "{{ your template }}"
1 Like