Using !include_dir_named at the top level?

Hi, I’m just starting to set up my home assistant and I’d like to split up the configuration at the top level entries. I had a look at the advanced documentation and it seems that include_dir_named should be the right way to create a typical conf.d directory. However it seems I can’t use that command at top level?

Eg. here is what I’d like to have in my configuration.yaml:

!include_dir_named conf.d

And then have


Is that possible somehow? Or do I need to configure the top level keys include each file manually?

Move your current conf elsewhere and try it. :slight_smile:

I don’t think it’s possible to chain include commands in included files though.

I don’t understand.

I’m not chaining anything.

Let me try to explain better. I currently have the following in my configuration.yaml:

tts:            !include conf/tts.yaml                                                                                  
device_tracker: !include conf/device_tracker.yaml                                                                       
camera:         !include conf/camera.yaml                                                                               
media_player:   !include conf/mediaplayer.yaml                                                                          
light:          !include conf/light.yaml                                                                                
notify:         !include conf/notify.yaml                                                                               
maxcube:        !include conf/maxcube.yaml                                                                              
group:          !include conf/group.yaml

There’s quite a bit of redundancy there. I would prefer if I could replace all those lines with a single line:

!include_dir_named conf

But that seems not to be supported, unless there’s a trick I’m not aware of.

1 Like

Move (rename) your real configuration elsewhere and create a dummy configuration.yaml to see if your suggestion possible or not.

I did try it - that’s why I said it doesn’t work and am asking for possible workarounds.

For completeness: config_check complains:

[homeassistant.util.yaml] while scanning a simple key in "/home/homeassistant/.homeassistant/configuration.yaml", line 103, column 1 could not find expected ':'