Skip to content

Cameras

The cameras belong to UniFi Protect on the UDM Pro, and that does not change: Protect records them around the clock. Two things read from Protect. Scrypted carries the cameras into Apple Home, with HomeKit Secure Video. Home Assistant shows live video and uses the cameras’ detections through its own UniFi Protect integration. No camera is ever asked for a second stream, and nothing is transcoded.

Scrypted runs as a container in the home VM (J5), on the same network as the Home hubs. HomeKit Secure Video only records when Scrypted and the hubs share a subnet, and this placement gives that for free.

This chapter also ends the interim address of the restore path: once Scrypted has left the NAS, the NAS gives up 10.0.5.2 and the home VM takes it (step 8.9).

Standing rule. Never base an automation on camera motion. Cameras are for looking and recording. Automations use phones, door sensors and the motion sensor on the first floor.

Why. HomeKit plays H.264. With Enhanced encoding on, a camera sends H.265 and Scrypted would have to transcode, the single biggest CPU cost. With all three stream sizes on, each viewer gets the size it needs.

UniFi Protect > Devices, for each camera, Settings:

  1. Recording > Encoding: Standard (Enhanced off).
  2. Advanced (or Streams): High, Medium and Low all enabled.

Confirm the account protect-local from step 3.6 exists with Full Management on Protect. The plugin needs an administrator, and a cloud account with two-factor sign-in does not work.

Verify. Each camera’s settings show Standard encoding and three streams.

Rollback. Turn Enhanced back on.

Why. Same rule as every image: a version you chose.

Mac In $INFRA/vm/home/.env.tpl, set SCRYPTED_VERSION. On the restore path, check which server version the NAS runs (bottom of the Scrypted sidebar, v0.144.3 at the time of writing) and take the newest tag from the Scrypted releases in the form v0.147.0-noble-full. A backup restores into a newer server, never into an older one.

Terminal window
cd $INFRA && git commit -am "home: pin Scrypted" && vm-push.sh home
ssh home 'cd /srv/stack && docker compose pull scrypted'

Verify. ssh home 'docker images --format "{{.Repository}}:{{.Tag}}" | grep scrypted' shows the tag you set.

Rollback. git revert HEAD && vm-push.sh home.

8.3 Stop Scrypted on the NAS and take the final backup

Section titled “8.3 Stop Scrypted on the NAS and take the final backup”

Why. Two Scrypted servers with the same HomeKit identities fight over the cameras. The NAS copy stops first and never starts again by itself. From this step until 8.10 the cameras show “No Response” in Apple Home. Protect keeps recording throughout.

  1. In the NAS’s Scrypted web page: Settings > Backup, download, save as ~/infra-migration/backups/scrypted-backup-final.zip.
  2. NAS Container Manager > Container: stop scrypted, turn auto-restart off.
  3. Mac
Terminal window
tar -czf ~/infra-migration/backups/scrypted-volume-final.tgz -C /Volumes/docker scrypted

Verify. Both files exist, and the NAS’s Scrypted page no longer loads.

Rollback. Start the container on the NAS.

Why. Scrypted’s volume folder works on any machine and processor, so copying it brings users, plugins, cameras and every HomeKit pairing in one move. The built-in Restore does the same from the backup file, and is the fallback.

Mac

Terminal window
scp ~/infra-migration/backups/scrypted-volume-final.tgz home:/tmp/
ssh home 'sudo tar -xzf /tmp/scrypted-volume-final.tgz -C /srv/scrypted --strip-components=1 && cd /srv/stack && docker compose up -d scrypted && docker logs -f --tail 5 scrypted'

Ctrl-C when the log settles. Plugins download their own code again on first start: give it five minutes. Open https://<the VM's current address>:10443, accept the self-signed certificate, and sign in with your existing Scrypted account. Store that account in the Scrypted admin item: op item edit "Scrypted admin" --vault Infrastructure username=YOUR_USER 'password=YOUR_PASSWORD'.

If the volume copy fails to start: ssh home 'cd /srv/stack && docker compose down scrypted && sudo rm -rf /srv/scrypted/* && docker compose up -d scrypted', open the page, create a temporary account, then Settings > Restore with scrypted-backup-final.zip.

