Home Assistant Integration
Home Assistant is Sanctum’s haus automation hub. It runs as a Docker container on the Mac Mini with bridge networking, integrating Sonos speakers, HomeKit devices, and providing remote access through a Cloudflare tunnel. It used to run on the VM, but the VM’s networking had other ideas.

Architecture
Section titled “Architecture”┌──────────────────────────────────────────────┐│ Mac Mini ││ ││ ┌─────────────────────────────────────────┐ ││ │ Docker (bridge network) │ ││ │ │ ││ │ ┌─────────────────────────────────┐ │ ││ │ │ Home Assistant Container │ │ ││ │ │ Port 8123 → Web UI │ │ ││ │ │ Port 21063 → HomeKit Bridge │ │ ││ │ │ SSH agent → VM access │ │ ││ │ └─────────────────────────────────┘ │ ││ └─────────────────────────────────────────┘ ││ ││ Cloudflare Tunnel → ha.nepveu.name │└──────────────────────────────────────────────┘HA was migrated from the VM to Mac Docker because SLIRP networking on the VM proved unreliable for the number of integrations and real-time device communication required. Translation: the Sonos speakers kept dropping off, and no amount of debugging SLIRP made the problem go away. Some battles you win. Some you migrate around.
Docker Configuration
Section titled “Docker Configuration”The container uses bridge networking rather than --network=host because host networking is not supported on macOS Docker. This is the polite way of saying “Docker on Mac is a compromise and we’ve all agreed to live with it.”
Key Settings
Section titled “Key Settings”| Setting | Value |
|---|---|
| Image | ghcr.io/home-assistant/home-assistant:stable |
| Network mode | bridge |
| Web UI port | 8123 |
| HomeKit port | 21063 |
| Config directory | ~/.openclaw/homeassistant/ |
| Restart policy | unless-stopped |
Compose File
Section titled “Compose File”The compose.yaml at ~/.openclaw/homeassistant/ defines the container with these essential directives:
- Port mappings: 8123:8123 (web), 21063:21063 (HomeKit)
- Volume mount: Local config directory into
/config - Extra hosts:
host.docker.internal:host-gatewayfor reaching Mac services from inside the container - SSH agent socket:
/run/host-services/ssh-auth.sockmounted for agent forwarding to the VM
Docker Desktop is configured with auto-start enabled, ensuring HA comes up after a reboot without manual intervention.
Sonos Integration
Section titled “Sonos Integration”Sanctum manages 10 Sonos speakers. Because the HA container runs in bridge networking mode, mDNS/SSDP discovery does not work. All speakers must be configured as known hosts in configuration.yaml.
sonos: media_player: hosts: - 192.168.1.101 - 192.168.1.102 # ... all 10 speaker IPsText-to-Speech on Sonos
Section titled “Text-to-Speech on Sonos”The XTTS-v2 TTS server runs on the Mac (port 8008, using MPS GPU acceleration). To play speech on Sonos speakers, use the media_player.play_media service with a media-source://tts/ URI and the announce: true flag.
SSH Agent Forwarding
Section titled “SSH Agent Forwarding”The HA container needs SSH access to the VM for certain automations and scripts. This is accomplished by mounting the Mac’s SSH agent socket into the container.
The SSH agent socket at /run/host-services/ssh-auth.sock is mapped as a volume in the compose file. Scripts inside the container can then SSH to [email protected] using the Mac’s loaded SSH keys without storing any private keys in the container.
SSH wrapper scripts live at ~/.openclaw/ha-scripts/ and exec SSH directly to the VM with agent forwarding enabled.
Network Configuration
Section titled “Network Configuration”The configuration.yaml includes network-specific settings for the bridge networking environment:
homeassistant: internal_url: "http://192.168.1.10:8123" external_url: "https://ha.nepveu.name"
http: use_x_forwarded_for: true trusted_proxies: - 172.16.0.0/12 - 192.168.64.0/20The trusted proxies cover Docker’s internal bridge subnets, allowing HA to correctly identify client IPs when accessed through the Cloudflare tunnel or Docker’s bridge network.
Remote Access
Section titled “Remote Access”There are two remote access paths into HA, each serving a different purpose. Because one way in would have been too simple, and simplicity is what other people have.
Browser Access (Cloudflare Tunnel)
Section titled “Browser Access (Cloudflare Tunnel)”For accessing the HA web UI from a browser, a Cloudflare tunnel provides HTTPS with Zero Trust access controls.
| Component | Details |
|---|---|
| Tunnel name | manoir-nepveu |
| LaunchAgent | com.sanctum.tunnel |
| External URL | https://ha.nepveu.name |
| Route | ha.nepveu.name to localhost:8123 |
| Auth | Cloudflare Access OTP |
iPhone Companion App (Tailscale)
Section titled “iPhone Companion App (Tailscale)”The HA Companion app cannot handle Cloudflare Access’s login page, so it connects via Tailscale instead. Tailscale provides end-to-end WireGuard encryption, so HTTPS is not needed.
Companion App Setup
Section titled “Companion App Setup”-
Install Tailscale on iPhone and connect (do NOT enable exit node)
-
Install HA Companion
-
Open HA Companion → Settings → Companion App → Server & Connection
-
Configure connection URLs:
Field Value Internal URL http://<mac-lan-ip>:8123External URL http://<tailscale-ip>:8123 -
Under Internal Connection: add your haus Wi-Fi SSID so the app uses the LAN when haus
-
Enable Local Push for instant notifications on haus Wi-Fi
-
Test: turn off Wi-Fi briefly — the app should reconnect via Tailscale
HomeKit Bridge
Section titled “HomeKit Bridge”The HomeKit bridge runs on port 21063, allowing Apple Home app control of HA-managed devices.
| Setting | Value |
|---|---|
| Port | 21063 |
| Pairing code | 840-97-709 |
HomeKit entities are configured within HA’s integration settings. The bridge exposes selected devices to Apple Home while keeping the full HA device list available through the web UI.
Management
Section titled “Management”Starting and Stopping
Section titled “Starting and Stopping”# Start HAcd ~/.openclaw/homeassistant && docker compose up -d
# Stop HAcd ~/.openclaw/homeassistant && docker compose down
# View logsdocker logs -f homeassistant
# Restartcd ~/.openclaw/homeassistant && docker compose restartRollback
Section titled “Rollback”If the Mac Docker instance has issues, a rollback path exists to the VM:
- Stop the Mac container:
docker compose down - SSH to the VM:
ssh openclaw - Start the VM instance:
~/.openclaw/ha-docker.sh recreate