Skip to content

home VM

Everything that belongs to Home Assistant lives in one VM on the Trusted network (VLAN 5), beside the HomePods and the Apple TV: Home Assistant, the Matter server, the MQTT broker, and later Scrypted (chapter 8) and the Cloudflare connector (chapter 9). Sitting on the Home hubs’ own network is what makes HomeKit, Matter and Thread work without help from the router: the VM learns the Thread route straight from the hubs’ router advertisements.

The stack is vm/home/compose.yaml, pushed from the Mac with scripts/vm-push.sh home.

Two paths.

  • Restore (parts A and C to E): the VM that runs Home Assistant today is moved as it is (R3). It keeps its address 10.0.5.20 for now, because the NAS still holds 10.0.5.2 for Scrypted’s cameras. Step 8.9 swaps the address once Scrypted has moved. The moved VM’s disk is not encrypted inside. FileVault covers it, and part F says how to switch to an encrypted VM later (J15).
  • From scratch (parts B to E): a new encrypted VM and an empty Home Assistant, with the versioned configuration from this repository laid on top.

Set the address this chapter works with:

Terminal window
export HOMEIP=10.0.5.20 # restore path. From scratch: 10.0.5.2 if `ping -c 2 10.0.5.2` gets no answer, else 10.0.5.20

Why. A UTM VM is one folder. Copying it while it is stopped moves Home Assistant, the Matter fabric and every pairing in one piece. The house has no Home Assistant between the stop and step 7.5, about 30 minutes: lights keep working from the Home app and the wall switches.

Mac (old)

  1. Take a fresh full backup in Home Assistant and download it (step 2.8, both halves).
  2. Stop the VM and copy its bundle to the new Mac (step 2.9).
  3. Remove its start-at-login agent, so the old Mac never starts a second copy: launchctl bootout gui/$(id -u)/local.homeassistant-vm; rm ~/Library/LaunchAgents/local.homeassistant-vm.plist.

Mac (new)

