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:

Integrations

Integrations connect Home Assistant to devices and services:

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?

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

  1. Access Web Interface: Navigate to http://your-server:8123
  2. Create Account: Set up your admin user
  3. Set Location: For sun/weather automations
  4. Add Integrations: Connect your devices and services

Adding Integrations

Via UI (Recommended):

  1. Settings → Devices & Services
  2. Click "Add Integration"
  3. Search for your device/service
  4. 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):

  1. Settings → Automations & Scenes
  2. Click "Create Automation"
  3. Choose trigger, conditions, actions
  4. 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

  1. Install Tailscale on server and devices
  2. Access via Tailscale IP: http://100.x.x.x:8123
  3. No port forwarding needed
  4. 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):

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:

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:

Troubleshooting

Integration Not Loading

Check logs:

Common fixes:

Automation Not Triggering

Debug steps:

  1. Check automation is enabled
  2. Verify trigger conditions are met
  3. Test trigger manually
  4. Check automation traces (Settings → Automations → Traces)

High CPU/Memory Usage

Common causes:

Solutions:

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: