Home Assistant
I wanted Home Assistant to eliminate all the apps, dashboards, and different companies that stores kept pushing on me. If you don't look at the top sellers, and find alternative brands, you find a large community of hardware and software that is fairly agnostic and works well on anything because it is no frills and not proprietary. That is Home Assistant to the letter.
My Home Assistant runs lights, alarms, security, sprinklers, and more. It receives OBD
Home Assistant is a powerful, privacy-focused home automation platform that puts local control first. It integrates thousands of smart devices and services, enabling sophisticated automations without relying on cloud services.
Why Home Assistant?
Local Control: Automations run on your hardware, not in the cloud
Privacy: Your data stays in your home
Vendor Agnostic: Works with devices from hundreds of manufacturers
Powerful Automations: Complex logic, conditions, and triggers
Active Community: Thousands of integrations and custom components
No Subscription: Completely free and open source
Core Concepts
Entities
Everything in Home Assistant is an entity with a unique ID:
light.living_room- A lightsensor.temperature- A temperature sensorswitch.coffee_maker- A smart switchbinary_sensor.front_door- A door sensor
Integrations
Integrations connect Home Assistant to devices and services:
- Zigbee2MQTT: Zigbee devices
- Z-Wave JS: Z-Wave devices
- MQTT: Message broker for IoT
- ESPHome: Custom ESP32/ESP8266 devices
- Weather: Weather data
- Calendar: Calendar integration
Automations
Automations respond to triggers with actions:
automation:
- alias: "Turn on lights at sunset"
trigger:
- platform: sun
event: sunset
action:
- service: light.turn_on
target:
entity_id: light.living_room
Dashboards
Customizable web interfaces showing your devices and controls. Create multiple dashboards for different purposes or users.
Installation with Docker
Basic Setup
Create docker-compose.yml:
version: '3.8'
services:
homeassistant:
image: ghcr.io/home-assistant/home-assistant:stable
container_name: homeassistant
network_mode: host
volumes:
- homeassistant-config:/config
environment:
- TZ=America/Chicago
restart: unless-stopped
volumes:
homeassistant-config:
Why network_mode: host?
- Required for device discovery (mDNS, SSDP)
- Allows direct access to USB devices
- Simplifies integration with local services
Start the service:
docker compose up -d
Access at: http://your-server:8123
With USB Devices
For Zigbee/Z-Wave USB coordinators:
services:
homeassistant:
# ... other config ...
devices:
- /dev/ttyUSB0:/dev/ttyUSB0 # Zigbee coordinator
- /dev/ttyUSB1:/dev/ttyUSB1 # Z-Wave stick
privileged: true # Required for USB access
Protocol Bridges
Home Assistant doesn't directly communicate with most devices. Instead, it uses protocol bridges:
Zigbee2MQTT
Connects Zigbee devices via MQTT:
services:
zigbee2mqtt:
image: koenkk/zigbee2mqtt:latest
container_name: zigbee2mqtt
ports:
- "8099:8080"
volumes:
- zigbee2mqtt-data:/app/data
devices:
- /dev/ttyUSB0:/dev/ttyACM0
environment:
- TZ=America/Chicago
restart: unless-stopped
mosquitto:
image: eclipse-mosquitto:latest
container_name: mosquitto
ports:
- "1883:1883"
- "9001:9001"
volumes:
- mosquitto-data:/mosquitto/data
- mosquitto-config:/mosquitto/config
restart: unless-stopped
Supported devices: Lights, sensors, switches, locks, thermostats from Philips Hue, IKEA, Aqara, and hundreds more
Z-Wave JS UI
Manages Z-Wave devices:
services:
zwave-js-ui:
image: zwavejs/zwave-js-ui:latest
container_name: zwave-js-ui
ports:
- "8091:8091"
- "3005:3000"
volumes:
- zwave-config:/usr/src/app/store
devices:
- /dev/ttyUSB1:/dev/ttyACM0
environment:
- TZ=America/Chicago
restart: unless-stopped
Supported devices: Locks, sensors, switches, dimmers from Schlage, Yale, GE, Zooz, and more
MQTT Broker
Message bus for IoT devices:
services:
mosquitto:
image: eclipse-mosquitto:latest
container_name: mosquitto
ports:
- "1883:1883" # MQTT
- "9001:9001" # WebSocket
volumes:
- mosquitto-data:/mosquitto/data
- mosquitto-config:/mosquitto/config
- mosquitto-log:/mosquitto/log
restart: unless-stopped
Initial Configuration
First-Time Setup
- Access Web Interface: Navigate to
http://your-server:8123 - Create Account: Set up your admin user
- Set Location: For sun/weather automations
- Add Integrations: Connect your devices and services
Adding Integrations
Via UI (Recommended):
- Settings → Devices & Services
- Click "Add Integration"
- Search for your device/service
- Follow setup wizard
Via Configuration (Advanced):
Edit /config/configuration.yaml:
# MQTT Integration
mqtt:
broker: localhost
port: 1883
# Weather Integration
weather:
- platform: met
name: Home Weather
Creating Automations
Via UI (Easiest):
- Settings → Automations & Scenes
- Click "Create Automation"
- Choose trigger, conditions, actions
- Test and save
Via YAML (More powerful):
Edit /config/automations.yaml:
- alias: "Morning Routine"
trigger:
- platform: time
at: "07:00:00"
condition:
- condition: state
entity_id: binary_sensor.workday
state: "on"
action:
- service: light.turn_on
target:
entity_id: light.bedroom
data:
brightness_pct: 50
- service: climate.set_temperature
target:
entity_id: climate.thermostat
data:
temperature: 72
Common Automation Patterns
Motion-Activated Lights
- alias: "Hallway Motion Lights"
trigger:
- platform: state
entity_id: binary_sensor.hallway_motion
to: "on"
condition:
- condition: sun
after: sunset
action:
- service: light.turn_on
target:
entity_id: light.hallway
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.hallway_motion
to: "off"
for: "00:05:00"
- service: light.turn_off
target:
entity_id: light.hallway
Presence Detection
- alias: "Arrive Home"
trigger:
- platform: state
entity_id: person.john
to: "home"
action:
- service: light.turn_on
target:
area_id: living_room
- service: climate.set_preset_mode
target:
entity_id: climate.thermostat
data:
preset_mode: "home"
Notification on Event
- alias: "Door Open Alert"
trigger:
- platform: state
entity_id: binary_sensor.front_door
to: "on"
condition:
- condition: state
entity_id: alarm_control_panel.home
state: "armed_away"
action:
- service: notify.mobile_app
data:
title: "Security Alert"
message: "Front door opened while away"
Dashboard Creation
Basic Dashboard
views:
- title: Home
cards:
- type: entities
title: Lights
entities:
- light.living_room
- light.bedroom
- light.kitchen
- type: thermostat
entity: climate.thermostat
- type: weather-forecast
entity: weather.home
Advanced Cards
Custom Button Card:
- type: custom:button-card
entity: light.living_room
name: Living Room
icon: mdi:sofa
tap_action:
action: toggle
Graph Card:
- type: history-graph
entities:
- sensor.temperature
- sensor.humidity
hours_to_show: 24
Remote Access
Via Tailscale (Recommended)
- Install Tailscale on server and devices
- Access via Tailscale IP:
http://100.x.x.x:8123 - No port forwarding needed
- Encrypted connection
Via Cloudflare Tunnel
Expose Home Assistant securely:
services:
cloudflared:
image: cloudflare/cloudflared:latest
container_name: cloudflared
command: tunnel --no-autoupdate run
environment:
- TUNNEL_TOKEN=your_token_here
restart: unless-stopped
Via Nabu Casa
Official cloud service ($6.50/month):
- Easy setup
- Supports Google Assistant/Alexa
- Funds Home Assistant development
Add-ons vs Docker
Home Assistant OS: Includes add-on store (supervised install)
Docker: No add-ons, but you can run equivalent containers
Common "add-ons" as Docker containers:
- File Editor → VS Code Server
- Terminal → SSH into host
- Samba → Standalone Samba container
- Node-RED → Standalone Node-RED container
Performance Optimization
Database Optimization
Limit recorder history:
recorder:
purge_keep_days: 7
exclude:
domains:
- automation
- script
entities:
- sensor.high_frequency_sensor
Resource Monitoring
Check system resources:
- Settings → System → Hardware
- Monitor CPU, RAM, disk usage
- Identify problematic integrations
Troubleshooting
Integration Not Loading
Check logs:
- Settings → System → Logs
- Look for errors related to integration
Common fixes:
- Restart Home Assistant
- Check network connectivity
- Verify credentials/API keys
- Update integration
Automation Not Triggering
Debug steps:
- Check automation is enabled
- Verify trigger conditions are met
- Test trigger manually
- Check automation traces (Settings → Automations → Traces)
High CPU/Memory Usage
Common causes:
- Too many entities
- Frequent polling integrations
- Large database
Solutions:
- Disable unused integrations
- Increase polling intervals
- Optimize recorder settings
- Move to SSD storage
Best Practices
Start Simple: Add devices gradually, test as you go
Use Areas: Organize devices by physical location
Name Consistently: Use clear, descriptive entity names
Document Automations: Add descriptions to complex automations
Backup Regularly: Export configuration frequently
Test Changes: Use Developer Tools to test before deploying
Monitor Logs: Check for errors and warnings regularly
Backup & Restore
Manual Backup
# Stop Home Assistant
docker stop homeassistant
# Backup config directory
tar -czf ha-backup-$(date +%Y%m%d).tar.gz /path/to/config
# Start Home Assistant
docker start homeassistant
Automated Backups
Use cron job:
0 3 * * * docker exec homeassistant ha backups new --name "Auto-$(date +\%Y\%m\%d)"
Related Topics:
- Self-Hosting a Home Server - Complete homelab guide
- Docker - Container platform
- NGINX - Reverse proxy
- Tailscale - Secure remote access