Terminal window
mv ~/Downloads/*.utm ~/Library/Containers/com.utmapp.UTM/Data/Documents/ # or double-click the bundle

In UTM, right-click the VM > Edit: rename it home, exactly. Under Network, confirm Bridged (Advanced) on en0, and keep the MAC address it had. Under Devices, confirm a Serial device in Pseudo-TTY mode, and add one if missing.

Terminal window
$U start home --hide
sleep 40; ping -c 3 $HOMEIP

Verify. The ping answers, and http://10.0.5.20:8123 shows the Home Assistant login within two minutes. Two Matter servers with the same fabric must never run at once: $U list on the old Mac shows the VM stopped.

Rollback. $U stop home --request on the new Mac, then $U start <old name> on the old one. Nothing inside the VM changed.

7.2 Your key, the short name, and the base settings

Section titled “7.2 Your key, the short name, and the base settings”

Why. The VM predates this guide’s base build. This step brings it to the same level as the others, except for the disk encryption: SSH by key only, the serial console, automatic security updates, capped logs.

Mac

Terminal window
sed -i '' '/^Host home$/,/^Host /s/HostName 10.0.5.2$/HostName 10.0.5.20/' ~/.ssh/config
ssh-copy-id -f -i ~/.ssh/mac-admin.pub admin@10.0.5.20 # asks for the VM user's current password
export VM=home VMIP=10.0.5.20
op item edit "VM home user" --vault Infrastructure 'password=THE_CURRENT_PASSWORD'
scp -r $INFRA/vm/common admin@$VMIP:/tmp/common

Then do steps 5.6, 5.7, 5.9 and 5.11 on it, and from step 5.10 only these lines:

Terminal window
ssh home 'sudo install -m 644 /tmp/common/etc/docker/daemon.json /etc/docker/daemon.json && sudo systemctl restart docker && sudo install -d -o admin -g admin /srv/stack'

Restarting Docker restarts Home Assistant: one minute of absence.

Verify. ssh home verify.sh 5 matches step 5.14, except luks, which prints NO LUKS VOLUME (expected on this path), and addresses, which shows 10.0.5.20.

Rollback. ssh home 'sudo rm /etc/ssh/sshd_config.d/10-hardening.conf && sudo systemctl reload ssh' gives password login back.

Why. A move changes one thing at a time. The stack file takes its image versions from vm/home/.env.tpl, so write today’s versions there before the new stack replaces the old one.

Mac

Terminal window
ssh home 'docker ps --format "{{.Names}}\t{{.Image}}"'

Edit $INFRA/vm/home/.env.tpl: set HA_VERSION to the tag shown for homeassistant (for example 2026.11.2), and MATTER_VERSION to the tag shown for matter-server. If that tag is stable, pin the exact version it resolves to: ssh home 'docker inspect -f "{{index .Config.Labels \"org.opencontainers.image.version\"}}" matter-server'. Leave the other lines for now.

Terminal window
cd $INFRA && git add vm/home/.env.tpl && git commit -m "home: pin the versions that run today"

Verify. grep -E '^(HA|MATTER)_VERSION' $INFRA/vm/home/.env.tpl shows the two versions you read.

Rollback. git revert HEAD.

Why. The repository’s file is the reviewed version (DNS on the new resolver, checksum offload off, the Thread route settings). On this path it is installed with the address the VM already has, so nothing moves yet.

Mac

Terminal window
sed -e 's#10.0.5.2/24#10.0.5.20/24#' -e 's#10.0.4.2/24#10.0.4.20/24#' $INFRA/vm/home/etc/network/interfaces | \
ssh home 'cat > /tmp/interfaces && sudo cp /etc/network/interfaces /etc/network/interfaces.before-guide && sudo install -m 644 /tmp/interfaces /etc/network/interfaces && sudo reboot'

Verify. After a minute: ssh home 'ip -br addr | grep enp0s1; cat /etc/resolv.conf' shows 10.0.5.20 on enp0s1, 10.0.4.20 on enp0s1.4, and nameserver 10.0.2.5 first.

Rollback. On the console (screen "$(vm-tty home)"): sudo cp /etc/network/interfaces.before-guide /etc/network/interfaces && sudo reboot.

7.5 Replace the old stack with the repository’s

Section titled “7.5 Replace the old stack with the repository’s”

Why. The old VM ran its Compose file from a clone of the repository inside the VM. From now on the Mac pushes the stack to /srv/stack, like on the other VMs, and the VM holds no git credential. The data folders (/srv/homeassistant/config, /srv/matter/data) are not touched: the new stack mounts the same paths.

Mac

Terminal window
ssh home 'sudo install -d -o admin -g admin /srv/mosquitto/data /srv/mosquitto/log /srv/scrypted'
op item get "Cloudflare tunnel home" --vault Infrastructure >/dev/null 2>&1 || \
op item create --vault Infrastructure --category "API Credential" --title "Cloudflare tunnel home" \
'credential[password]=not-set-yet' >/dev/null # placeholder, replaced in chapter 9
vm-push.sh home
ssh home 'cd ~/infrastructure/vm 2>/dev/null && docker compose down; cd /srv/stack && docker compose up -d matter-server homeassistant'

If the old stack already ran cloudflared (the tunnel of 2026-11-06), carry its token over before the push, so remote access survives the move: ssh home 'grep CLOUDFLARE_TUNNEL_TOKEN ~/infrastructure/vm/.env', then op item edit "Cloudflare tunnel home" --vault Infrastructure 'credential=THE_TOKEN', and after the push add docker compose --profile remote-access up -d cloudflared to the last command. Then remove the clone, which holds the old .env: ssh home 'rm -rf ~/infrastructure'.

Verify. ssh home 'docker ps --format "{{.Names}}\t{{.Status}}"' lists homeassistant and matter-server as Up. Home Assistant opens at http://10.0.5.20:8123, and Settings > Devices & services > Matter shows the devices online.

Rollback. ssh home 'cd /srv/stack && docker compose down', restore the old folder from the Mac (scp -r $INFRA/vm/home home:~/old-stack) and start it there. The data folders were never changed.

Go to part C.

Why. Same base as every VM (chapter 5), then the folders the stack mounts.

  1. Do chapter 5 with VM=home. In step 5.12, if HOMEIP is 10.0.5.20, first run on the VM sudo sed -i -e 's#10.0.5.2/24#10.0.5.20/24#' -e 's#10.0.4.2/24#10.0.4.20/24#' /tmp/interfaces.
  2. Then:

Mac

Terminal window
ssh home 'sudo install -d -o admin -g admin /srv/stack /srv/homeassistant/config /srv/mosquitto/data /srv/mosquitto/log /srv/scrypted && sudo install -d -o 1000 -g 1000 /srv/matter/data'
op item get "Cloudflare tunnel home" --vault Infrastructure >/dev/null 2>&1 || \
op item create --vault Infrastructure --category "API Credential" --title "Cloudflare tunnel home" \
'credential[password]=not-set-yet' >/dev/null # placeholder, replaced in chapter 9
vm-push.sh home

Verify. ssh home verify.sh 5 matches step 5.14, and the push ends with Stack pushed and valid on home.

Rollback. Delete the VM.

7.7 The versioned configuration, then first start

Section titled “7.7 The versioned configuration, then first start”

Why. The repository holds the automations, scenes, packages and the Home panel. Laying them down before the first start means Home Assistant comes up with the house’s logic already in place. What the repository does not hold is everything made in the web interface: integrations, devices, dashboards. Those you add again in step 7.8.

Mac

Terminal window
rsync -a $INFRA/homeassistant/config/ home:/srv/homeassistant/config/
rsync -a $INFRA/homeassistant/www/ home:/srv/homeassistant/config/www/
ssh home 'cd /srv/stack && docker compose up -d matter-server homeassistant && docker compose logs -f --tail 20 homeassistant'

Ctrl-C when the log settles. Open http://<HOMEIP>:8123. In the onboarding, create the owner account from a new 1Password login item Home Assistant admin (generate the password in 1Password first), set the home’s location, and skip the device suggestions.

The log lists integrations it cannot load (Integration 'x' not found) for the custom components the configuration expects. Step 7.8 installs them.

Verify. The dashboard loads, and Settings > System > Repairs lists only missing integrations.

Rollback. ssh home 'cd /srv/stack && docker compose down && sudo rm -rf /srv/homeassistant/config/.storage' returns to an empty onboarding.

7.8 Integrations, in the order that avoids rework

Section titled “7.8 Integrations, in the order that avoids rework”

Why. Entities referenced by the automations appear only once their integration exists. Matter and Thread come first because they take the longest to re-pair.

Order Integration How
1 Custom components Settings > Marketplace: install Adaptive Lighting, Hilo, the Hydro-Québec integration, FGLair, and any other named in the log. Restart Home Assistant. Then ssh home 'docker exec homeassistant sh /config/shell/fglair_repatch.sh' re-applies the Fujitsu fix kept in the repository
2 Matter Add integration > Matter, untick the app option, URL ws://localhost:5580/ws
3 Thread From the Home Assistant app on your iPhone: Settings > Companion app > Troubleshooting > Sync Thread credentials. Then Settings > Devices & services > Thread lists the Apple border routers
4 Matter devices In Apple Home, open each Matter device > Settings > Turn On Pairing Mode, and add it in Home Assistant with the code. Each device stays in Apple Home too
5 HomeKit Bridge Add integration > HomeKit Bridge. Domains: light, switch, sensor, binary_sensor, climate, cover, lock. Leave camera out: cameras reach Apple Home through Scrypted only. Scan the code from the Home app
6 MQTT After step 7.10: broker 127.0.0.1, port 1883, user homeassistant
7 UniFi Protect Host 10.0.5.1, the protect-local account of step 3.6, and an API key made under Protect > Settings > Control Plane > Integrations
8 The cloud ones Ford, Wallbox, iCloud, Environment Canada, Samsung TV, Synology DSM: sign in to each

Verify. Settings > System > Repairs is empty, and the Home panel in the sidebar shows rooms with live states.

Rollback. Remove an integration from its menu.

Part C. Both paths: network identity and Thread

Section titled “Part C. Both paths: network identity and Thread”

7.9 Tell Home Assistant which network it lives on

Section titled “7.9 Tell Home Assistant which network it lives on”

Why. Home Assistant announces itself (HomeKit Bridge, discovery) on the adapters ticked here. Only the Trusted adapter, enp0s1, is right. With the wrong one ticked, the HomeKit Bridge shows “No Response” in Apple Home.

In Home Assistant, Settings > System > Network:

  1. Network adapter: tick only enp0s1. Untick enp0s1.4 and every docker or veth adapter.
  2. Home Assistant URL > Local network: http://<HOMEIP>:8123.
  3. Never add an http: block to configuration.yaml: since 2026.11 these settings live on this page and a YAML block is ignored.

Save. Home Assistant restarts and asks you to confirm the new settings: confirm within five minutes, or it reverts.

Verify.

Terminal window
ssh home 'ip -6 route | grep -E "^fd[0-9a-f:]+/64 .*proto ra"' # the Thread route, learned from a border router
ssh home 'sysctl -n net.ipv6.conf.enp0s1.accept_ra net.ipv6.conf.enp0s1.accept_ra_rt_info_max_plen' # 2 and 64

The route line can take a few minutes after a start. sudo rdisc6 enp0s1 asks the hubs for an advertisement at once. The prefix differs from one Thread network to another and can change (J21): any fd…::/64 route with proto ra is the right sign. Toggle a Thread light from Home Assistant: it answers.

Rollback. Tick the previous adapter again.

Why. R8: the broker belongs with Home Assistant. Its configuration comes from the repository. The password file is the only part that never enters git.

Restore. The password file from the NAS keeps every client’s password valid:

Terminal window
cd ~/infra-migration/backups && mkdir -p mosq && tar -xzf mosquitto.tgz -C mosq
scp mosq/mosquitto/config/password_file home:/srv/stack/mosquitto/config/password_file

From scratch. Create the users. Home Assistant’s password is the one generated in step 2.3:

Terminal window
ssh home 'touch /srv/stack/mosquitto/config/password_file'
op read "op://Infrastructure/MQTT homeassistant/password" | \
ssh home 'read -r P; docker run --rm -v /srv/stack/mosquitto/config:/c eclipse-mosquitto:2.0.22 mosquitto_passwd -b /c/password_file homeassistant "$P"'

Both paths:

Terminal window
ssh home 'sudo chown 1883:1883 /srv/stack/mosquitto/config/password_file /srv/mosquitto/data /srv/mosquitto/log && sudo chmod 600 /srv/stack/mosquitto/config/password_file && cd /srv/stack && docker compose up -d mosquitto && docker logs mosquitto 2>&1 | tail -3'

vm-push.sh never deletes or replaces password_file.

In Home Assistant, Settings > Devices & services > MQTT > Configure > Re-configure MQTT: broker 127.0.0.1, port 1883, same user and password as before. Then repoint every other MQTT client from your list of step 2.6 (they point at 10.0.2.2 today) to the VM’s address.

hydroqc2mqtt does not move: Home Assistant already reads Hydro-Québec through its own integration. Stop that container on the NAS, and one day later, when the NAS broker’s log shows no client, stop eclipse-mosquitto there too and turn auto-restart off for both.

Verify. The log ends with mosquitto version 2.0.22 running. In MQTT > Configure > Listen to a topic, subscribe to #: messages from your devices appear. nc -zv $HOMEIP 1883 from the Mac succeeds.

Rollback. Point Home Assistant’s MQTT integration back at 10.0.2.2 and start the NAS container.

Section titled “Part E. Both paths: files, links to infra, and the checklist”

Why. You edit Home Assistant’s YAML from the Mac, and scripts/sync-from-live.sh reads the live files from /Volumes/config to bring them into git. The share accepts the Mac’s address only.

Mac

Terminal window
scp $INFRA/vm/home/samba/config-share.conf home:/tmp/
ssh home 'sudo apt install -y samba && grep -q "^\[config\]" /etc/samba/smb.conf || sudo sh -c "cat /tmp/config-share.conf >> /etc/samba/smb.conf"'
op read "op://Infrastructure/Samba config share/password" | \
ssh home 'read -r P; printf "%s\n%s\n" "$P" "$P" | sudo smbpasswd -s -a admin; sudo systemctl restart smbd'
op read "op://Infrastructure/Samba config share/password" | pbcopy
open "smb://admin@$HOMEIP/config" # paste the password, tick "Remember this password in my keychain"

Verify. ls /Volumes/config/configuration.yaml lists the file, and cat /Volumes/config/.HA_VERSION prints the running version.

Rollback. ssh home 'sudo apt purge -y samba'.

7.12 Connect Home Assistant to the infra VM

Section titled “7.12 Connect Home Assistant to the infra VM”

Why. Three links: the ad-blocking switch and figures, the health states the Home panel shows, and the VM’s logs.

  1. AdGuard Home integration: Add integration > AdGuard Home, host 10.0.2.5, port 8080, user admin, the password from AdGuard Home admin, SSL off. It gives the blocked share and a protection switch.
  2. Health sensors: if the package home-health.yaml from ha-home-panel is installed in /Volumes/config/packages/, set its Prometheus host to http://10.0.2.5:9090 (it was prometheus.local or 10.0.2.2), then Developer tools > YAML > REST entities reload. Use the address, not a name ending in .local: Home Assistant tries mDNS for those.
  3. Logs: start the collector that ships this VM’s container logs and journal to Loki.
Terminal window
grep -rn "10.0.2.2\|prometheus.local" /Volumes/config/packages/ /Volumes/config/configuration.yaml
ssh home 'cd /srv/stack && docker compose --profile logs up -d alloy'

Also fix any other integration the grep shows pointing at 10.0.2.2. The Synology DSM integration is the exception: it keeps that address, which becomes the NAS’s only one in chapter 11.

Verify. In Grafana’s Explore, {host="home"} returns Home Assistant’s log lines. In Home Assistant, the AdGuard entities show numbers. On the infra VM, the Prometheus target http://10.0.5.2:8123 turns up once the VM holds its final address (now on the from-scratch path, after step 8.9 on the restore path).

Rollback. docker compose --profile logs rm -sf alloy. Remove the integration.

Why. The companion app is how presence reaches Home Assistant, and a public login page is coming in chapter 9: accounts get a second factor before that.

  1. On each phone, Home Assistant app > Settings > Companion app > your server: Internal URL http://<HOMEIP>:8123. Restore path at the interim address: nothing to change yet.
  2. Your profile > Security > Multi-factor authentication modules: enable the authenticator app, with the code stored in the Home Assistant admin item in 1Password. Do the same on every other account, and delete accounts nobody uses.
  3. Settings > System > Network > HTTP server: Enable IP banning on, Unlimited login attempts off, Login attempts before ban 5.

Verify. Signing out and in again asks for the six-digit code.

Rollback. Disable the module in the profile.

Why. Each line is a path through a different part of the setup. All of them passing means the move is complete.

  • The Home panel loads in the sidebar, on the Mac and on a phone
  • Matter: every device online, and one light toggles from Home Assistant
  • The Nanoleaf lamp (HomeKit Controller over Thread) turns on and off
  • The Bilresa remote in the living room lights the room
  • Apple Home: the HomeKit Bridge accessories respond
  • The Fujitsu heat pump entities are available and a setpoint change is accepted
  • Hydro-Québec and Hilo sensors update
  • Ford and Wallbox entities update, and iCloud presence shows both phones
  • The Samsung TV turns on from Home Assistant (wake-on-LAN through VLAN 4): ssh home 'ip -br addr show enp0s1.4; ip route show dev enp0s1.4 | wc -l' shows 10.0.4.2 and 0 routes (J28)
  • Settings > System > Repairs and ssh home 'docker logs --since 10m homeassistant 2>&1 | grep -c ERROR' show nothing new
  • vm-down && vm-up, then vm-unlock all: Home Assistant is back within three minutes, and a Thread device still answers

Rollback of the whole chapter (restore path). Stop the VM here ($U stop home --request), start it on the old Mac, and put MQTT back on the NAS as in step 7.10’s rollback.

Part F. Later: switching the moved VM to an encrypted disk

Section titled “Part F. Later: switching the moved VM to an encrypted disk”

Converting a running root disk to LUKS in place is not simple (J15), so the switch is a rebuild with the data carried over. It takes about an hour, any day after chapter 8:

  1. ssh home 'cd /srv/stack && docker compose --profile "*" down && sudo tar -czpf /tmp/srv.tgz -C / srv', then scp home:/tmp/srv.tgz ~/infra-migration/ and vm-down.
  2. In UTM, rename the VM home-old. Build a new home with chapter 5 (it takes the same address, since the old one is stopped).
  3. scp ~/infra-migration/srv.tgz home:/tmp/ && ssh home 'sudo tar -xzpf /tmp/srv.tgz -C / --same-owner && cd /srv/stack && docker compose --profile "*" up -d'.
  4. Redo step 7.11 (the share), run the checklist of step 7.14, and delete home-old after a week.

The Matter fabric, the HomeKit pairings and Scrypted’s cameras all live under /srv, so nothing is paired again.

Home Assistant, the Matter server and the MQTT broker run in the home VM from the repository’s stack, with DNS, health and logs tied to the infra VM. The NAS no longer runs the broker or Hydro-Québec’s bridge. On the restore path the VM still answers at 10.0.5.20: the next chapter moves Scrypted in and gives it 10.0.5.2.