Skill-Details

home-assistant

Direct Home Assistant device control, state queries, automations, and operations.

ÜbereinstimmungDirektGeprüft für home assistant
Quelleviktorbarzin/infraExterne Quelle
Gemeldete Installationen1Nur Popularitätssignal

Vor Nutzung prüfen

Die automatische Prüfung bewertet Relevanz, nicht Sicherheit oder Empfehlung. Lies vor der Nutzung die Quellanweisungen.

Gespeicherte Quellvorschau

SKILL.md

Dieser Auszug wurde bei der Prüfung gespeichert. Die externe Quelle enthält die vollständige und aktuelle Version.

---
name: home-assistant
description: |
  Control Home Assistant smart home devices and automations. Use when:
  (1) User asks to turn on/off lights, switches, or devices,
  (2) User asks about the state of sensors, devices, or entities,
  (3) User says "turn on the lights", "set temperature", "lock the door",
  (4) User asks to run a scene or script,
  (5) User asks "what devices are on?" or "is the door locked?",
  (6) User mentions smart home, IoT, or home automation.
  There are TWO Home Assistant deployments: ha-london (default) and ha-sofia.
  Always use Home Assistant for smart home control.
author: Claude Code
version: 2.1.0
date: 2026-06-24
---

# Home Assistant Control

## Problem
Need to control smart home devices, check sensor states, or run automations via Home Assistant.

## Context / Trigger Conditions
- User asks to control lights, switches, covers, climate, etc.
- User asks about device states ("is the light on?", "what's the temperature?")
- User wants to run a scene or script
- User mentions turning things on/off
- User asks about smart home devices

## Deployments

There are **two** Home Assistant instances:

| Instance | URL | SSH | Default? |
|----------|-----|-----|----------|
| **ha-london** | `https://ha-london.viktorbarzin.me` | `ssh [email protected]` | Yes |
| **ha-sofia** | `https://ha-sofia.viktorbarzin.me` | `ssh [email protected]` | No |

- **Default**: ha-london (use unless user specifies "sofia" or "ha-sofia")
- **Aliases**: "ha" or "HA" = ha-london. "ha sofia" or "ha-sofia" = ha-sofia.

## Prerequisites
- Python 3 with `requests` package available (installed via PYTHONPATH or system packages)
- Environment variables for each instance:
  - **ha-london**: `HOME_ASSISTANT_URL` and `HOME_ASSISTANT_TOKEN`
  - **ha-sofia**: `HOME_ASSISTANT_SOFIA_URL` and `HOME_ASSISTANT_SOFIA_TOKEN`
  - If those env vars aren't set (e.g. you're not in the infra repo / Claude venv), don't hand-roll a `kubectl | base64 | jq` token pipeline — use the global **`homelab` CLI** instead (on `$PATH` in any directory):

## homelab CLI (preferred — works from any directory)
- **Token**: `homelab ha token [--instance sofia|london]` resolves the long-lived API token live from the cluster. Use it directly in curl: `curl -H "Authorization: Bearer $(homelab ha token)" https://ha-sofia.viktorbarzin.me/api/states`. (The `home-assistant-sofia.py` script also auto-falls-back to this when its env var is unset.)
- **Host shell** (ha-sofia): `homelab ha ssh -- <cmd>` runs a command on the HA host with deterministic non-interactive ssh (no host-key prompt) — e.g. `homelab ha ssh -- "sudo docker ps"`, `homelab ha ssh -- "cat /config/configuration.yaml"`. Replaces bespoke `ssh -o StrictHostKeyChecking=no …` invocations.
- **Cluster metrics/logs** (not HA-specific): prefer `homelab metrics query "<promql>"` / `homelab logs query "<logql>"` over hand-rolled `curl …/api/v1/query`, and `homelab claim`/`release` over calling `scripts/presence` directly.

## API Control

### Scripts

| Instance | Script |
|----------|--------|
| ha-london | `.claude/home-assistant.py` |
| ha-sofia | `.claude/home-assistant-sofia.py` |

### Execution Pattern (CRITICAL)
Run the scripts directly with python3 (env vars are set in the environment):

```bash
# ha-london (default)
python3 .claude/home-assistant.py [command] [options]

# ha-sofia
python3 .claude/home-assistant-sofia.py [command] [options]
```

### Available Commands

#### List Entities
```bash
# List all entities
python .claude/home-assistant.py list

# List by domain
python .claude/home-assistant.py list --domain light
python .claude/home-assistant.py list --domain switch
python .claude/home-assistant.py list --domain sensor
python .claude/home-assistant.py list --domain climate
python .claude/home-assistant.py list --domain cover

# JSON output
python .claude/home-assistant.py list --json
```

#### Search Entities
```bash
# Search by name or ID
python .claude/home-assistant.py search "living room
Vollständige Quelle auf GitHub lesen (öffnet externe Seite)
Kontext

Verwandte Arbeit