Is Config file messed up

So I am trying to split my config file before it gets to overcrowded. Today I was trying to implement the secrets file. I fought for two days to get the automation file working and I still do not know how I pulled that one off. Can someone take a quick looks and see where I have messed up.

 Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

homeassistant:
  customize: !include customize.yaml
  automation: !include automations.yaml
  script: !include scripts.yaml
  scene: !include scenes.yaml
 #secret: !include secrets.yaml


#Text to speech
tts:
  - platform: google_translate



wyzeapi:
  username: !secret personal_email
  password: !secret wyzeapipassword


sensor:
  - platform: mqtt
    name: "Sun Status"
    state_topic: "Sensor/Sun/Status"
    
  - platform: mqtt
    name: "Sun Elevation"
    state_topic: "Sensor/Sun/Elevation"
    unit_of_measurement: "degrees"
    

You don’t need to declare it as an include, as long as the secrets.yaml file exists in config directory you can use

Storing secrets - Home Assistant (home-assistant.io)

Make sure I understand. If all those files I have with the include are in the same directory. I can just do something like this:

wyzeapi:
  username: !secret personal_email
  password: !secret wyzeapipassword

Does that hold true for all the others?

Welcome to the Community, @ksu1971! As @aidbish mentioned, you need to have the secrets file (secrets.yaml) in the config directory - this is the same one your configuration.yaml is in. For your configuration, it would look like this:

personal_email: [email protected] # obviously made this up
wyzeapipassword: my_secret_password

Make sure the spacing is spot-on, as yaml is VERY particular about spacing - bit me a number of times. No space at the beginning of the above line and just one space after the colon.

Hope this helps! If you continue to have trouble, post a portion of your secrets.yaml file (with the secret stuff replaced with dummy characters, which I’m pretty sure you already know…).

On a totally unrelated note, are you a K-State alum? I taught there for 20+ years.

EDIT: I should have asked if you run the config validation checker in Configuration -> Server Controls. This will tell you a little more about anything wrong in the configuration file structure, including the include files. Ideally, you want to see this result:
image

the other includes are required. The secrets.yaml doesn’t need to be referenced as an include

Thanks everyone. I think I got it figured out. @KSC Yes I graduated from that fine university in 98. Spent many hours in Calvin.

1 Like

There are a number of ways to include files as part of the configuration file system. I use the !include_dir_merge_list option which lets me do this:

input_number: !include_dir_merge_named config-include-files/input-numbers/
input_boolean: !include_dir_merge_named config-include-files/input-booleans/
sensor: !include_dir_merge_list config-include-files/sensors/
automation: !include_dir_merge_list config-include-files/automations/
binary_sensor: !include_dir_merge_list config-include-files/binary-sensors/

The subdirectory config-include-files is in the config directory. Then, for example, I have a number of files that have all my automations. They are all in the config-include-files/automations/ subdirectory that looks like this:
image

You’ve probably already found this, but the HA write-up on !include is: Splitting up the configuration - Home Assistant (home-assistant.io)

Note that the secrets.yaml file is NOT included - HA knows to look for it in the config directory.

So did my wife! She decided to get an MBA while we were there. I think they are in a new building now, but not sure. We loved it there, but the call of family and a career change brought us back to Chicago - we miss Kansas!

  automation: !include automations.yaml
  script: !include scripts.yaml
  scene: !include scenes.yaml

These three are indented too far, they don’t belong in the homeassistant: block, they each have their own block so need to be indented on the same level as homeassistant:

homeassistant:
  customize: !include customize.yaml

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

OK makes sense. So homeassistant: makes a dictionary and customize is part of that dictionary. The others stand alone.

I am sure there is some document that explains that to me. I will dig around and try to find it.

Thanks again everyone.