Home Assistant Guide

Simple tutorials for powerful automations

Understanding configuration.yaml in Home Assistant

configuration.yaml is the main configuration file used by Home Assistant. It acts as the central place where you define core settings, integrations, automations, and more - essentially, it's the "brain" of your Home Assistant setup. While many tasks can now be done through the Home Assistant user interface, you may occasionally need to edit configuration.yaml for advanced customizations or features that aren't available through the UI.

What is configuration.yaml?

configuration.yaml is a plain text file (written in YAML format) located in your Home Assistant configuration directory (usually /config or /homeassistant on your device). Home Assistant reads this file at startup to know how to set up your system.

When Do You Need to Use It?

  • Adding advanced integrations that aren't available through the UI
  • Customizing entities or fine-tuning how certain devices appear or behave
  • Adding or editing automations, scripts, and sensors (especially for features not yet in the UI)
  • Troubleshooting advanced issues or migrating settings between installs

For most day-to-day tasks, you can use Home Assistant's visual editors. However, power users, advanced integrations, or community guides may still refer to configuration.yaml.

How to Access & Edit configuration.yaml

  • Using File Editor add-on: From the Home Assistant sidebar, go to Settings → Add-ons, search for File Editor (or VS Code add-on), install and open it. You can then open configuration.yaml right in your browser.
  • Using Samba or SFTP: Install the Samba share or SSH & Web Terminal add-on, then access your Home Assistant files from your computer using File Explorer or an SFTP client. Find configuration.yaml in the root of your HA config folder.
  • Directly on the device: If you're running Home Assistant on Linux or Raspberry Pi and have terminal access, you can edit it with any text editor (e.g. nano configuration.yaml).

Always make a backup of your configuration file before making major changes. Even a single misplaced space or character can prevent Home Assistant from starting!

Best Practices

  • Use the UI where possible – Home Assistant's visual editors reduce mistakes and make it easier to manage your setup.
  • Follow YAML syntax strictly – YAML is space-sensitive. Indentation matters, and there are no tabs allowed - use spaces only.
  • Keep comments – You can use # to add comments explaining what different sections do. This is helpful for future troubleshooting.
  • Split your configuration – For bigger setups, you can split your YAML into multiple files using !include. For example, you might keep automations in automations.yaml.
  • Validate before restarting – Use Home Assistant's Check Configuration feature (Settings → System → Check Configuration) to catch errors before applying changes.

Saving Changes & Reloading

  • Reloading without Restart: Many changes (like automations, scripts, groups, etc.) can be reloaded without a full restart. Go to Developer Tools → YAML and click the relevant Reload button.
  • Restarting Home Assistant: Some changes (like new integrations or certain core settings) require a full restart. You can do this from Settings → System → Restart.

If you restart and see errors, don't panic - check the Notifications or Developer Tools → Logs to see what went wrong. Restore your backup if needed.

Quick YAML Basics

  • Indentation: Always use spaces (not tabs). Nested items must be indented equally.
  • Comments: Use # at the start of a line to add a comment.
  • Key-value pairs: Write as key: value. Strings with special characters or starting with ! should be in quotes.

Summary

While you'll rarely need to touch configuration.yaml as a beginner, understanding its role gives you more flexibility and unlocks advanced features. Remember to make backups, validate before restarting, and don't be afraid to ask the community for help if you run into issues!