ha-edit-automation

Edits Home Assistant automations, scenes, scripts, and template sensors in an Ansible-managed k3s homelab.

2|Updated Mar 3, 2026
One-click install
npx skills add https://github.com/DanielH2018/server --skill ha-edit-automation-danielh2018
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ha-edit-automation
Source: https://github.com/DanielH2018/server/tree/main/.claude/skills/ha-edit-automation
Command: npx skills add https://github.com/DanielH2018/server --skill ha-edit-automation-danielh2018

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Home Assistant configuration in this homelab lives entirely in an Ansible role under ansible/roles/k8s/home-assistant/, and UI edits are overwritten on deploy. This Skill guides you through making correct, idempotent changes to automations, scenes, scripts, and template sensors the repo's way, avoiding the common traps of inline Jinja, missing ConfigMap wiring, and stale state models. ## Core Features & Use Cases - File routing: Maps each change type (automation, scene, script, template sensor, helper, threshold) to the exact file under the role, including defaults/main.yml registration for new files. - Tested Jinja macros: Enforces putting tunable math (fan curves, lux gates, wake ramps) in custom_templates/*.jinja macros with pytest coverage instead of inline YAML formulas. - ConfigMap and state-model wiring: Ensures new files get lookup('file') lines in configmap.yaml.j2 and regenerates state/derived_state.yml when entity writers change. - Use Case: You want to add a new fan-speed automation with a temperature curve. The Skill directs you to create files/automations/fan-and-air.yaml entries, extend the tested macro in custom_templates/fan.jinja, register the file, validate, deploy via ha-deploy, and confirm the entity loaded. ## Quick Start Ask the assistant to add a new Home Assistant automation that dims the bedroom lights at sunset using this repo's conventions.

Frequently Asked Questions about ha-edit-automation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new Home Assistant automation in an Ansible-managed repo?▼

Add the automation to a topic file under files/automations/ in the home-assistant role, or create a new YAML file and register it in home_assistant_automation_files in defaults/main.yml. Then validate with validate_ha_config.py, deploy via Ansible, and confirm the entity loaded.

How do I edit Home Assistant config when it runs on k3s?▼

Edit the files under ansible/roles/k8s/home-assistant/, which are copied verbatim into ConfigMaps and rolled out to the pod. Never edit through the HA UI, since deploys overwrite UI changes.

Why can't I put Jinja templates in configuration.yaml?▼

Files like configuration.yaml, customize.yaml, and ui-lovelace.yaml ship verbatim via lookup('file'), so any {{ }} syntax would reach Home Assistant unrendered. The validator rejects Jinja in those files; put templates in templates.yaml, automations, or scripts instead.

Why is my new Home Assistant config file not loading after deploy?▼

A new files/*.yaml or custom_templates/*.jinja needs its own lookup('file') line in templates/configmap.yaml.j2 plus an install line in deployment.yaml.j2 and an !include if HA must load it. Without that wiring the deploy succeeds but the pod never sees the file.

How do I test Home Assistant Jinja macros before deploying?▼

Add tests under the role's tests/ directory using the jinja_harness.py environment and run pytest. Note that HA's round is banker's rounding (half-to-even), so test midpoint values explicitly.