Why Home Assistant
Most smart home devices come with their own app: one for your bulbs, another for your plugs, another for your AC blaster. That's fine for a device or two, but it falls apart fast — and none of those apps can make devices from different brands talk to each other. Home Assistant solves this by sitting underneath all of them: it connects to your existing devices through their cloud accounts or locally, and gives you one place to see everything and build real automations across brands.
This guide covers running Home Assistant on the home server from the earlier guide, connecting Tuya-based devices, bringing in custom ESP32 sensors, and building automations that are actually reliable — not just "if this then that" toys that break the first time something restarts.
Part 1: Running Home Assistant in Docker
Add this to your server's docker-compose.yml alongside your other services:
services:
homeassistant:
container_name: homeassistant
image: ghcr.io/home-assistant/home-assistant:stable
volumes:
- './homeassistant-config:/config'
- '/etc/localtime:/etc/localtime:ro'
restart: unless-stopped
network_mode: host
network_mode: host matters here — Home Assistant needs to discover devices on your local network directly, which is much simpler with host networking than trying to configure specific port mappings for every discovery protocol involved.
Start it with docker compose up -d, then open http://your-server-ip:8123 and follow the setup wizard to create your account.
Part 2: Connecting Tuya Devices
Many affordable smart plugs, bulbs, and IR blasters — regardless of the brand printed on the box — run on Tuya's underlying platform, controlled day-to-day through the SmartLife or Tuya Smart app. Home Assistant has a built-in Tuya integration that connects to that same account and pulls all those devices in.
- In Home Assistant, go to Settings → Devices & Services → Add Integration
- Search for Tuya and select it
- Log in with the same account used in the SmartLife/Tuya Smart app
- Home Assistant will list all discovered devices — select which ones to import
Once connected, IR blaster "scenes" you've already taught your remote's signals to (like turning an AC on or off, covered in the temperature sensor and AC automation guide) become available as entities Home Assistant can trigger directly, alongside plugs, bulbs, and any other Tuya devices on the account.
Part 3: Bringing In Custom ESP32 Devices
Devices you've built yourself with ESPHome (like a DIY temperature sensor) connect differently — instead of a cloud account, Home Assistant discovers them directly on your local network.
- Make sure the ESP32 device is flashed and connected to your Wi-Fi (see the temperature sensor guide for the flashing steps)
- In Home Assistant, go to Settings → Devices & Services — a newly discovered ESPHome device usually shows up automatically as a notification
- If it doesn't appear automatically, add the ESPHome integration manually and enter the device's local IP address
Once added, every sensor defined in that device's YAML config (temperature, humidity, and so on) becomes a live entity in Home Assistant, exactly the same as a purchased smart device — this is what makes custom builds and off-the-shelf gadgets sit side by side in the same automations.
Part 4: Organizing with Areas
Before building automations, assign each device to an Area (like "Bedroom" or "Living Room") under Settings → Areas. This isn't just cosmetic — automations, dashboards, and voice assistant integrations all become far easier to manage once devices are grouped by where they physically are, rather than being one long unsorted list.
Part 5: Building Automations That Actually Hold Up
A basic automation in Home Assistant sounds simple: "when X happens, do Y." But the naive version of many automations has a real weakness — edge-triggered conditions only fire at the exact moment they're crossed. If Home Assistant restarts, or briefly loses connection to a device right at that moment, the automation can silently miss its trigger, leaving a device stuck in the wrong state with nothing to correct it.
The fix, used throughout this build's automations: pair the main trigger with a time-based secondary trigger that re-checks the condition periodically, so the system self-corrects even if it missed the original moment. For the full worked example — a temperature-based AC automation built exactly this way — see the temperature sensor and AC automation guide.
input_boolean helper as Home Assistant's own memory of what it last told the device to do. Automations then check that helper instead of assuming the real-world state matches what was last commanded — because with one-way devices, there's no way to actually know otherwise.
Part 6: A Simple Dashboard
Home Assistant's default view already shows all your entities, but a custom dashboard focused on what you actually check daily — room temperatures, whether the AC is running, key lights — is far more usable day-to-day. Dashboards are built visually under Settings → Dashboards, using cards for each entity or group of entities, and can be organized by the Areas set up in Part 4.
Common Issues
A Tuya device stops responding after a while. Tuya's cloud integration occasionally needs its connection refreshed — check Settings → Devices & Services → Tuya for any reported connection errors, and reload the integration if needed.
An ESPHome device shows as unavailable. Usually a Wi-Fi or power issue on the device itself rather than Home Assistant — check the device's own status first before assuming the integration is broken.
An automation fires at the wrong time after a restart. This is almost always the edge-trigger issue from Part 5 — add a time-based secondary trigger to make the automation self-correcting.
What's Next
With Home Assistant running as the hub, custom builds like the ESP32 temperature sensor and AC automation and purchased Tuya devices all live in one system instead of scattered across separate apps — and every new device added afterward gets to join that same growing set of automations rather than becoming its own isolated island.