docker.recipes

Home Assistant Full Stack

advanced

Complete smart home platform with Home Assistant, Mosquitto MQTT, Zigbee2MQTT, and InfluxDB.

Overview

Home Assistant is an open-source home automation platform that puts local control and privacy first, integrating with over 2000 devices and services to create comprehensive smart home solutions. Unlike cloud-dependent alternatives, Home Assistant runs entirely on your local hardware, ensuring your smart home data remains private while providing powerful automation capabilities through its sophisticated rule engine and intuitive dashboard interface. This full-stack deployment combines Home Assistant with essential smart home infrastructure components: Eclipse Mosquitto MQTT broker for device communication, Zigbee2MQTT for direct Zigbee device control without proprietary hubs, InfluxDB for time-series data storage of sensor readings and device states, and Grafana for creating detailed analytics dashboards of your home's operational data. The stack creates a complete smart home ecosystem where MQTT serves as the communication backbone, Zigbee2MQTT eliminates vendor lock-in by directly controlling Zigbee devices, InfluxDB captures historical data for trend analysis, and Grafana transforms raw sensor data into meaningful visualizations. This combination is ideal for privacy-conscious smart home enthusiasts, IoT developers building custom solutions, homelab operators wanting comprehensive home monitoring, and anyone seeking to create advanced automation rules based on historical data patterns and real-time analytics.

Key Features

  • Over 2000 device integrations including Philips Hue, Nest, Ring, Tesla, and major IoT platforms
  • Local Zigbee device control through Zigbee2MQTT without requiring proprietary hubs or cloud services
  • High-performance time-series data storage with InfluxDB's purpose-built architecture for IoT sensor data
  • Advanced automation engine with triggers, conditions, and actions for complex smart home scenarios
  • Rich visualization dashboards in Grafana with 50+ chart types for home energy monitoring and sensor analytics
  • MQTT broker infrastructure supporting thousands of concurrent device connections with QoS guarantees
  • Flux query language in InfluxDB for complex time-based analytics and data retention policies
  • Voice assistant integration with Google Assistant, Alexa, and local speech processing

Common Use Cases

  • 1Complete smart home automation with lighting, climate, security, and entertainment system integration
  • 2Home energy monitoring with solar panel output tracking, usage analytics, and cost optimization
  • 3Indoor air quality management using multiple sensor types with historical trending and alerting
  • 4Security system integration combining cameras, door sensors, and motion detectors with intelligent notifications
  • 5Greenhouse or hydroponic system monitoring with temperature, humidity, and soil moisture automation
  • 6Multi-zone HVAC optimization using occupancy sensors and weather data for energy efficiency
  • 7Home lab infrastructure monitoring combining network equipment stats with environmental conditions

Prerequisites

  • Minimum 4GB RAM recommended (2GB+ for Home Assistant, 1GB+ for InfluxDB, 512MB+ for Grafana)
  • USB Zigbee coordinator device (CC2531, CC2652, or Sonoff Zigbee dongle) connected to /dev/ttyUSB0
  • Port availability: 8123 (Home Assistant), 3000 (Grafana), 8086 (InfluxDB), 1883/9001 (MQTT)
  • Basic understanding of YAML configuration for Home Assistant automations and device setup
  • Network access to smart home devices and understanding of local IP addressing
  • Familiarity with MQTT topics and JSON payloads for custom device integration

For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms

docker-compose.yml

