version: '3.8'
services:
  homeassistant:
    image: ghcr.io/home-assistant/home-assistant:stable
    container_name: homeassistant
    volumes:
      - /home/jonathan/homeassistant/config:/config
    ports:
      - 8123:8123
    devices:
      - /dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Controller_51600E94-if00-port0:/dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Controller_51600E94-if00-port0
      - /dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Controller_51600E94-if01-port0:/dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Controller_51600E94-if01-port0
    environment:
      - PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
      - LANG=C.UTF-8
      - S6_BEHAVIOUR_IF_STAGE2_FAILS=2
      - S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0
      - S6_CMD_WAIT_FOR_SERVICES=1
      - S6_SERVICES_READYTIME=50
      - UV_EXTRA_INDEX_URL=https://wheels.home-assistant.io/musllinux-index/
      - S6_SERVICES_GRACETIME=240000
      - UV_SYSTEM_PYTHON=true
      - UV_NO_CACHE=true
    privileged: true
    restart: unless-stopped
  esphome:
    container_name: esphome
    image: ghcr.io/esphome/esphome
    volumes:
      - ./esphome:/config
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "6052:6052"
    restart: unless-stopped
  homeway:
    container_name: homeway
    image: homewayio/homeway:latest
    restart: unless-stopped
    network_mode: "host"
    environment:
      - TZ=America/New_York
      - HOME_ASSISTANT_IP= 192.168.50.181
      - HOME_ASSISTANT_ACCESS_TOKEN= eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI0NjQyNmFiOTBhZmU0ZjBlYjIyMzI2ZjFhZWQxZGFlNSIsImlhdCI6MTc0NjM2ODUzNywiZXhwIjoyMDYxNzI4NTM3fQ.ssfLg_3OZSOuRmXhSNqNyz8TRgIVzZxQI9ym4ZSTeqU
    volumes:
      - /home/jonathan/homeway/config:/data
    ports:
      # These port mappings are not strictly necessary with host network mode
      # but are included for documentation purposes
      - "8888:8888" # Web UI 
      - "443:443"   # HTTPS port for Homeway proxy