Logo: Setup Infrastructure

Setup Infrastructure

Communautéit
dcb
setup-infrastructure

Féiert dëst aus, wann Dir dëse Repo fir d'éischt opstellt, d'HA-Verbindung konfiguréiert oder iwwerpréift, ob d'Infrastruktur nach funktionéiert. Ausléiser-Phrasen: "set up my HA", "configure connection", "first time setup", "run setup", "reconnect to HA", "my token stopped working", "verify my setup".

Add to TypingMind

Iwwersiicht

Editeurdcb
Repositoryhomeassistant-claude-kit
Skill-Nummsetup-infrastructure
Stären
125
Forks
22
Matgeliwwert Dateien
Nëmmen Instruktiounen
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    dcb huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Setup Infrastructure an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/dcb/homeassistant-claude-kit/tree/main/.claude/skills/setup-infrastructure
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/dcb/homeassistant-claude-kit.git /tmp/homeassistant-claude-kit
mkdir -p .claude/skills
cp -r /tmp/homeassistant-claude-kit/.claude/skills/setup-infrastructure .claude/skills/setup-infrastructure
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Setup Infrastructure an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Setup Infrastructure automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Setup Infrastructure net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Setup Infrastructure

This skill configures the mechanical layer: HA API connectivity, SSH access, and initial config pull. It is idempotent — run it any time to verify or repair the connection without affecting your actual configuration.

Step 1: Data Consent & Privacy Mode

Only ask once per session. If the user already consented during an earlier invocation of this skill in the same conversation, skip this step entirely.

1a. Data consent — Before reading any Home Assistant data, inform the user:

"This skill will connect to your Home Assistant instance and read your entity registry, automation configs, and documentation files. This data is sent to Anthropic's API as part of this Claude conversation. See PRIVACY.md for full details. Continue? (yes / no)"

If the user says no, stop here and explain they can still use the repo manually.

1b. Privacy mode offer — Only ask if consent was given. Only ask once per session.

First check if privacy mode is already active: test -f .claude/privacy-patterns. If it is, say "Privacy mode is already enabled" and skip the offer.

If not active, ask:

"Would you like to enable privacy mode? This blocks Claude from directly reading your credentials, personal data files, and runtime state. Setup still works — shell commands handle connectivity. You can toggle this later with make privacy-on / make privacy-off. Enable privacy mode? (yes / no)"

If yes: cp .claude/privacy-patterns.example .claude/privacy-patterns If no: proceed without it.

Step 2: Check .env

Check whether .env exists in the repo root:

bash
test -f .env && echo "exists" || echo "missing"

If missing: Tell the user to copy .env.example to .env and fill in:

VariableDescriptionExample
HA_TOKENLong-lived access token (HA → Profile → Security → Long-Lived Access Tokens)eyJ...
HA_URLYour HA URL (local or remote)http://homeassistant.local:8123
HA_HOSTSSH hostname, IP, or SSH config aliashomeassistant.local or ha
SSH_USERSSH add-on user (usually root)root
HA_REMOTE_PATHRemote config directory (see note below)/config/ or /homeassistant/
VITE_GO2RTC_URLgo2rtc URL (camera streams) — leave empty if not using camerashttp://homeassistant.local:1984

HA_REMOTE_PATH note: HA OS with the SSH add-on typically uses /homeassistant/, while HA Container/Supervised uses /config/. If unsure, the SSH test in Step 4 will auto-detect the correct path.

