version: "3.8"
services:
  raspberrymatic:
    image: ghcr.io/jens-maus/raspberrymatic:latest
    container_name: ccu
    hostname: homematic-raspi
    privileged: true
    restart: unless-stopped
    stop_grace_period: 30s
    volumes:
      - ccu_data:/usr/local:rw
      - /lib/modules:/lib/modules:ro
      - ./tools:/usr/local/addons/tools/
    ports:
      - "8080:80"
      - "2001:2001"
      - "2010:2010"
      - "9292:9292"
      - "8181:8181"
  
  homeassistant:
    container_name: homeassistant
    image: homeassistant/raspberrypi4-homeassistant:stable
    volumes:
      - ./homeassistant:/config
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped
    #network_mode: host
    links:
      - "raspberrymatic:raspberrymatic"
      - "mqtt:mqtt"
    ports:
      - "8123:8123"
      - "8060:8060"
      - "8883:8883"
    # see https://community.home-assistant.io/t/migration-to-2021-7-fails-fatal-python-error-init-interp-main-cant-initialize-time/320648/28
    security_opt:
      - seccomp:unconfined

  #mqtt for the milight bridge
  mqtt:
    image: eclipse-mosquitto
    container_name: mqtt
    restart: unless-stopped 
    volumes:
      - ./mosquitto/config:/mosquitto/config
      - ./mosquitto/data:/mosquitto/data
      - ./mosquitto/log:/mosquitto/log
    ports:
      - "1883:1883"
      - "9001:9001"

volumes:
  ccu_data:
