rivimey
Here is my docker compose for HA, MQTT, GIVTCP, Zigbee2MQTT, appdaemon and Postgres.
services:
postgres:
container_name: "postgres"
command:
- "postgres"
entrypoint:
- "docker-entrypoint.sh"
environment:
- "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/postgresql/15/bin"
- "GOSU_VERSION=1.16"
- "LANG=en_US.utf8"
- "PG_MAJOR=15"
- "PG_VERSION=15.2-1.pgdg110+1"
- "PGDATA=/var/lib/postgresql/data"
- "POSTGRES_PASSWORD=****"
hostname: "postgres"
image: "postgres:working"
network_mode: "bridge"
ports:
- "5433:5432/tcp"
restart: "always"
volumes:
- "/volume1/docker/homeassistant:/hass"
- "/volume1/docker/postgres:/var/lib/postgresql/data"
homeassistant:
container_name: "homeassistant"
entrypoint:
- "/init"
hostname: "homeassistant"
image: "linuxserver/homeassistant:latest"
network_mode: "host"
restart: "always"
volumes:
- "/volume1/docker/homeassistant:/config"
- homeassistant-tailscale:/var/lib/tailscale
working_dir: "/config"
mosquitto:
container_name: "mosquitto"
command:
- "/usr/sbin/mosquitto"
- "-c"
- "/mosquitto-no-auth.conf"
entrypoint:
- "/docker-entrypoint.sh"
hostname: "mosquitto"
image: "eclipse-mosquitto:2.0"
network_mode: "bridge"
ports:
- "1883:1883/tcp"
restart: "unless-stopped"
volumes:
- "/volume1/docker/mosquitto:/mosquitto"
- mosquitto-log:/mosquitto/log
- mosquitto-data:/mosquitto/data
GivTCP:
container_name: "GivTCP"
image: britkat/giv_tcp-ma:latest
ports:
- "1884:1883" # MQTT
- "6345:6345" # REST (add increments for each inverter)
- "3000:3000" # This should match the WEB_DASH_PORT ENV below
- "6379:6379" # Redis port for job queueing
- "9181:9181" # RQ Dashboard to view job scheduling
volumes:
- "/volume1/docker/givtcp:/config"
environment:
## Critical to update
- NUMINVERTORS=1 # Set this to the number of Inverters in your setup, then replicate the next two lines for each inverter (changing the last number of the ENV)
- INVERTOR_IP_1=192.168.1.30 # Set this to the IP address of your Inverter on your local network
- INVERTOR_AIO_1=False # Set this to true if you have an AIO
- INVERTOR_AC_1=False # Set this to true if you have an AC on old firmware and don't have the new registers
- NUMBATTERIES_1=2 # Number of battery modules installed and connected to the above inverter
- MQTT_OUTPUT=True # "True" if you want to publish your data to MQTT, "False" otherwise
- MQTT_ADDRESS=10.0.0.25 # IP address of an existing MQTT broker, or leave as "127.0.0.1" to use the internal broker
- MQTT_USERNAME= # Username of your existing broker, if needed. Not required for internal broker
- MQTT_PASSWORD= # Password of your existing broker, if needed. Not required for internal broker
- HOSTIP=10.0.0.25 # External IP address of the docker host (needed for web dashboard)
- CACHELOCATION=/config/GivTCP # Location of cache data, this folder can be mapped to a persistence storage outside the container
- TZ=Europe/London # Set to your Timezone
## Optional
- MQTT_TOPIC=GivTCP # Root topic to publish data to for Inverter 1. If left blank it will default to GivEnergy/<invertor_serial_number>
# - MQTT_TOPIC_2= # Root topic to publish data to for Inverter 2. If left blank it will default to GivEnergy/<invertor_serial_number>
# - MQTT_TOPIC_3= # Root topic to publish data to for Inverter 3. If left blank it will default to GivEnergy/<invertor_serial_number>
- MQTT_PORT=1883 # Port of your existing broker, leave as "1883" for internal broker
- LOG_LEVEL=Info # Level of logs to be reported: "Error", "Info" or "Debug"
- PRINT_RAW=True # If True this will publish all inverter data unprocessed as well as standard data
- SELF_RUN=True # If True the container will self-run and connect and publish data. If "False" the you will need to trigger externally via REST
- SELF_RUN_LOOP_TIMER=5 # Wait time between every read command to the inverter
- QUEUE_RETRIES=5 # The number of calls to the inverter when trying to set a register. A higher number improves the chance of inverter writes succeeding
- INFLUX_OUTPUT=False # "True" if you want to publish your data to InfluxDB, "False" otherwise
# - INFLUX_URL= # URL of an external Influx instance
# - INFLUX_TOKEN= # Access Token for your Influx instance
# - INFLUX_BUCKET= # Data Bucket of your Influx instance you want data sent to
# - INFLUX_ORG= # Influx instance Organisation
- HA_AUTO_D=True # If True (and if MQTT_OUTPUT is True) this will publish Home Assistant Auto Discovery messages to the broker
# - HADEVICEPREFIX=GivTCP # Defines the prefix for all entities in Home Assistant for inverter 1
# - HADEVICEPREFIX_2=GivTCP2 # Defines the prefix for all entities in Home Assistant for inverter 2
# - HADEVICEPREFIX_3=GivTCP3 # Defines the prefix for all entities in Home Assistant for inverter 3
- PYTHONPATH=/app
- DYNAMICTARIFF=True # When set to true DAYRATESTART and NIGHTRATESTART times are ignored and tariff rates are changed by a dedicated entity/function
# - DAYRATE=0.3022 # Price in £/$ for your daytime electricity per kWh
# - NIGHTRATE=0.1812 # Price in £/$ for your night time electricity per kWh
# - EXPORTRATE=0.33 # Price in £/$ for your export electricity per kWh
# - DAYRATESTART=05:00 # Time in HH:MM when your day time\expensive tariff kicks in
# - NIGHTRATESTART=02:00 # Time in HH:MM when your night time\cheap tariff kicks in
- WEB_DASH=False # Enable the web dashboard
- WEB_DASH_PORT=3000 # Port to serve the web dashboard on. Should be the same as the private port (above), not the container port
# - SMARTTARGET=False # Enables the PALM capability, requires the three ENV below to be set
# - GEAPI= # API Key for the GivEnergy Cloud
# - SOLCASTAPI= # API key for Solcast
# - SOLCASTSITEID= # SiteID for Solcast site (first array)
# - SOLCASTSITEID2= # SiteID for Solcast site (second array)
- DATASMOOTHER=medium # Set the data smoothing to most aggressive setting (High, medium, low, none)
# - PALM_WINTER=01,02,03,10,11,12 # Comma delimited list of the winter months (01=January, etc)
# - PALM_SHOULDER=04,05,09 # Comma delimited list of months in which consumption can vary so SOC calculation should be more cautious
# - PALM_MIN_SOC_TARGET=25 # Lower limit for state of charge (summertime)
# - PALM_MAX_SOC_TARGET=45 # Lower limit for SoC limit in shoulder months
# - PALM_BATT_RESERVE=4 # Battery reserve for power cuts (minimum of 4%)
# - PALM_BATT_UTILISATION=0.85 # Usable proportion of battery (100% less reserve and any charge limit) on a scale of 0-1
# - PALM_WEIGHT=35 # Weighting used for final target soc
# - LOAD_HIST_WEIGHT=1 # Load History Weighting
restart: always
privileged: true
zigbee2mqtt:
command:
- "/sbin/tini"
- "--"
- "node"
- "index.js"
container_name: "zigbee2mqtt"
devices:
- "/dev/ttyUSB0:/dev/ttyACM0"
entrypoint:
- "docker-entrypoint.sh"
environment:
- "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
- "NODE_ENV=production"
- "TZ=Europe/London"
hostname: "zigbee2mqtt"
image: "koenkk/zigbee2mqtt:latest"
network_mode: "bridge"
ports:
- "8020:8020/tcp"
restart: "unless-stopped"
security_opt:
- "label=disable"
volumes:
- "/run/udev:/run/udev:ro"
- "/volume1/docker/zigbee2mqtt:/app/data"
working_dir: "/app"
appdaemon:
container_name: "appdaemon"
entrypoint:
- "./dockerStart.sh"
environment:
- "HA_URL=http://127.0.0.1:8123"
- "TOKEN=***"
hostname: "appdaemon"
image: "acockburn/appdaemon:latest"
network_mode: "host"
ports:
- "5050:5050/tcp"
restart: "unless-stopped"
volumes:
- "/volume1/docker/homeassistant/appdaemon:/conf"
- "/etc/localtime:/etc/localtime:ro"
- appdaemon-certs:/certs
volumes:
mosquitto-log:
mosquitto-data:
appdaemon-certs:
version: "3.9"