IMPORTANT: The .env file must NOT use inline comments on value lines (e.g. HA_HOST=foo # comment). Makefile's include treats everything after = as the value, including # ... text. Use only full-line comments (lines starting with #).

Wait for the user to fill in .env before continuing.

If exists and privacy mode is OFF: Load the values and proceed.

If exists and privacy mode is ON (test -f .claude/privacy-patterns): Tell the user: "Privacy mode is active — I can't read .env directly. Please verify it has HA_TOKEN, HA_URL, HA_HOST, SSH_USER filled in. The next step will validate your connection." Then proceed to Step 3 — the curl test validates the values work via source .env (shell sourcing is intentionally not blocked by privacy mode).

Step 3: Validate HA API Token

Test the HA API is reachable:

bash
source .env && curl -sf -H "Authorization: Bearer $HA_TOKEN" "$HA_URL/api/" | python3 -c "import sys,json; d=json.load(sys.stdin); print('HA version:', d.get('version','unknown'))"
  • Success: Print the HA version and continue.
  • Failure: Show the curl error. Common fixes:
    • Token expired → generate a new one at HA → Profile → Security
    • Wrong URL → check if HA is running, try http:// vs https://
    • Network unreachable → ensure you're on the same network, or check VPN/Nabu Casa

Step 4: Validate SSH Connectivity

Test SSH access (required for make pull / make push).

IMPORTANT: Always include $SSH_USER@ in the SSH command. The .env has a separate SSH_USER variable (usually root) — do NOT connect as the local macOS/Linux user.

bash
source .env && ssh -o ConnectTimeout=5 -o BatchMode=yes "$SSH_USER@$HA_HOST" "echo ok" 2>&1
  • Success (ok): Continue to auto-detect HA_REMOTE_PATH.
  • Permission denied (publickey): SSH key not authorized. Run:
    bash
    source .env && ssh-copy-id "$SSH_USER@$HA_HOST"
    Or manually add ~/.ssh/id_rsa.pub (or id_ed25519.pub) to the SSH add-on's authorized keys in HA Settings → Add-ons → SSH & Web Terminal → Configuration.
  • Connection refused / No route to host: SSH add-on not running or wrong hostname. Check HA Settings → Add-ons → SSH & Web Terminal → Start.

Auto-detect HA_REMOTE_PATH

After SSH is confirmed working, verify that HA_REMOTE_PATH points to the correct directory:

bash
source .env && ssh "$SSH_USER@$HA_HOST" "test -f ${HA_REMOTE_PATH:-/config/}configuration.yaml && echo 'PATH_OK' || echo 'PATH_WRONG'"

If PATH_WRONG: Try the HA OS default path:

bash
source .env && ssh "$SSH_USER@$HA_HOST" "test -f /homeassistant/configuration.yaml && echo '/homeassistant/' || (test -f /config/configuration.yaml && echo '/config/' || echo 'NOT_FOUND')"

Update HA_REMOTE_PATH in .env with the correct path before proceeding. If NOT_FOUND, ask the user to verify their HA configuration directory location.

Step 5: Generate Derived .env Files

Once HA API + SSH are confirmed working, generate the derived config files:

dashboard/.env.local (Vite dev server + runtime):

bash
source .env
cat > dashboard/.env.local << EOF
# AUTO-GENERATED by setup-infrastructure — do not edit manually
# Re-run the setup-infrastructure skill to regenerate.
VITE_HA_URL=$HA_URL
VITE_HA_TOKEN=$HA_TOKEN
VITE_GO2RTC_URL=$VITE_GO2RTC_URL
EOF

Confirm the file was written:

bash
echo "dashboard/.env.local written"
cat dashboard/.env.local

Step 6: Run make pull

Pull the current HA configuration to the local config/ directory:

bash
make pull

This syncs automations, scripts, configuration.yaml, and .storage/ (entity/area registry) from your HA instance. The .storage/ files are used by setup-customize for entity discovery.

If make pull fails:

  • Check that HA_REMOTE_PATH in .env is correct — HA OS uses /homeassistant/, Container uses /config/
  • Verify SSH access in Step 4 (remember to use $SSH_USER@$HA_HOST)
  • Check .env has no inline comments (breaks Makefile include)
  • Run make pull manually and share the error

Step 7: Verify Python Tooling

Check the Python validation tools work:

bash
python3 -m venv venv 2>/dev/null || true && source venv/bin/activate && pip install -q pyyaml 2>/dev/null && python tools/yaml_validator.py config/ && echo "Validation tools OK"

If this fails, ensure Python 3.10+ is installed.

Step 8: Install ha-api / ha-ws on HA

Install claude-code-ha CLI tools on the HA instance. These provide ha-api (REST) and ha-ws (WebSocket) for entity management, state queries, service calls, and entity renaming — all accessible via SSH.

bash
source .env
# Clone path adapts to HA_REMOTE_PATH (tools live alongside configuration.yaml)
ssh "$SSH_USER@$HA_HOST" "test -d ${HA_REMOTE_PATH}claude-code-ha && echo 'ALREADY_INSTALLED' || (cd ${HA_REMOTE_PATH} && git clone https://github.com/danbuhler/claude-code-ha.git && echo 'CLONED')"
ssh "$SSH_USER@$HA_HOST" "bash ${HA_REMOTE_PATH}claude-code-ha/install.sh"

Verify it works:

bash
source .env && ssh "$SSH_USER@$HA_HOST" "source /etc/profile.d/claude-ha.sh; source ${HA_REMOTE_PATH}.env; ha-api domains"

If this prints entity counts by domain, the tools are working.

Note: HA OS updates reset the root filesystem (symlinks, pip packages). The repo persists at ${HA_REMOTE_PATH}claude-code-ha/ but re-run the install script after each HA OS update: ssh "$SSH_USER@$HA_HOST" "bash ${HA_REMOTE_PATH}claude-code-ha/install.sh"

Step 9: Write setup-state.json Checkpoint

Write a checkpoint so setup-customize knows the infrastructure is ready:

python
import json, datetime, os

state = {
    "schema_version": 1,
    "infrastructure": {
        "ha_url": os.environ.get("HA_URL", ""),
        "configured_at": datetime.datetime.now().isoformat(),
        "steps_completed": ["env", "token", "ssh", "pull", "venv", "ha_tools"]
    },
    "session": {
        "current_phase": "infrastructure_complete",
        "can_resume": True
    }
}
with open("setup-state.json", "w") as f:
    json.dump(state, f, indent=2)
print("Checkpoint saved to setup-state.json")

Run this via: source .env && python3 -c "$(cat << 'PYEOF' ... PYEOF)"— using a quoted heredoc to avoid shell expansion issues with the.env` values.

Step 10: Stamp the kit version anchor

.kit-version records which kit version this install is based on, so the upgrade skill can later compute what changed. It ships with version: already set; this step fills in commit: (the exact kit commit the install is on) so upgrades have a precise, history-independent baseline. Idempotent and ZIP-safe — re-running changes nothing, and an install with no git history still works.

Rules:

  • Write only commit: — never touch version: (the shipped value is authoritative; the upgrade skill bumps it later). This avoids any producer/consumer ambiguity.
  • Stamp commit: only when it is empty/missing; never overwrite a non-empty value (an upgrade may have advanced it).
  • If there is no .git directory or no reachable remote (e.g. a ZIP download), leave commit: "" and continue — version: alone supports baselining. Do not error.
python
import re, subprocess, pathlib

kv = pathlib.Path(".kit-version")
if kv.exists():
    text = kv.read_text()
    m = re.search(r'^commit:\s*"?([^"\n]*)"?\s*$', text, re.M)
    current = (m.group(1) if m else "").strip()
    if not current:
        sha = ""
        try:
            sha = subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True, text=True,
                                 timeout=5).stdout.strip()
        except Exception:
            sha = ""   # no git / ZIP install — leave commit empty, this is fine
        if sha:
            if m:
                text = re.sub(r'^commit:.*$', f'commit: "{sha}"', text, flags=re.M)
            else:
                text = text.rstrip() + f'\ncommit: "{sha}"\n'
            kv.write_text(text)
            print(f"Stamped .kit-version commit: {sha}")
        else:
            print("No git history (ZIP install?) — left .kit-version commit empty")
    else:
        print(f".kit-version already stamped (commit: {current}) — unchanged")
else:
    print(".kit-version not present — skipping stamp")

Completion

Tell the user:

"Infrastructure is ready. Your HA instance is connected and config has been pulled.

Next step: Run setup-customize to map your rooms and entities to the dashboard. Just say: 'set up my home' or 'run setup-customize'."

If the user asks about what was pulled, run ls config/ and show the directory structure.

Troubleshooting Reference

SymptomLikely causeFix
curl: (7) Failed to connectHA not reachableCheck URL, network, HA running
401 UnauthorizedBad/expired tokenGenerate new token in HA
ssh: connect to host ... port 22: Connection refusedSSH add-on offStart SSH add-on in HA
Permission denied (publickey)Key not authorizedssh-copy-id or add key manually
rsync: [Errno 2] No such fileWrong HA_REMOTE_PATHHA OS: /homeassistant/, Container: /config/
make: command not foundmacOS without Xcode toolsxcode-select --install
Permission denied (as local user)Missing SSH_USER@ in commandEnsure SSH_USER=root in .env
SSH works but make pull failsInline comments in .envRemove # ... from value lines

Heefeg gestallte Froen

Wat mécht de KI-Skill Setup Infrastructure?

Féiert dëst aus, wann Dir dëse Repo fir d'éischt opstellt, d'HA-Verbindung konfiguréiert oder iwwerpréift, ob d'Infrastruktur nach funktionéiert. Ausléiser-Phrasen: "set up my HA", "configure connection", "first time setup", "run setup", "reconnect to HA", "my token stopped working", "verify my setup".

Firwat Setup Infrastructure op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Setup Infrastructure besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Setup Infrastructure an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/dcb/homeassistant-claude-kit/tree/main/.claude/skills/setup-infrastructure an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Setup Infrastructure benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Setup Infrastructure benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Setup Infrastructure domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Setup Infrastructure gratis?

Jo. dcb huet de Skill ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