top of page

How to Edit configuration.yaml on HA Green — File Editor Setup and Real-World Examples

  • Writer: Andrea Leandri
    Andrea Leandri
  • 5 days ago
  • 5 min read

Skill level: Beginner | Time to complete: 20-30 minutes to install, then use it forever

What you'll build: A working File Editor installation for editing configuration.yaml from your browser, plus a walkthrough of real configuration.yaml additions: HTTPS, external URL, log tuning, scan intervals, REST commands, and template sensors.

Why You Need This

On HA Green there is no keyboard and no screen. The only way to edit files like configuration.yaml is either via SSH or via a browser-based file editor. The File Editor add-on gives you a simple code editor inside your HA dashboard. Open it, navigate to any config file, edit, save, reload. That is it.

Things that require configuration.yaml edits that the UI cannot handle: enabling HTTPS with SSL certificates, setting your external URL for remote access, silencing noisy log entries from specific integrations, adding REST commands for local API devices, creating custom template sensors, and tuning scan intervals for specific sensors.

This post will introduce you to some of the nice fine tunings that ought to be made to a clean sheet configuration.yaml in accordance to what you want or have installed but please remember that none of the following adjustments are needed straight away. You will apply them only if you decide to follow the other posts or similar developments. The examples provided here are to make you understand how a simple editor can be useful later on.

Part 1: Install the File Editor Add-on

Settings -> Add-ons -> Add-on Store -> search File editor. Install File editor by the Home Assistant team. Start it, enable Start on boot, and enable Show in sidebar. Click File editor in the sidebar to open it.

To open configuration.yaml: click the folder icon at the top left of the file tree -> navigate to /config/configuration.yaml -> click it. The file opens in the editor.

Always click Save before restarting HA. After saving, use Developer Tools -> YAML -> Check Configuration to catch syntax errors before restarting.

Part 2: The Three Golden Rules

  • YAML is whitespace-sensitive. Use spaces, not tabs. Two spaces per level. A single wrong indent breaks the entire file. The File Editor highlights syntax errors to help you find them.

  • Always check config before restarting. Developer Tools -> YAML -> Check Configuration. A failed restart from a bad config can lock you out of HA temporarily.

  • Comment your changes. Add a comment above any block you add explaining what it does and when. Your future self will thank you.

Part 3: Real configuration.yaml Sections Explained

The default skeleton

Every HA installation starts with this. Never remove these lines - they load core integrations and file includes:

default_config:

frontend:
  themes: !include_dir_merge_named themes

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

HTTPS and SSL

