What is Home Assistant?
Home Assistant is a self-hosted smart home hub. In the smart home world, there are devices that work with Google Home, Apple HomeKit, or the Amazon ecosystem. However, these devices often cannot communicate with each other. For instance, you may have a light bulb that only works with HomeKit, and a motion sensor that only works with Google Home, preventing automation between these two products. Home Assistant bridges this gap. While some services don’t work with Home Assistant, a basic Google search can help you find compatible options.
Some Automations I Run
My favorite automation is my living room TV setup. When the TV is turned off or on, the lights in the room will dim or turn off accordingly. Another is my morning routine, where the lights in my room turn on when I wake up.
How to Get Started
First, decide what you want to automate. A simple starting point is light bulbs, creating automations based on your wake-up and sleep times. However, be careful not to turn on lights when someone is sleeping. Next, you need the hardware and the software. Home Assistant can run on various platforms like an RPi4, VM, or a Docker container. I run mine in a Docker container, which I will guide you through.
Installing Home Assistant in a Docker Container
- Install Docker on Ubuntu 22.04.3 LTS:
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release and echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Optional
To avoid using ‘sudo’ with every Docker command, add your user to the Docker group:
sudo usermod -aG docker $USER
- Install Home Assistant:
docker volume create homeassistant_data
docker run -d \
--name homeassistant \
--privileged \
--restart=unless-stopped \
-p 8123:8123 \
-e TZ="Europe/London" \
-v homeassistant_config:/config \
--network=host \
ghcr.io/home-assistant/home-assistant:stable
Now that you have Home Assistant installed, you can start exploring various automations.
Security
IoT devices like smart lights and switches can sometimes be insecure. This can be problematic because if an attacker gains access to one device on your network, they might reach other devices. To mitigate this, place them on a different VLAN, or if your router doesn’t support VLANs, use the guest network that most routers come with.