docker-compose.yml
1services:
2 homeassistant:
3 image: ghcr.io/home-assistant/home-assistant:stable
4 environment:
5 TZ: ${TZ}
6 volumes:
7 - ha_config:/config
8 ports:
9 - "8123:8123"
10 privileged: true
11 depends_on:
12 - mosquitto
13 - influxdb
14 networks:
15 - homelab-net
16 restart: unless-stopped
17
18 mosquitto:
19 image: eclipse-mosquitto:latest
20 ports:
21 - "1883:1883"
22 - "9001:9001"
23 volumes:
24 - mosquitto_config:/mosquitto/config
25 - mosquitto_data:/mosquitto/data
26 - mosquitto_log:/mosquitto/log
27 networks:
28 - homelab-net
29 restart: unless-stopped
30
31 zigbee2mqtt:
32 image: koenkk/zigbee2mqtt:latest
33 environment:
34 TZ: ${TZ}
35 volumes:
36 - zigbee2mqtt_data:/app/data
37 devices:
38 - /dev/ttyUSB0:/dev/ttyUSB0
39 depends_on:
40 - mosquitto
41 ports:
42 - "8080:8080"
43 networks:
44 - homelab-net
45 restart: unless-stopped
46
47 influxdb:
48 image: influxdb:2.7
49 environment:
50 DOCKER_INFLUXDB_INIT_MODE: setup
51 DOCKER_INFLUXDB_INIT_USERNAME: ${INFLUX_USER}
52 DOCKER_INFLUXDB_INIT_PASSWORD: ${INFLUX_PASSWORD}
53 DOCKER_INFLUXDB_INIT_ORG: ${INFLUX_ORG}
54 DOCKER_INFLUXDB_INIT_BUCKET: ${INFLUX_BUCKET}
55 ports:
56 - "8086:8086"
57 volumes:
58 - influxdb_data:/var/lib/influxdb2
59 networks:
60 - homelab-net
61 restart: unless-stopped
62
63 grafana:
64 image: grafana/grafana:latest
65 environment:
66 GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD}
67 ports:
68 - "3000:3000"
69 volumes:
70 - grafana_data:/var/lib/grafana
71 depends_on:
72 - influxdb
73 networks:
74 - homelab-net
75 restart: unless-stopped
76
77volumes:
78 ha_config:
79 mosquitto_config:
80 mosquitto_data:
81 mosquitto_log:
82 zigbee2mqtt_data:
83 influxdb_data:
84 grafana_data:
85
86networks:
87 homelab-net:
88 driver: bridge

.env Template

.env
1# Timezone
2TZ=UTC
3
4# InfluxDB
5INFLUX_USER=admin
6INFLUX_PASSWORD=secure_influx_password
7INFLUX_ORG=homelab
8INFLUX_BUCKET=homeassistant
9
10# Grafana
11GRAFANA_PASSWORD=secure_grafana_password

Usage Notes

  1. 1Home Assistant at http://localhost:8123
  2. 2Zigbee2MQTT UI at http://localhost:8080
  3. 3Grafana dashboards at http://localhost:3000
  4. 4Configure Zigbee coordinator path in Zigbee2MQTT

Individual Services(5 services)

Copy individual services to mix and match with your existing compose files.

homeassistant
homeassistant:
  image: ghcr.io/home-assistant/home-assistant:stable
  environment:
    TZ: ${TZ}
  volumes:
    - ha_config:/config
  ports:
    - "8123:8123"
  privileged: true
  depends_on:
    - mosquitto
    - influxdb
  networks:
    - homelab-net
  restart: unless-stopped
mosquitto
mosquitto:
  image: eclipse-mosquitto:latest
  ports:
    - "1883:1883"
    - "9001:9001"
  volumes:
    - mosquitto_config:/mosquitto/config
    - mosquitto_data:/mosquitto/data
    - mosquitto_log:/mosquitto/log
  networks:
    - homelab-net
  restart: unless-stopped
zigbee2mqtt
zigbee2mqtt:
  image: koenkk/zigbee2mqtt:latest
  environment:
    TZ: ${TZ}
  volumes:
    - zigbee2mqtt_data:/app/data
  devices:
    - /dev/ttyUSB0:/dev/ttyUSB0
  depends_on:
    - mosquitto
  ports:
    - "8080:8080"
  networks:
    - homelab-net
  restart: unless-stopped
influxdb
influxdb:
  image: influxdb:2.7
  environment:
    DOCKER_INFLUXDB_INIT_MODE: setup
    DOCKER_INFLUXDB_INIT_USERNAME: ${INFLUX_USER}
    DOCKER_INFLUXDB_INIT_PASSWORD: ${INFLUX_PASSWORD}
    DOCKER_INFLUXDB_INIT_ORG: ${INFLUX_ORG}
    DOCKER_INFLUXDB_INIT_BUCKET: ${INFLUX_BUCKET}
  ports:
    - "8086:8086"
  volumes:
    - influxdb_data:/var/lib/influxdb2
  networks:
    - homelab-net
  restart: unless-stopped
