Again error in yaml

Hi,

again the yaml code seems to be corrupt. I copied it from the website: Home Assistant Müllkalender einrichten ♻️

This ist my yaml code:

waste_collection_schedule:
  sources:
    - name: jumomind_de
      args:
        service_id: mymuell
        city_id: 71133
        area_id: 760
        
  sensor:
  # ------- Garbage Collection ------- 
  # next collection
  - platform: waste_collection_schedule
    name: "Nächste Abholung"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
  # Nächste Restmüll-Abholung
  - platform: waste_collection_schedule
    name: "Restmüll"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
    types:
      - Restmüll
  # Nächste Biomüll Abholung
  - platform: waste_collection_schedule
    name: "Biomüll"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
    types:
      - Bio Müll
  # Nächste gelber-Sack Abholung
  - platform: waste_collection_schedule
    name: "Gelber Sack"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
    types:
      - Gelber Sack
  # Nächste Papiermüll Abholung
  - platform: waste_collection_schedule
    name: "Papier"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
    types:
      - Papiertonne

Error Message from Homeassistant:

Cannot quick reload all YAML configurations because the configuration is not valid: Invalid config for [waste_collection_schedule]: [sensor] is an invalid option for [waste_collection_schedule]. Check: waste_collection_schedule->waste_collection_schedule->sensor. (See /config/configuration.yaml, line 286).

Can someone help me? I searched really a lot…

thanks

Shouldn’t that be:

  sensor:
  # ------- Garbage Collection ------- 
  # next collection
    - platform: waste_collection_schedule
      name: "Nächste Abholung"

In yaml (and Python) the spacing is critical. trypically in a section where a word ends with a colon, the following lines are indented at least two spaces from the one above (?)

When you are in the file editor, did you look to the upper right corner to see if there was a red exclamation point (which shows if the alignment is incorrect)?

Nope. As long as the spacing is consistent in each block any number of spaces is valid. Two is just convention. These are both valid:

  sensor:
  - platform: waste_collection_schedule
    name: "Nächste Abholung"
  sensor:
        - platform: waste_collection_schedule
          name: "Nächste Abholung"

This is not:

  sensor:
    - platform: waste_collection_schedule
    name: "Nächste Abholung"

Shouldn’t sensor: be inline with waste_collection_schedule: ? (assume this is your configuration.yaml)

waste_collection_schedule:
  sources:
    - name: jumomind_de
      args:
        service_id: mymuell
        city_id: 71133
        area_id: 760
        
sensor:
  # ------- Garbage Collection ------- 
  # next collection
  - platform: waste_collection_schedule
    name: "Nächste Abholung"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
  # Nächste Restmüll-Abholung
  - platform: waste_collection_schedule
    name: "Restmüll"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
    types:
      - Restmüll
  # Nächste Biomüll Abholung
  - platform: waste_collection_schedule
    name: "Biomüll"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
    types:
      - Bio Müll
  # Nächste gelber-Sack Abholung
  - platform: waste_collection_schedule
    name: "Gelber Sack"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
    types:
      - Gelber Sack
  # Nächste Papiermüll Abholung
  - platform: waste_collection_schedule
    name: "Papier"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
    types:
      - Papiertonne
1 Like

Yeah. That is the issue. I was looking up the docs to check but got distracted with other topics.

Thanks for the tip (there was misalignment though, I just had the wrong spot!)

Nothing works.
The confusing thing for me is, that in the upper right corner is a green hook. So everything seems to be ok for the yaml editor. But when i wan´t to restart there ist the error (see above)

Thank you for help… Any other ideas?