Verify. The camera list shows every camera from your notes of step 2.10.

Rollback. ssh home 'cd /srv/stack && docker compose rm -sf scrypted', then start the NAS container.

Go to part D.

8.5 First start, account, plugins, cameras

Section titled “8.5 First start, account, plugins, cameras”

Why. An empty Scrypted needs four plugins and one sign-in to Protect. The cameras then appear by themselves.

Mac

Terminal window
ssh home 'cd /srv/stack && docker compose up -d scrypted'
op read "op://Infrastructure/Scrypted admin/password" | pbcopy

Open https://<the VM's address>:10443, accept the certificate, and create the account admin with the pasted password. Then Plugins > Install: UniFi Protect, HomeKit, Rebroadcast, Snapshot. Step 8.6 signs the Protect plugin in.

Verify. Plugins lists the four, each with a green state.

Rollback. ssh home 'cd /srv/stack && docker compose rm -sf scrypted && sudo rm -rf /srv/scrypted/*'.

8.6 The Protect plugin, and only the plugins you need

Section titled “8.6 The Protect plugin, and only the plugins you need”

Why. The plugin pulls every stream from the UDM Pro, not from the cameras. Pointing it at the gateway address of the VM’s own network (10.0.5.1) keeps the video on one hop, without crossing between networks. Detection plugins would analyse video that the cameras, Protect and the Home hub already analyse.

In Scrypted:

  1. Plugins > UniFi Protect > Settings: host 10.0.5.1, username protect-local, password from op read "op://Infrastructure/UniFi local admin protect/password" | pbcopy. Save. The cameras appear (from scratch) or reconnect (restore).
  2. Plugins: remove OpenVINO (it came from the Intel NAS and cannot run here), OpenCV, PAM-Diff, Python Codecs and CoreML if listed. Keep UniFi Protect, HomeKit, Rebroadcast, Snapshot, and WebRTC if it was there.
  3. On each camera, Extensions: Video Analysis off.

Verify. Each camera’s page plays live video and shows a fresh snapshot.

Rollback. Put the old host back in the plugin settings.

8.7 One stream per job, no prebuffer you do not use

Section titled “8.7 One stream per job, no prebuffer you do not use”

Why. Each prebuffered stream is a connection to the UDM Pro that stays open all day and sits in memory. Only the stream HomeKit Secure Video records from needs it, so clips include the seconds before the motion.

Per camera, in Scrypted, Streams (Rebroadcast):

Scrypted stream Protect stream
Local Stream, Local Recording Stream High (Medium for a 4K camera if clips arrive late)
Remote Stream, Remote Recording Stream Medium
Low Resolution Stream Low

Prebuffer: on for the stream assigned to Local Recording Stream only, off on the others. Leave every transcoding option off, in the camera’s HomeKit and Streams settings.

Verify. ssh home 'docker stats --no-stream scrypted' shows CPU under about 15% with nobody watching, and memory under 1.5 GB.

Rollback. Turn prebuffer back on for a stream.

Skip this part if the home VM already answers at 10.0.5.2 (from-scratch path with a free address).

8.8 The NAS lets go of the Trusted and IoT networks

Section titled “8.8 The NAS lets go of the Trusted and IoT networks”

Why. The NAS has a leg in several VLANs because its containers needed to sit beside the Home hubs. With Scrypted, Home Assistant and the Matter server gone from it, those legs serve nothing, and one of them holds the address the VM wants.

NAS Control Panel > Network > Network Interface: find the interface that holds 10.0.5.2, and the one in 10.0.4.0/24. Write down their settings (name, VLAN ID, address) in ~/infra-migration/nas-interfaces.txt, then for each: Edit, untick the VLAN or Delete the interface. Leave the Servers interface alone: chapter 11 deals with the rest.

Verify. From the Mac: ping -c 3 10.0.5.2 gets no answer, and the NAS admin page still opens at its Servers address.

Rollback. Recreate the interfaces from your notes.

Why. This is the address every phone, bookmark and HomeKit record used before the VM existed, and the one the rest of this guide names. The repository’s network file carries it, unchanged this time.

