Skip to content

Instantly share code, notes, and snippets.

@gbrayut
Last active November 28, 2023 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gbrayut/a33577b5d2c25c28c61b0a3b0eff6ebf to your computer and use it in GitHub Desktop.
Save gbrayut/a33577b5d2c25c28c61b0a3b0eff6ebf to your computer and use it in GitHub Desktop.
Home assistant docker compose file
version: '3.7'
services:
homeassistant:
container_name: home-assistant
image: homeassistant/home-assistant:stable
ports:
- "8123"
volumes:
- /data/homeassistant:/config
- /data/ssl:/ssl
- /etc/localtime:/etc/localtime:ro
- /run/dbus:/run/dbus:ro
privileged: true # required for bluetooth?
dns:
- 192.168.0.1
restart: always
network_mode: host
mqtt: # https://techoverflow.net/2021/11/25/how-to-setup-standalone-mosquitto-mqtt-broker-using-docker-compose/
container_name: mqtt
image: eclipse-mosquitto:2.0.15 # https://hub.docker.com/_/eclipse-mosquitto replaces toke/mosquitto
ports:
- "1883:1883"
- "9001:9001"
volumes:
- /data/mqtt/config:/mosquitto/config
- /data/mqtt/data:/mosquitto/data
- /data/mqtt/log:/mosquitto/log
# old settings for toke/mosquitto
#- /data/mqtt/config:/mqtt/config
#- /data/mqtt/data:/mqtt/data
#- /data/mqtt/log:/mqtt/log
dns:
- 192.168.0.1
restart: always
network_mode: host
# https://zwave-js.github.io/zwavejs2mqtt/#/usage/setup
zwavejs2mqtt:
container_name: zwavejs2mqtt
image: zwavejs/zwavejs2mqtt:latest #or previous working :8.21?
restart: always
tty: true
stop_signal: SIGINT
environment:
- SESSION_SECRET=mysessionsecret
- ZWAVEJS_EXTERNAL_CONFIG=/usr/src/app/store/.config-db
# Uncomment if you want logs time and dates to match your timezone instead of UTC
# Available at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
- TZ=America/Denver
network_mode: host
#networks:
# - zwave
devices:
# Do not use /dev/ttyUSBX serial devices, as those mappings can change over time.
# Instead, use the /dev/serial/by-id/X serial device for your Z-Wave stick.
#- '/dev/ttyACM0:/dev/zwave' UZB 500 series now bricked
- '/dev/ttyUSB0:/dev/zwave' # new 700 series
volumes:
- /data/zwave-config:/usr/src/app/store
ports:
- '8091:8091' # port for web interface
- '3000:3000' # port for Z-Wave JS websocket server
# esphome.io for managing esp based iot devices
esphome:
container_name: esphome
image: ghcr.io/esphome/esphome
volumes:
- /data/homeassistant/esphome:/config
- /etc/localtime:/etc/localtime:ro
restart: always
privileged: true
network_mode: host
ports:
- '6052:6052' # esphome dashboard
# manage cameras using https://github.com/motioneye-project/motioneye
motioneye:
hostname: gbcamera
#image: ccrisan/motioneye:master-armhf is the old py2 version. edge is py3 branch
image: ghcr.io/motioneye-project/motioneye:edge # https://github.com/motioneye-project/motioneye/pkgs/container/motioneye
restart: unless-stopped
network_mode: "host" # Less proxying of packets and don't have to include all the 9081-90xx streaming ports below
volumes:
- "/data/motioneye/etc:/etc/motioneye" # previously saved in userfiles/etc/motioneye
- "/data/motioneye/var_lib:/var/lib/motioneye" # where the camera snapshots/videos are saved
- /etc/localtime:/etc/localtime:ro
ports:
- "8081:8081"
- "8765:8765"
#devices:
# - "/dev/video0:/dev/video0" # or use /dev/v4l/by-id/...
#healthcheck:
# test: ["CMD", "...todo..."] # Need to add something for checking if usb camera crashes and container should be restarted
# start_period: 30s
#environment:
# TZ: America/Denver
#!/bin/sh
# save as /etc/cron.monthly/docker-update or cron.weekly to auto update all container images and restart them
# https://containrrr.dev/watchtower/arguments/
docker run -d --rm --name watchtower -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --run-once
docker system prune --all --volumes -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment