[services.home-assistant]
container_name = "home-assistant"
image = "homeassistant/home-assistant"
environment = ["TZ=Europe/Helsinki"]
devices = ["/dev/ttyACM0"]
volumes = [
  "/docker/homeautomation/home-assistant:/config",
  "/etc/localtime:/etc/localtime:ro",
]
restart = "unless-stopped"
networks = ["homeautomation", "postgres", "proxy"]
ports = ["8123:8123", "8300:8300"]
extra_hosts = ["host.docker.internal:host-gateway"]
depends_on = ["mosquitto"]
labels = [
  "traefik.enable=true",
  "traefik.docker.network=proxy",
  "traefik.http.routers.home-assistant-redirect.entrypoints=http",
  "traefik.http.routers.home-assistant-redirect.rule=Host(`home.korhonen.cc`)",
  "traefik.http.routers.home-assistant-redirect.middlewares=http2https@file",
  "traefik.http.routers.home-assistant.entrypoints=https",
  "traefik.http.routers.home-assistant.middlewares=secHeaders@file,compress@file",
  "traefik.http.routers.home-assistant.rule=Host(`home.korhonen.cc`)",
  "traefik.http.routers.home-assistant.service=home-assistant",
  "traefik.http.services.home-assistant.loadbalancer.server.port=8123",
]

[services.esphome]
container_name = "esphome"
image = "esphome/esphome"
volumes = ["/docker/homeautomation/esphome:/config"]
restart = "unless-stopped"
network_mode = "host"

[services.mosquitto]
container_name = "mosquitto"
image = "eclipse-mosquitto"
environment = ["TZ=Europe/Helsinki"]
ports = ["1883:1883"]
networks = ["homeautomation"]
volumes = [
  "/docker/homeautomation/mosquitto:/mosquitto",
  "/etc/localtime:/etc/localtime:ro",
]
restart = "unless-stopped"

[services.rhasspy]
container_name = "rhasspy"
image = "rhasspy/rhasspy"
command = "--profile en --user-profiles /profiles"
volumes = ["/docker/homeautomation/rhasspy:/profiles"]
environment = ["TZ=Europe/Helsinki"]
ports = ["12101:12101"]
networks = ["homeautomation"]
restart = "unless-stopped"
depends_on = ["home-assistant"]
devices = ["/dev/snd:/dev/snd"]

[networks]

[networks.homeautomation]
external = false

[networks.postgres]
external = true

[networks.proxy]
external = true