Mac

Terminal window
scp $INFRA/vm/home/etc/network/interfaces home:/tmp/interfaces
ssh home 'sudo install -m 644 /tmp/interfaces /etc/network/interfaces && sudo reboot'
sed -i '' '/^Host home$/,/^Host /s/HostName 10.0.5.20$/HostName 10.0.5.2/' ~/.ssh/config
ssh-keygen -R 10.0.5.20 >/dev/null 2>&1; sleep 60
ssh -o StrictHostKeyChecking=accept-new home 'ip -br addr | grep enp0s1'

If the VM’s disk is encrypted, run vm-unlock home after the reboot.

Then follow the address everywhere it is written:

Where Change
UniFi Client Devices > home Fixed IP Address 10.0.5.2
Home Assistant Settings > System > Network > Home Assistant URL > Local network http://10.0.5.2:8123
Each phone’s Home Assistant app, Internal URL http://10.0.5.2:8123
MQTT clients repointed in step 7.10 10.0.5.2
Finder share open smb://admin@10.0.5.2/config
Bookmarks http://10.0.5.2:8123, https://10.0.5.2:10443

Verify. The last command shows 10.0.5.2 on enp0s1 and 10.0.4.2 on enp0s1.4. curl -s -o /dev/null -w '%{http_code}\n' http://10.0.5.2:8123/manifest.json prints 200. On the infra VM’s Prometheus, the target http://10.0.5.2:8123 is up.

Rollback. Install the interim file again (step 7.4) and recreate the NAS interfaces (step 8.8).

8.10 Scrypted’s address, and the cameras in Apple Home

Section titled “8.10 Scrypted’s address, and the cameras in Apple Home”

Why. Scrypted announces each camera to HomeKit at its Scrypted Server Address. It must be the VM’s address on the hubs’ network, and only that one. On the restore path the value copied from the NAS is already 10.0.5.2, which is why the cameras come back without being paired again.

In Scrypted, Settings > General > Scrypted Server Address: select only 10.0.5.2. Remove any other entry. Then Plugins > HomeKit > Reload.

Restore. Open the Home app. Cameras leave “No Response” within a few minutes. For one that stays stuck after ten minutes: in Scrypted, that camera > HomeKit > Reset Pairing, remove it from the Home app, and pair it again as below.

From scratch. Leave cameras in Accessory Mode (one code per camera: a bridge would queue every camera behind one slow snapshot). For each camera: HomeKit > Pairing shows a QR code. In the Home app, + > Add Accessory, scan it.

Verify. Every camera shows live video in the Home app from an iPhone on Wi-Fi, and again with Wi-Fi off (through the Home hub).

Rollback. None needed.

Why. Recording and the analysis of clips happen on the Home hub and in iCloud. Scrypted’s part is to hand over a clean H.264 stream when Protect reports motion.

  1. In the Home app, Home Settings > Home Hubs & Bridges: an Apple TV is the active hub, preferred over a HomePod.
  2. In Scrypted, each camera > HomeKit: recording mode Legacy HKSV (the right one for H.264).
  3. In the Home app, each camera > Settings > Recording Options: Stream & Allow Recording for When Home and When Away, and what to record.

Verify. Walk past each camera. A clip appears in that camera’s timeline in the Home app within a minute.

Rollback. Set Recording Options to Stream only.

8.12 Cameras in Home Assistant, without duplicates

Section titled “8.12 Cameras in Home Assistant, without duplicates”

Why. Home Assistant gets video and detections from Protect directly. Its HomeKit Bridge must never export a camera, or each one shows twice in Apple Home.

In Home Assistant:

  1. Settings > Devices & services > UniFi Protect > Configure (or Reconfigure): host 10.0.5.1, the protect-local account. On each camera device, enable the Medium or Low camera entity for dashboards. In each camera entity’s settings leave Preload stream off.
  2. HomeKit Bridge > Configure: the domain list does not include camera.
  3. Under Discovered, if Scrypted’s cameras show as HomeKit Device: Ignore each. Pairing them to Home Assistant would take them away from Apple Home.

Verify. A picture card of a camera goes live on a tap. In the Home app, no camera sits under the Home Assistant bridge.

