Skip to content

How to Organize Home Assistant with Packages

21/05/2026

This article may contain affiliate links. If you buy through these links, the price is the same for you and the store pays me a small commission that helps keep Tecnoyfoto running.

A Home Assistant package groups YAML configuration for a single device or workflow. If a dishwasher setup uses a helper, power sensors, and several automations, those definitions can live together in one file. That makes the setup easier to find and maintain.

The video is in Spanish. You can follow the same setup using the example below.

1. Enable the packages directory

Back up your configuration. Create a packages folder next to configuration.yaml. In that file, add the packages: entry under homeassistant:.

homeassistant:
  packages: !include_dir_named packages

If there is already a homeassistant: section, add the line alongside its existing keys. If your configuration already loads packages, keep using that include. Your current automation and script files can coexist with packages.

With !include_dir_named, the filename becomes the package name. Put integration keys such as input_boolean: and automation: directly at the top level of each package file. Use unique filenames. If your setup uses !include_dir_merge_named, follow the different layout in the official packages documentation.

DEALS · OFFICIAL STORE

Discounts on SONOFF smart home

Wi-Fi switches, relays, sensors, LED strips and more. Deals change frequently in the official store.

Coupon: TECNOYFOTO (10% off at checkout)

View official deals Affiliate link Affiliate link · SONOFF store

2. Test a small package

Save this example as packages/package_test.yaml. It creates a test helper and an automation that posts a persistent notification when the helper turns on.

input_boolean:
  package_test:
    name: Package test

automation:
  - id: package_test_notification
    alias: Package test
    triggers:
      - trigger: state
        entity_id: input_boolean.package_test
        to: "on"
    actions:
      - action: persistent_notification.create
        data:
          message: Home Assistant loaded the test package.

Go to Developer tools → YAML and select Check configuration. If it passes, restart Home Assistant. Turn on input_boolean.package_test and check for the notification. Turn the helper off before running the test again.

If Home Assistant doesn’t load the package, check the directory name, the .yaml extension, the indentation, and the top-level keys. If it loads but the automation doesn’t run, confirm the entity ID and inspect the automation trace. See the Home Assistant troubleshooting guide for more ways to check the configuration.

3. Move one workflow at a time

Start with a small workflow and identify the automations, sensors, scripts, and helpers it uses. In the video, I show how a coding assistant can help prepare the move. Ask it for an inventory and proposed edits, then review the changes before applying them. Keep the existing IDs and references, and make sure every moved definition appears only once. Check automation id values and any unique_id values that your integrations use.

You can keep UI-managed items in the UI and reference their entity IDs from the package. Leave the internal storage files to Home Assistant.

Validate the configuration, restart, and run the workflow end to end before moving on. If it fails, restore the previous version and validate again.

The Salicru UPS integration with Home Assistant shows a real example of a package that holds the Modbus connection and sensors. See the hardware in my Salicru TWIN RT3 unboxing, or compare UPS types and runtime in my home UPS battery backup guide.

Continue reading

Next related guide · 13 min read

How to Protect Home Assistant Passwords with secrets.yaml and Codex

Protecting Home Assistant passwords with secrets.yaml is one of the most important improvements you can make as your installation grows. Automations, scripts, sensors, databases,…

Continue with this article