Complete Home Automation Stack
Home Assistant with Node-RED automation, InfluxDB metrics, Grafana dashboards, and Mosquitto MQTT
Overview
Home Assistant is an open-source home automation platform that puts local control and privacy first, integrating with over 2000 different devices and services to create a unified smart home experience. Originally created by Paulus Schoutsen in 2013, it has grown into the most comprehensive home automation solution available, supporting everything from simple light switches to complex climate systems, security cameras, and energy monitoring devices.
This complete automation stack combines Home Assistant's central hub capabilities with Node-RED's visual automation flows, InfluxDB's time-series data storage, Grafana's analytical dashboards, and Mosquitto's MQTT message broker to create a comprehensive IoT ecosystem. The stack enables you to not only control devices but also collect historical data, create complex automations through visual programming, and gain insights through professional monitoring dashboards. Zigbee2MQTT adds direct Zigbee device support without requiring proprietary hubs.
This configuration is ideal for serious home automation enthusiasts, IoT developers, and homelab operators who want complete control over their smart home infrastructure while maintaining data privacy and local operation. Unlike cloud-based solutions like SmartThings or commercial platforms, this stack keeps all data processing local while providing enterprise-grade monitoring and automation capabilities typically found in industrial IoT deployments.
Key Features
- 2000+ device integrations including Philips Hue, Nest, Sonos, and major IoT protocols
- Visual flow-based automation programming through Node-RED's drag-and-drop interface
- Time-series sensor data storage with InfluxDB's high-performance write capabilities
- Professional monitoring dashboards with Grafana's 50+ visualization types
- Direct Zigbee device control without proprietary hubs via Zigbee2MQTT
- MQTT message broker for reliable IoT device communication
- Energy monitoring and solar panel integration for sustainability tracking
- Voice assistant support for Alexa, Google Assistant, and local wake word detection
Common Use Cases
- 1Complete smart home automation with heating, lighting, security, and entertainment systems
- 2Energy monitoring and solar panel optimization with historical usage analytics
- 3IoT sensor data collection for greenhouse, aquarium, or workshop monitoring
- 4Home security system with camera integration, motion detection, and mobile alerts
- 5Multi-protocol device integration combining WiFi, Zigbee, Z-Wave, and Bluetooth devices
- 6Rental property monitoring with tenant-friendly automation and remote management
- 7Small business or retail automation for lighting, HVAC, and occupancy sensing
Prerequisites
- Docker host with minimum 4GB RAM (8GB recommended for full stack operation)
- Available ports 8123, 1880, 3000, 8080, 8086, 1883, and 9001 on the host system
- USB Zigbee coordinator device (like ConBee II or Sonoff Zigbee) for device integration
- Basic understanding of YAML configuration and MQTT messaging concepts
- Network access to IoT devices or ability to configure device discovery protocols
- Storage space for time-series data (plan for 1-10GB depending on sensor count and retention)
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 container_name: homeassistant5 restart: unless-stopped6 network_mode: host7 volumes: 8 - ./homeassistant/config:/config9 - /etc/localtime:/etc/localtime:ro10 environment: 11 - TZ=${TZ:-UTC}1213 mosquitto: 14 image: eclipse-mosquitto:latest15 container_name: mosquitto16 restart: unless-stopped17 ports: 18 - "1883:1883"19 - "9001:9001"20 volumes: 21 - ./mosquitto/config:/mosquitto/config22 - ./mosquitto/data:/mosquitto/data23 - ./mosquitto/log:/mosquitto/log2425 node-red: 26 image: nodered/node-red:latest27 container_name: node-red28 restart: unless-stopped29 ports: 30 - "${NODERED_PORT:-1880}:1880"31 volumes: 32 - node_red_data:/data33 environment: 34 - TZ=${TZ:-UTC}3536 influxdb: 37 image: influxdb:2.738 container_name: influxdb39 restart: unless-stopped40 ports: 41 - "${INFLUXDB_PORT:-8086}:8086"42 environment: 43 - DOCKER_INFLUXDB_INIT_MODE=setup44 - DOCKER_INFLUXDB_INIT_USERNAME=${INFLUX_USER}45 - DOCKER_INFLUXDB_INIT_PASSWORD=${INFLUX_PASSWORD}46 - DOCKER_INFLUXDB_INIT_ORG=home47 - DOCKER_INFLUXDB_INIT_BUCKET=homeassistant48 - DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=${INFLUX_TOKEN}49 volumes: 50 - influxdb_data:/var/lib/influxdb25152 grafana: 53 image: grafana/grafana:latest54 container_name: grafana55 restart: unless-stopped56 ports: 57 - "${GRAFANA_PORT:-3000}:3000"58 environment: 59 - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD:-admin}60 volumes: 61 - grafana_data:/var/lib/grafana62 depends_on: 63 - influxdb6465 zigbee2mqtt: 66 image: koenkk/zigbee2mqtt:latest67 container_name: zigbee2mqtt68 restart: unless-stopped69 ports: 70 - "${Z2M_PORT:-8080}:8080"71 volumes: 72 - ./zigbee2mqtt/data:/app/data73 - /run/udev:/run/udev:ro74 environment: 75 - TZ=${TZ:-UTC}76 devices: 77 - /dev/ttyUSB0:/dev/ttyUSB078 depends_on: 79 - mosquitto8081volumes: 82 node_red_data: 83 influxdb_data: 84 grafana_data: .env Template
.env
1# Complete Home Automation Stack2NODERED_PORT=18803INFLUXDB_PORT=80864GRAFANA_PORT=30005Z2M_PORT=80806TZ=America/New_York78# InfluxDB9INFLUX_USER=admin10INFLUX_PASSWORD=adminpassword11INFLUX_TOKEN=your-influxdb-token1213# Grafana14GRAFANA_PASSWORD=adminUsage Notes
- 1Home Assistant at http://localhost:8123 (network_mode: host)
- 2Node-RED at http://localhost:1880
- 3Grafana at http://localhost:3000
- 4Zigbee2MQTT at http://localhost:8080
- 5Configure HA to send data to InfluxDB
- 6Create mosquitto.conf with listener settings
Individual Services(6 services)
Copy individual services to mix and match with your existing compose files.
homeassistant
homeassistant:
image: ghcr.io/home-assistant/home-assistant:stable
container_name: homeassistant
restart: unless-stopped
network_mode: host
volumes:
- ./homeassistant/config:/config
- /etc/localtime:/etc/localtime:ro
environment:
- TZ=${TZ:-UTC}
mosquitto
mosquitto:
image: eclipse-mosquitto:latest
container_name: mosquitto
restart: unless-stopped
ports:
- "1883:1883"
- "9001:9001"
volumes:
- ./mosquitto/config:/mosquitto/config
- ./mosquitto/data:/mosquitto/data
- ./mosquitto/log:/mosquitto/log
node-red
node-red:
image: nodered/node-red:latest
container_name: node-red
restart: unless-stopped
ports:
- ${NODERED_PORT:-1880}:1880
volumes:
- node_red_data:/data
environment:
- TZ=${TZ:-UTC}
influxdb
influxdb:
image: influxdb:2.7
container_name: influxdb
restart: unless-stopped
ports:
- ${INFLUXDB_PORT:-8086}:8086
environment:
- DOCKER_INFLUXDB_INIT_MODE=setup
- DOCKER_INFLUXDB_INIT_USERNAME=${INFLUX_USER}
- DOCKER_INFLUXDB_INIT_PASSWORD=${INFLUX_PASSWORD}
- DOCKER_INFLUXDB_INIT_ORG=home
- DOCKER_INFLUXDB_INIT_BUCKET=homeassistant
- DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=${INFLUX_TOKEN}
volumes:
- influxdb_data:/var/lib/influxdb2
grafana
grafana:
image: grafana/grafana:latest
container_name: grafana
restart: unless-stopped
ports:
- ${GRAFANA_PORT:-3000}:3000
environment:
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD:-admin}
volumes:
- grafana_data:/var/lib/grafana
depends_on:
- influxdb
zigbee2mqtt
zigbee2mqtt:
image: koenkk/zigbee2mqtt:latest
container_name: zigbee2mqtt
restart: unless-stopped
ports:
- ${Z2M_PORT:-8080}:8080
volumes:
- ./zigbee2mqtt/data:/app/data
- /run/udev:/run/udev:ro
environment:
- TZ=${TZ:-UTC}
devices:
- /dev/ttyUSB0:/dev/ttyUSB0
depends_on:
- mosquitto
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 container_name: homeassistant7 restart: unless-stopped8 network_mode: host9 volumes:10 - ./homeassistant/config:/config11 - /etc/localtime:/etc/localtime:ro12 environment:13 - TZ=${TZ:-UTC}1415 mosquitto:16 image: eclipse-mosquitto:latest17 container_name: mosquitto18 restart: unless-stopped19 ports:20 - "1883:1883"21 - "9001:9001"22 volumes:23 - ./mosquitto/config:/mosquitto/config24 - ./mosquitto/data:/mosquitto/data25 - ./mosquitto/log:/mosquitto/log2627 node-red:28 image: nodered/node-red:latest29 container_name: node-red30 restart: unless-stopped31 ports:32 - "${NODERED_PORT:-1880}:1880"33 volumes:34 - node_red_data:/data35 environment:36 - TZ=${TZ:-UTC}3738 influxdb:39 image: influxdb:2.740 container_name: influxdb41 restart: unless-stopped42 ports:43 - "${INFLUXDB_PORT:-8086}:8086"44 environment:45 - DOCKER_INFLUXDB_INIT_MODE=setup46 - DOCKER_INFLUXDB_INIT_USERNAME=${INFLUX_USER}47 - DOCKER_INFLUXDB_INIT_PASSWORD=${INFLUX_PASSWORD}48 - DOCKER_INFLUXDB_INIT_ORG=home49 - DOCKER_INFLUXDB_INIT_BUCKET=homeassistant50 - DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=${INFLUX_TOKEN}51 volumes:52 - influxdb_data:/var/lib/influxdb25354 grafana:55 image: grafana/grafana:latest56 container_name: grafana57 restart: unless-stopped58 ports:59 - "${GRAFANA_PORT:-3000}:3000"60 environment:61 - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD:-admin}62 volumes:63 - grafana_data:/var/lib/grafana64 depends_on:65 - influxdb6667 zigbee2mqtt:68 image: koenkk/zigbee2mqtt:latest69 container_name: zigbee2mqtt70 restart: unless-stopped71 ports:72 - "${Z2M_PORT:-8080}:8080"73 volumes:74 - ./zigbee2mqtt/data:/app/data75 - /run/udev:/run/udev:ro76 environment:77 - TZ=${TZ:-UTC}78 devices:79 - /dev/ttyUSB0:/dev/ttyUSB080 depends_on:81 - mosquitto8283volumes:84 node_red_data:85 influxdb_data:86 grafana_data:87EOF8889# 2. Create the .env file90cat > .env << 'EOF'91# Complete Home Automation Stack92NODERED_PORT=188093INFLUXDB_PORT=808694GRAFANA_PORT=300095Z2M_PORT=808096TZ=America/New_York9798# InfluxDB99INFLUX_USER=admin100INFLUX_PASSWORD=adminpassword101INFLUX_TOKEN=your-influxdb-token102103# Grafana104GRAFANA_PASSWORD=admin105EOF106107# 3. Start the services108docker compose up -d109110# 4. View logs111docker 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/complete-home-automation/run | bashTroubleshooting
- Home Assistant 'Recorder database is corrupt': Stop container, delete home-assistant.db from config volume, restart to rebuild database from scratch
- Zigbee2MQTT 'Error: No such file or directory: /dev/ttyUSB0': Check USB device path with 'ls /dev/tty*' and update device mapping in compose file
- InfluxDB connection refused from Grafana: Verify INFLUX_TOKEN environment variable matches between services and check InfluxDB initialization logs
- Node-RED flows not triggering Home Assistant: Ensure Home Assistant Node-RED addon or companion nodes are installed and HA long-lived access token is configured
- Mosquitto MQTT authentication failures: Create mosquitto.conf with 'allow_anonymous true' for testing, then implement proper authentication with password file
- Grafana shows no data sources: Configure InfluxDB data source with proper URL 'http://influxdb:8086', organization 'home', and valid authentication token
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-assistantnode-redinfluxdbgrafanamosquitto
Tags
#home-assistant#node-red#influxdb#grafana#mqtt#iot#automation
Category
Home Lab & Self-HostingAd Space
Shortcuts: C CopyF FavoriteD Download