Groups.yaml error when I create a group

Hi all, I’m trying to use the file groups.yaml in order to have all groups declared in that file.
I started with a group of device trackers.
I declared the groups.yaml file in the configuration.yaml in this way:

#Include files
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
sensor: !include sensors.yaml

Than in the groups.yaml I declared my group in this way:

group:
  family_tracker:
    name: "Family tracker"
    entities:
      - device_tracker.cellulare_luca
      - device_tracker.cellulare_ornella

but I got the following error message:

Failed to restart Home Assistant

The system cannot restart because the configuration is not valid: Invalid config for [group]: [family_tracker] is an invalid option for [group]. Check: group->group->group->family_tracker. (See /config/configuration.yaml, line 6).

what am I doing wrong? do you have any idea?

You included the domain word group: inside of the groups.yaml file. Remove it.


Explanation

This part

!include groups.yaml

in this

group: !include groups.yaml

serves as a substitute for the entire contents of groups.yaml.

By putting group: on the first line of the file you effectively duplicated it.

1 Like

Thanks for your answer, now it works :slight_smile:

1 Like