Home Assistant Full Stack
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:stable4 environment: 5 TZ: ${TZ}6 volumes: 7 - ha_config:/config8 ports: 9 - "8123:8123"10 privileged: true11 depends_on: 12 - mosquitto13 - influxdb14 networks: 15 - homelab-net16 restart: unless-stopped1718 mosquitto: 19 image: eclipse-mosquitto:latest20 ports: 21 - "1883:1883"22 - "9001:9001"23 volumes: 24 - mosquitto_config:/mosquitto/config25 - mosquitto_data:/mosquitto/data26 - mosquitto_log:/mosquitto/log27 networks: 28 - homelab-net29 restart: unless-stopped3031 zigbee2mqtt: 32 image: koenkk/zigbee2mqtt:latest33 environment: 34 TZ: ${TZ}35 volumes: 36 - zigbee2mqtt_data:/app/data37 devices: 38 - /dev/ttyUSB0:/dev/ttyUSB039 depends_on: 40 - mosquitto41 ports: 42 - "8080:8080"43 networks: 44 - homelab-net45 restart: unless-stopped4647 influxdb: 48 image: influxdb:2.749 environment: 50 DOCKER_INFLUXDB_INIT_MODE: setup51 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/influxdb259 networks: 60 - homelab-net61 restart: unless-stopped6263 grafana: 64 image: grafana/grafana:latest65 environment: 66 GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD}67 ports: 68 - "3000:3000"69 volumes: 70 - grafana_data:/var/lib/grafana71 depends_on: 72 - influxdb73 networks: 74 - homelab-net75 restart: unless-stopped7677volumes: 78 ha_config: 79 mosquitto_config: 80 mosquitto_data: 81 mosquitto_log: 82 zigbee2mqtt_data: 83 influxdb_data: 84 grafana_data: 8586networks: 87 homelab-net: 88 driver: bridge.env Template
.env
1# Timezone2TZ=UTC34# InfluxDB5INFLUX_USER=admin6INFLUX_PASSWORD=secure_influx_password7INFLUX_ORG=homelab8INFLUX_BUCKET=homeassistant910# Grafana11GRAFANA_PASSWORD=secure_grafana_passwordUsage Notes
- 1Home Assistant at http://localhost:8123
- 2Zigbee2MQTT UI at http://localhost:8080
- 3Grafana dashboards at http://localhost:3000
- 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 file2cat > docker-compose.yml << 'EOF'3services:4 homeassistant:5 image: ghcr.io/home-assistant/home-assistant:stable6 environment:7 TZ: ${TZ}8 volumes:9 - ha_config:/config10 ports:11 - "8123:8123"12 privileged: true13 depends_on:14 - mosquitto15 - influxdb16 networks:17 - homelab-net18 restart: unless-stopped1920 mosquitto:21 image: eclipse-mosquitto:latest22 ports:23 - "1883:1883"24 - "9001:9001"25 volumes:26 - mosquitto_config:/mosquitto/config27 - mosquitto_data:/mosquitto/data28 - mosquitto_log:/mosquitto/log29 networks:30 - homelab-net31 restart: unless-stopped3233 zigbee2mqtt:34 image: koenkk/zigbee2mqtt:latest35 environment:36 TZ: ${TZ}37 volumes:38 - zigbee2mqtt_data:/app/data39 devices:40 - /dev/ttyUSB0:/dev/ttyUSB041 depends_on:42 - mosquitto43 ports:44 - "8080:8080"45 networks:46 - homelab-net47 restart: unless-stopped4849 influxdb:50 image: influxdb:2.751 environment:52 DOCKER_INFLUXDB_INIT_MODE: setup53 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/influxdb261 networks:62 - homelab-net63 restart: unless-stopped6465 grafana:66 image: grafana/grafana:latest67 environment:68 GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD}69 ports:70 - "3000:3000"71 volumes:72 - grafana_data:/var/lib/grafana73 depends_on:74 - influxdb75 networks:76 - homelab-net77 restart: unless-stopped7879volumes:80 ha_config:81 mosquitto_config:82 mosquitto_data:83 mosquitto_log:84 zigbee2mqtt_data:85 influxdb_data:86 grafana_data:8788networks:89 homelab-net:90 driver: bridge91EOF9293# 2. Create the .env file94cat > .env << 'EOF'95# Timezone96TZ=UTC9798# InfluxDB99INFLUX_USER=admin100INFLUX_PASSWORD=secure_influx_password101INFLUX_ORG=homelab102INFLUX_BUCKET=homeassistant103104# Grafana105GRAFANA_PASSWORD=secure_grafana_password106EOF107108# 3. Start the services109docker compose up -d110111# 4. View logs112docker compose logs -fOne-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 | bashTroubleshooting
- 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
Components
home-assistantmosquittozigbee2mqttinfluxdbgrafana
Tags
#home-assistant#smart-home#mqtt#zigbee#iot
Category
Home Lab & Self-HostingAd Space
Shortcuts: C CopyF FavoriteD Download