grafana
grafana:
  image: grafana/grafana:latest
  environment:
    GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD}
  ports:
    - "3000:3000"
  volumes:
    - grafana_data:/var/lib/grafana
  depends_on:
    - influxdb
  networks:
    - homelab-net
  restart: unless-stopped

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 homeassistant:
5 image: ghcr.io/home-assistant/home-assistant:stable
6 environment:
7 TZ: ${TZ}
8 volumes:
9 - ha_config:/config
10 ports:
11 - "8123:8123"
12 privileged: true
13 depends_on:
14 - mosquitto
15 - influxdb
16 networks:
17 - homelab-net
18 restart: unless-stopped
19
20 mosquitto:
21 image: eclipse-mosquitto:latest
22 ports:
23 - "1883:1883"
24 - "9001:9001"
25 volumes:
26 - mosquitto_config:/mosquitto/config
27 - mosquitto_data:/mosquitto/data
28 - mosquitto_log:/mosquitto/log
29 networks:
30 - homelab-net
31 restart: unless-stopped
32
33 zigbee2mqtt:
34 image: koenkk/zigbee2mqtt:latest
35 environment:
36 TZ: ${TZ}
37 volumes:
38 - zigbee2mqtt_data:/app/data
39 devices:
40 - /dev/ttyUSB0:/dev/ttyUSB0
41 depends_on:
42 - mosquitto
43 ports:
44 - "8080:8080"
45 networks:
46 - homelab-net
47 restart: unless-stopped
48
49 influxdb:
50 image: influxdb:2.7
51 environment:
52 DOCKER_INFLUXDB_INIT_MODE: setup
53 DOCKER_INFLUXDB_INIT_USERNAME: ${INFLUX_USER}
54 DOCKER_INFLUXDB_INIT_PASSWORD: ${INFLUX_PASSWORD}
55 DOCKER_INFLUXDB_INIT_ORG: ${INFLUX_ORG}
56 DOCKER_INFLUXDB_INIT_BUCKET: ${INFLUX_BUCKET}
57 ports:
58 - "8086:8086"
59 volumes:
60 - influxdb_data:/var/lib/influxdb2
61 networks:
62 - homelab-net
63 restart: unless-stopped
64
65 grafana:
66 image: grafana/grafana:latest
67 environment:
68 GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD}
69 ports:
70 - "3000:3000"
71 volumes:
72 - grafana_data:/var/lib/grafana
73 depends_on:
74 - influxdb
75 networks:
76 - homelab-net
77 restart: unless-stopped
78
79volumes:
80 ha_config:
81 mosquitto_config:
82 mosquitto_data:
83 mosquitto_log:
84 zigbee2mqtt_data:
85 influxdb_data:
86 grafana_data:
87
88networks:
89 homelab-net:
90 driver: bridge
91EOF
92
93# 2. Create the .env file
94cat > .env << 'EOF'
95# Timezone
96TZ=UTC
97
98# InfluxDB
99INFLUX_USER=admin
100INFLUX_PASSWORD=secure_influx_password
101INFLUX_ORG=homelab
102INFLUX_BUCKET=homeassistant
103
104# Grafana
105GRAFANA_PASSWORD=secure_grafana_password
106EOF
107
108# 3. Start the services
109docker compose up -d
110
111# 4. View logs
112docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/home-assistant-full-stack/run | bash

Troubleshooting

  • Zigbee2MQTT 'Error: Could not open path': Check USB device permissions with 'sudo chown root:dialout /dev/ttyUSB0' and verify coordinator device path
  • Home Assistant 'Recorder could not start': Ensure InfluxDB is fully initialized and accessible on port 8086 before Home Assistant starts
  • Grafana shows 'Bad Gateway' for InfluxDB: Verify InfluxDB authentication token and organization name match environment variables in both services
  • MQTT devices not connecting: Check Mosquitto broker allows anonymous connections or configure authentication in mosquitto.conf
  • High memory usage: Enable InfluxDB data retention policies to automatically delete old sensor data and reduce storage requirements
  • Zigbee devices not pairing: Enable Zigbee2MQTT permit_join mode through the web UI at port 8080 before attempting device pairing

Community Notes

Loading...
Loading notes...

Download Recipe Kit

Get all files in a ready-to-deploy package

Includes docker-compose.yml, .env template, README, and license

Ad Space