If your HA is accessible from the internet via a custom domain (DuckDNS + Let's Encrypt), add HTTPS configuration here:

http:
  ssl_certificate: /ssl/fullchain.pem
  ssl_key: /ssl/privkey.pem
  use_x_forwarded_for: true
  trusted_proxies:
    - 127.0.0.1
    - ::1

ssl_certificate and ssl_key point HA at your Let's Encrypt certificate files. use_x_forwarded_for tells HA to trust the forwarded IP header from your router. trusted_proxies lists the IP addresses of proxies HA should trust - 127.0.0.1 is localhost, ::1 is IPv6 localhost.

Optional hardening - auto-ban IPs after too many failed login attempts. Start with these commented out while getting the setup right:

  # ip_ban_enabled: true
  # login_attempts_threshold: 3

External URL

Tells HA what its own public address is - critical for Alexa integrations, webhook callbacks, and the Companion App:

homeassistant:
  external_url: "https://yourhouse.duckdns.org:8123"

Without this, HA sometimes generates internal links that do not work when away from home, and integrations that call back to HA (like the Alexa/Haaska integration) may fail to resolve the correct address. If running on port 443 omit the port; on port 8123 include it explicitly.

Taming the logs

On a mature setup with many integrations, the HA log fills with repetitive harmless warnings. The logger block lets you silence specific integrations without hiding everything:

logger:
  default: warning
  logs:
    homeassistant.loader: error
    homeassistant.components.some_integration: critical
    custom_components.some_custom_component: error
    websockets.server: error

Log levels from most to least verbose: debug (everything), info (normal operation), warning (unexpected but not broken, the default), error (something failed), critical (silence almost completely). When you see a repeated warning in HA logs, the source is shown in brackets - e.g. [homeassistant.components.some_integration]. That bracketed string is exactly what you put under logs:. After saving, reload with Developer Tools -> YAML -> Reload Logger Settings (no restart needed).

Sensor scan intervals

The customize block overrides the default scan interval per entity - useful for sensors that update too fast (wasting resources) or too slowly (stale data):

homeassistant:
  customize:
    # Check alarm sensor every 10 seconds for near-real-time updates
    sensor.echo_device_next_alarm:
      scan_interval: 10

    # Check a cloud sensor less often to reduce API calls
    sensor.some_cloud_sensor:
      scan_interval: 300

scan_interval is in seconds. Default varies by integration, most are 30-60 seconds. Note: customize sits inside the homeassistant: block alongside external_url, not nested inside it.

REST commands for local API devices

Some devices have their own local HTTP APIs but no HA integration. The rest_command block lets you call these APIs from automations as if they were native HA services:

rest_command:
  device_speed_high:
    url: "http://your-device.local/api/command"
    method: POST
    headers:
      Content-Type: application/json
    payload: '{"command": "high"}'

  device_speed_low:
    url: "http://your-device.local/api/command"
    method: POST
    headers:
      Content-Type: application/json
    payload: '{"command": "low"}'

Once defined, each command becomes callable in automations as rest_command.device_speed_high. Use this for ventilation units, local API energy monitors, or any device with a documented HTTP endpoint that lacks an official HA integration.

Template sensors

Template sensors create virtual sensors computed from existing values. Covered in depth in the Garden Watering guide on this site, but the pattern is:

template:
  - sensor:
      - name: "is_daytime"
        unique_id: is_daytime
        state: >
          {{ now().hour >= 8 and now().hour < 22 }}

      - name: "total_power"
        unique_id: total_power
        unit_of_measurement: "W"
        state: >
          {{ (states('sensor.circuit_1_power') | float(0)
             + states('sensor.circuit_2_power') | float(0)) | round(1) }}

A Full Example Structure

Here is what a well-organised configuration.yaml looks like with several sections added. The section comments are purely for readability - YAML ignores them, but they make it much easier to navigate as the file grows.

# Loads default set of integrations. Do not remove.
default_config:

frontend:
  themes: !include_dir_merge_named themes

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

# --- NETWORK & SECURITY ---

http:
  ssl_certificate: /ssl/fullchain.pem
  ssl_key: /ssl/privkey.pem
  use_x_forwarded_for: true
  trusted_proxies:
    - 127.0.0.1
    - ::1

# --- LOGGING ---

logger:
  default: warning
  logs:
    homeassistant.loader: error
    custom_components.some_integration: error

# --- HOME ASSISTANT CORE ---

homeassistant:
  external_url: "https://yourhouse.duckdns.org:8123"
  customize:
    sensor.some_sensor:
      scan_interval: 10

# --- INTEGRATIONS ---

alexa:
  smart_home:

# --- REST COMMANDS ---

rest_command:
  device_high:
    url: "http://your-device.local/api/command"
    method: POST
    headers:
      Content-Type: application/json
    payload: '{"command": "high"}'

# --- TEMPLATE SENSORS ---

template:
  - sensor:
      - name: "my_custom_sensor"
        unique_id: my_custom_sensor
        state: >
          {{ some_expression }}

After Every Edit - The Checklist

  1. Save the file in File Editor (floppy disk icon or Ctrl+S)

  2. Developer Tools -> YAML -> Check Configuration

  3. Reload or restart depending on what changed: logger changes = Reload Logger Settings (no restart); template sensors = Reload Template Entities; REST commands = Reload All YAML; HTTP or homeassistant blocks = full restart required

  4. After restart: check Settings -> System -> Logs for any new errors

Troubleshooting

  • HA won't start after editing: A YAML syntax error is almost always the cause. Always run Check Configuration before restarting. Restore from a backup if needed.

  • Invalid config error: The error message includes the file and line number. Look for wrong indentation, a missing colon, or a tab instead of spaces.

  • File Editor not in sidebar: Settings -> Add-ons -> File editor -> Info tab -> Show in sidebar toggle -> On.

  • Changes not taking effect: Some blocks need a full restart, not just a reload. When in doubt, do a full restart.

  • Accidentally saved a broken config: Settings -> System -> Backups -> restore the last known good backup.


Guide written by a Home Assistant enthusiast in Utrecht. The File Editor is one of the first add-ons to install on any new HA setup - you will use it constantly.

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page