Skip to content

Move device configs into devices/ subfolder - #87

Merged
nuttytree merged 1 commit into
masterfrom
chore/restructure-devices-folder
Aug 1, 2026
Merged

nuttytree merged 1 commit into
masterfrom
chore/restructure-devices-folder

Conversation

@nuttytree

Copy link
Copy Markdown
Owner

The repo root had accumulated 21 device yamls sitting alongside the files that describe the repo itself — lint config, docs, scripts, license — and finding anything meant scrolling past the device list. The ESPHome dashboard only scans the top level of its config directory, so the devices could not simply be filed into a subfolder while the container still mounted the repo root; the fix is to move the whole config surface down one level and point the container at that instead.

devices/ now holds the device yamls, their packages/, and secrets.yaml, and is what gets mounted as /config. Everything repo-level — components/, docs/, scripts/, lint config — stays at the root, out of the dashboard's way.

The one config change this forces is how devices reach the custom components. components/ deliberately stays at the repo root (it is a published surface, consumed by external users via source: github://nuttytree/ESPHome-Devices), so the five devices that use local components now reference ../components. That path resolves identically from the container and from a host esphome CLI run, which is what keeps both workflows working off the same yaml.

Changes:

  • Move the 21 device yamls, packages/, and secrets.yaml into devices/. Git recorded all 40 as renames, so history follows the files.
  • Point external_components at path: ../components in hvac, master-bed, pool-lights, pool, and water-heater. The !include ./packages/... lines and packages/secrets.yaml's !include ../secrets.yaml needed no change, since those moved together.
  • Update .gitignore: /secrets.yaml and /build/ become /devices/secrets.yaml and /devices/build/ (build_path: ./build/${device_id} resolves relative to the device yaml, so builds now land under devices/). Also ignore /devices/.gitignore, which ESPHome rewrites on every compile when absent and whose rules are already covered here.
  • Update scripts/tag_esphome_version.py to glob devices/*.yaml and read devices/.esphome/.device-builder-devices.json. Without this the post-commit tagging hook would silently find no devices and skip forever.
  • Re-point every path reference in README.md, CLAUDE.md, and the four docs/*/README.md pages, and describe the new layout and the mount arrangement.

Requires a docker change on upgrade: the container must mount devices as /config and components alongside it, or ../components will resolve outside the mount and the five affected devices will fail validation.

volumes:
  - <repo>/devices:/config
  - <repo>/components:/components

Device Builder state (.esphome/, .device-builder*) was moved into devices/ out of band rather than in this commit, since it is untracked local state. Because the mount point is still /config, the absolute paths baked into the existing build caches stay valid and nothing needs rebuilding.

Verified with esphome config on all 21 device yamls from their new location — all valid, including every device that resolves a local component through the new ../components path. pre_commit run --all-files passes clean.

The repo root had grown cluttered with 21 device yamls mixed in among
repo-level files. The ESPHome dashboard only scans the top level of its
config directory, so the device yamls, their packages/, and secrets.yaml
now live together in devices/, which becomes the directory mounted as
/config in the container. Everything repo-level (components/, docs/,
scripts/, lint config) stays at the root.

Devices reference custom components as ../components rather than
./components, which resolves identically inside the container and from a
host esphome CLI run, provided components/ is bind-mounted alongside
devices/.

Co-Authored-By: Claude <noreply@anthropic.com>
@nuttytree
nuttytree merged commit ae08726 into master Aug 1, 2026
4 of 5 checks passed
@nuttytree
nuttytree deleted the chore/restructure-devices-folder branch August 1, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant