📖 Chapter 08 — Home Automation
The smart home that runs on the NAS, doesn't depend on the cloud, and respects the family's privacy.
Learning Objectives
- Set up Home Assistant as the brain of the smart home
- Integrate Zigbee and Z-Wave devices with the right USB stick
- Use MQTT as the messaging layer for IoT devices
- Build automations that respect the family's actual life
Introduction
The smart home is sold as a convenience: "Alexa, turn off the lights." "Hey Siri, set the thermostat to 72." The reality is: a vendor lock-in to a cloud service, a privacy concern (every word you say in your living room is sent to Amazon/Google/Apple), and a system that breaks when the vendor changes their mind.
The self-hosted alternative: Home Assistant. It runs on your NAS, integrates with thousands of devices, doesn't depend on any cloud, and respects your data. This chapter is the setup.
Why Home Assistant
Home Assistant is an open-source home automation platform. It supports more than 3,000 integrations (devices, services, APIs). The killer features:
- Local control. Everything runs on your NAS. No cloud dependency. The smart home works when the internet is down.
- Privacy. Your data stays on your hardware. No voice commands sent to Amazon.
- Integrations. Lights, locks, thermostats, sensors, cameras, vacuum robots, irrigation systems, weather, calendars, location — all from one app.
- Automations. "When I get home, unlock the door and turn on the lights." "When the sun sets, close the blinds." "When the baby is sleeping, dim the hallway lights." All local, all custom.
The cost: setup is more work than buying an Echo and a few smart bulbs. The benefit: a smart home you own, not one you're renting from a vendor.
Setting up Home Assistant
Home Assistant has a few installation paths. The recommended one for a TrueNAS-based home lab: the Home Assistant Container (a Docker container you run yourself). The "Home Assistant OS" image is for a dedicated machine, not a container host.
Install via the TrueNAS Apps catalog. After install, Home Assistant is reachable at http://<nas>:8123. Complete the onboarding:
- Create the admin user.
- Set the home name, location, time zone.
- Discover devices on the network (Home Assistant finds compatible devices automatically).
- Set up integrations (the services and devices you want to control).
The integration model
Home Assistant's model: each device or service is an "integration." You add integrations to bring new things into Home Assistant. The integration gives you entities (the controllable things): a light becomes a light.living_room entity, a temperature sensor becomes a sensor.living_room_temperature entity.
You build dashboards and automations using these entities. The dashboard shows the state; the automations react to changes.
The protocols: Zigbee, Z-Wave, Matter, Wi-Fi
Smart home devices speak various protocols. The major ones:
- Zigbee: low-power mesh network, popular for sensors and bulbs. Uses a USB stick (Zigbee coordinator). IKEA, Philips Hue, Aqara, Sengled all use Zigbee or Zigbee-compatible protocols.
- Z-Wave: another low-power mesh network, popular for locks and sensors. Uses a USB stick (Z-Wave controller). Less common than Zigbee but still used.
- Matter: the new cross-vendor standard. Backed by Apple, Google, Amazon, and the Connectivity Standards Alliance. Works over Wi-Fi, Thread, or Ethernet. Some Matter devices need a Thread border router (often built into newer Apple TVs, Eero routers, etc.).
- Wi-Fi: smart devices that connect directly to your Wi-Fi. Shelly, TP-Link Kasa, Sonoff, many others. Easy to set up (no separate hub), but clogs the Wi-Fi if you have a lot of them.
For the home lab, the recommended starting point: a Zigbee USB stick (e.g., the SONOFF Zigbee 3.0 USB Dongle Plus, or a similar coordinator) and a few Zigbee devices. The Zigbee mesh is more reliable than Wi-Fi for a large number of devices.
MQTT: the messaging layer
MQTT is a lightweight messaging protocol that IoT devices use to communicate. Home Assistant supports MQTT, and many devices (especially DIY ones like ESPHome, Tasmota) use it as their primary communication method.
The setup: run an MQTT broker (most commonly Mosquitto) on the NAS. Home Assistant connects to the broker. Devices publish to the broker; Home Assistant subscribes to the topics.
MQTT is the right answer for: DIY sensors, ESP-based devices, integrating custom hardware with Home Assistant.
Building automations
Automations are the reason to have a smart home. The basic structure:
- Trigger: what starts the automation. Time of day, device state change, person arriving home, sun setting.
- Condition (optional): what must be true for the automation to fire. "If the sun is below the horizon," "if anyone is home."
- Action: what to do. Turn on a light, send a notification, play a sound, call a service.
Examples of automations that actually help:
- "When the front door opens after sunset, turn on the entry light for 5 minutes." Trigger: door sensor state change. Condition: sun is below horizon. Action: turn on light, wait 5 minutes, turn off.
- "When nobody is home for 30 minutes, set the thermostat to eco mode." Trigger: person leaving. Condition: nobody home for 30 minutes. Action: set thermostat to eco.
- "When motion is detected in the hallway at night, turn on the hallway light to 20% for 2 minutes." Trigger: motion sensor. Condition: time is between sunset and sunrise. Action: dim light, wait, turn off.
The principle: automations that reduce friction, not add it. "Alexa, turn off the lights" is friction (you have to speak, the device has to understand, the API has to be up). "When the sun sets, close the blinds" is the opposite — the automation runs, you don't think about it.
The family adoption problem
From Volume 2, Chapter 1: the family's experience matters. For home automation:
- Don't automate things that already work. If the family is happy with a manual light switch, leave it. Adding an app control to it is friction, not benefit.
- Automate the things that are annoying. "Turn off all the lights when we go to bed" is genuinely useful. "Turn on the light when motion is detected" is sometimes useful, sometimes annoying.
- Have a manual override. Every automated thing should be controllable by a normal switch, button, or app. The automation is a convenience, not a requirement.
The test: would Mimi say "yes, this is helpful"? If yes, keep the automation. If no, delete it.
The voice assistant integration
Home Assistant integrates with voice assistants. The options:
- Home Assistant Cloud (Nabu Casa): paid service ($7/month as of 2026) that provides easy integration with Google Assistant and Alexa. Worth it if you want voice control.
- Local voice: Home Assistant has a local voice assistant (using Wyoming and Whisper). Slower than cloud, fully private, no subscription.
- No voice: just use the Home Assistant app, dashboards, and automations. Many people find this sufficient.
For most home labs, the local voice is enough for "set a timer" and "what's the temperature in the baby's room?" For everything else, the app and automations handle it.
Security and privacy in the smart home
Smart home devices are notoriously insecure. The mitigations:
- Isolate IoT on its own network. From Chapter 2: a VLAN or subnet for IoT devices. They can reach the internet but not the family or lab networks.
- Use Zigbee or Z-Wave, not cloud-dependent Wi-Fi devices. Zigbee devices work without internet. Cloud-dependent devices don't.
- Update device firmware. Many IoT devices have known vulnerabilities that are fixed in firmware updates. The update process is annoying; the alternative is worse.
- Don't put cameras in private spaces. Bedrooms, bathrooms, the inside of the house. A camera in the living room is reasonable; a camera in the bedroom is not.
Engineering Note
The smart home should be invisible when it's working. The automations run. The lights come on when they should. The thermostat adjusts. Nobody thinks about it. The day someone notices the smart home is when something's wrong ("why is this light on?"). The day nobody notices the smart home is when it's working.
Summary
Home Assistant runs on the NAS, integrates with thousands of devices, and works without the cloud. Zigbee for sensors and bulbs, Z-Wave for locks, Matter for cross-vendor compatibility, Wi-Fi for direct-connected devices. MQTT for DIY devices. Build automations that reduce friction, not add it. Isolate IoT on its own network. Local voice is sufficient for most needs. The smart home is invisible when it's working.
Checklist
- ⬜ Install Home Assistant (container or via TrueNAS Apps catalog)
- ⬜ Add a Zigbee USB coordinator (e.g., SONOFF Zigbee 3.0 USB Dongle Plus)
- ⬜ Configure the Zigbee integration in Home Assistant
- ⬜ Pair your first few devices (bulbs, sensors, switches)
- ⬜ Build your first automation: the simplest one that helps the family
- ⬜ Isolate IoT devices on their own network (Chapter 2)
- ⬜ Document the setup in
tank/Lab/docs/home-assistant/
Looking Ahead
Chapter 09 is the last chapter of Volume 4. It covers when to expand: the signs the current NAS can't host the lab anymore, the right time to add a second machine, when to consider a Proxmox cluster, when to bring in dedicated hardware. The signs, the math, the timing.