Rollback. If a duplicate exists: remove it in the Home app, then run the homekit.reset_accessory action for that entity in Home Assistant.

  • Every camera connected in Protect
  • Every camera once in the Home app, live on Wi-Fi and on cellular
  • A clip recorded for each camera after a walk-by
  • Scrypted Server Address is 10.0.5.2 only
  • No detection plugin and no Video Analysis in Scrypted
  • Home Assistant plays the Medium or Low stream
  • ssh home 'docker restart scrypted': the cameras are back in the Home app within three minutes
  • The NAS scrypted container is stopped with auto-restart off. Keep it two weeks, then chapter 11 removes it

If a camera with no smart detection of its own ever joins, the exception is per camera: install a detection plugin and turn Video Analysis on for that camera alone.

Symptom Likely cause Fix
Camera “No Response” in Home Pairing did not carry over, or two Scrypted servers run Check the NAS container is stopped, then Reset Pairing and add it again
Secure Video never records Server address not on the hubs’ network Step 8.10
Cameras offline in Scrypted Wrong host or account in the Protect plugin Step 8.6
Picture breaks up in Home Enhanced encoding still on Step 8.1

8.14 Retire the Wired network and move Surveillance to VLAN 3

Section titled “8.14 Retire the Wired network and move Surveillance to VLAN 3”

Why. R12. Step 3.4 left the Wired network alive for one client: the old Mac, whose Home Assistant VM needed its port unchanged. That VM now runs on the new Mac, and the NAS has dropped its extra interfaces, so VLAN 3 can be freed and given to the cameras. Afterwards the VLAN numbers run from 1 to 7 without a gap.

From scratch, with Surveillance already on VLAN 3 and no Wired network: skip this step.

Recording stops for a few minutes while the cameras restart. Do it when nobody needs them.

UniFi

  1. The old Mac’s port. If the old Mac stays in use as an ordinary computer, set its switch port’s native network to Trusted and Tagged VLAN Management to Block All. If it is retired, unplug it.
  2. Delete Wired. Client Devices filtered on Wired shows no client. Settings > Networks > Wired > Delete. If UniFi names something that still uses it (a port profile, usually), change that to Trusted and delete again.
  3. Note any camera with a Fixed IP Address.
  4. Move Surveillance. Settings > Networks > Surveillance: VLAN ID 3, Gateway IP/Subnet 10.0.3.1/24, DHCP range 10.0.3.11 to 10.0.3.254. Apply. The cameras’ switch ports follow by themselves, because they name the network, not the number.
  5. Restart the cameras so they ask for a new address: UniFi Devices > USW Pro 24 > Port Manager, select the camera ports, Power Cycle. Each camera takes a 10.0.3.x address and reconnects to Protect within a few minutes.
  6. Re-create the fixed addresses of sub-step 3 with the same last number.

If UniFi refuses to change the VLAN ID of an existing network, create a second network Surveillance3 with the values above, set the camera ports’ native network to it, power cycle them, delete the old network, and rename the new one to Surveillance.

Scrypted and Home Assistant are not touched: both read the cameras through Protect at 10.0.5.1, not at the cameras’ own addresses.

Verify.

Terminal window
ping -c 1 -t 2 10.0.8.1 >/dev/null 2>&1 && echo "10.0.8.1 still answers" || echo "10.0.8.1 gone (good)"

Settings > Networks lists eight networks, numbered 1 to 7 and 100. In Protect, every camera is connected with a 10.0.3.x address. Run the checklist of step 8.13 once more: live video in the Home app, and a clip after a walk-by.

Rollback. Set Surveillance back to VLAN 8 and 10.0.8.1/24 and power cycle the cameras. Create Wired again from your screenshots of step 2.6 (VLAN 3, 10.0.3.1/24) if the old Mac must go back to it.

Scrypted runs in the home VM and is the only path of the cameras into Apple Home, with Secure Video recording. Home Assistant reads the same cameras from Protect. The VM holds its final addresses, 10.0.5.2 and 10.0.4.2, the NAS has left the Trusted and IoT networks, and the cameras sit on VLAN 3.