What is YAML in Home Assistant?

YAML is the text-based format used to configure Home Assistant. This is where you describe how your setup should work – which automations exist and what should happen when specific conditions are met.

YAML is not a programming language, but in practice it is the code you write when you want to go beyond the graphical user interface. Home Assistant reads the YAML files and executes the logic you have defined.

In Home Assistant, YAML is used for automations, scripts, integrations, and dashboards. The advantage is full control and transparency. The downside is that correct indentation is critical – small mistakes can lead to configuration errors.

Home Assistant is split into multiple YAML files, each with its own purpose. configuration.yaml is the main file, while automations are typically stored in automations.yaml, reusable actions in scripts.yaml, and scenes in scenes.yaml. Dashboards can also be defined in YAML if full control is desired.

A simple example of an automation written in YAML could be:

id: taend_lys_ved_bevegelse
alias: Turn on light on motion
trigger:
  - platform: state
    entity_id: binary_sensor.motion_hallway
    to: "on"
action:
  - service: light.turn_on
    target:
      entity_id: light.hallway

YAML is the foundation for more advanced Home Assistant setups and the tool that gives you real control over the system’s behavior.

Related articles: Getting started with Home Assistant using AI