# Smart Home — Home Assistant Integration project for the home Home Assistant instance running on **RogueOne**. ## Connection | | | |---|---| | Host | **R2D2** (Unraid, `10.10.40.10`, VLAN 40) | | Base URL | `http://10.10.40.10:8123` | | Version | Home Assistant 2026.7.2 | | API | REST (`/api/...`), Bearer token auth | | Status | ✅ Connected — token stored in Vaultwarden ("Home Assistant - R2D2") | ## Auth token (one-time setup) Home Assistant uses **long-lived access tokens**. Create one in the HA UI: 1. Open `http://10.10.40.10:8123` → click your **user name** (bottom-left). 2. **Security** tab → scroll to **Long-Lived Access Tokens** → **Create Token**. 3. Name it `claude-smart-home`, copy the token (shown once). Then store it — do **not** commit it to a file: ```powershell # Save to Vaultwarden org "Homelab - Claude" (preferred) bw create ... "Home Assistant - R2D2" # already done — stored 2026-07-20 # Or just export it for the current shell $env:HA_TOKEN = "" ``` ## Usage (bun — this machine has no node) ```bash $env:HA_TOKEN="..."; bun ha.js ping # verify connection + HA version bun ha.js states # all entities -> data/states.json (+ domain summary) bun ha.js states light # just the "light" domain bun ha.js get light.kitchen # one entity bun ha.js services # available services -> data/services.json bun ha.js call light turn_on '{"entity_id":"light.kitchen"}' ``` Or use the wrapper (auto-pulls the token from Vaultwarden): ```powershell pwsh -File scripts\connect.ps1 ping ``` ## Layout ``` smart-home/ ha.js # bun HA REST client (ping/states/get/services/call) config.example.json # baseUrl + which env var holds the token config.json # (optional) local override, gitignored scripts/connect.ps1 # pull token from Vaultwarden + run a command data/ # entity/service dumps (gitignored) ``` ## Notes - RogueOne is on the home LAN (`192.168.1.x`), not the VLAN-30/40 lab network. - The token is **never** hard-coded — `ha.js` reads it from `$env:HA_TOKEN`.