Skip to content

Instantly share code, notes, and snippets.

@Inkimar
Last active February 10, 2024 23:06
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 Inkimar/1629ba0434a3665c96c382c56352da4c to your computer and use it in GitHub Desktop.
Save Inkimar/1629ba0434a3665c96c382c56352da4c to your computer and use it in GitHub Desktop.
raspberry pi 5, Home Assistant , docker-compose
Running on Debian 12 (bookworm)
Questions asked:
if you check out this gist, there you can see me docker-compose.yml ( https://gist.github.com/Inkimar/1629ba0434a3665c96c382c56352da4c?permalink_comment_id=4888824#gistcomment-4888824) - Here you can see that my 'homeassistant' depend_on my 'zigbee2mqtt' and that 'zigbee2mqtt' depends_on my 'mosquitto' - I think this is an ok setting. That my next step is to configure the MQTT to Mosquitto, not sure if I do this in my home-assistant dashboard or do this from the config-file/s .
@Inkimar
Copy link
Author

Inkimar commented Feb 10, 2024

docker-compose.yml

version: '3.0'

services:
  portainer:
    container_name: portainer
    image: portainer/portainer-ce
    restart: always
    ports:
      - "9000:9000/tcp"
    environment:
      - TZ=Europe/Stockholm
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /opt/portainer:/data
  homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    environment:
      DISABLE_JEMALLOC: 'true'
    volumes:
      - /opt/homeassistant/config:/config
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped
    privileged: true
    network_mode: host
    depends_on:
      #- "mariadb"
      - "zigbee2mqtt"
  mosquitto:
    image: eclipse-mosquitto:2.0.18
    container_name: mosquitto
    volumes:
      - /opt/mosquitto:/mosquitto
      - /opt/mosquitto/data:/mosquitto/data
      - /opt/mosquitto/log:/mosquitto/log
    ports:
      - 1883:1883
      - 9001:9001
  zigbee2mqtt:
    image: koenkk/zigbee2mqtt:1.29.2
    container_name: zigbee2mqtt
      #restart: unless-stopped
    volumes:
      - ./zigbee2mqtt/data:/app/data
      - /run/udev:/run/udev:ro
    ports:
      # Frontend port
      - 8080:8080
    environment:
      - TZ=Europe/Stockholm
        #user: "1000:1000"
    devices:
      # Make sure this matched your adapter location
      - /dev/serial/by-id/usb-ITEAD_SONOFF_Zigbee_3.0_USB_Dongle_Plus_V2_20221130162739-if00:/dev/ttyACM0
    depends_on:
      - "mosquitto"

@Inkimar
Copy link
Author

Inkimar commented Feb 10, 2024

Configuration-files

homeassistant

/opt/homeassistant/config $ cat configuration.yaml

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

mosquitto

/opt/mosquitto/config $ cat mosquitto.conf

persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log
listener 1883

## Authentication ##
allow_anonymous true

zigbee2mqtt

/opt/zigbee2mqtt/data $ cat configuration.yaml

homeassistant: false
permit_join: true
frontend: true
mqtt:
  base_topic: zigbee2mqtt
  server: mqtt://mosquitto:1883
  serial:
    port: /dev/ttyACM0
      #adapter: ezsp
      #adapter: deconz
# Required: serial settings
#serial:
  # Required: location of the adapter (e.g. CC2531).
  # USB adapters - use format "port: /dev/ttyACM0"
  # To autodetect the USB port, set 'port: null'.
  # Ethernet adapters - use format "port: tcp://192.168.1.12:6638"
  # port: /dev/ttyACM0
  #disable_led: false
  #adapter: "ezsp"
  #baudrate: 115200
  #rtscts: false
advanced:
  network_key:
    - 83
    - 167
    - 122
    - 111
    - 152
    - 187
    - 251
    - 221
    - 157
    - 203
    - 144
    - 186
    - 225
    - 195
    - 90
    - 229
  pan_id: 47421
  ext_pan_id:
    - 47
    - 2
    - 145
    - 208
    - 4
    - 107
    - 71
    - 30
  homeassistant_legacy_entity_attributes: false
  legacy_api: false
  legacy_availability_payload: false
device_options:
  legacy: false

@Inkimar
Copy link
Author

Inkimar commented Feb 10, 2024

Get Started with the Home Assistant MQTT Integration

https://www.youtube.com/watch?v=tZjW1IHZ3Lc

@Inkimar
Copy link
Author

Inkimar commented Feb 10, 2024

ny -> /opt/zigbee2mqtt/data $ cat configuration.yaml
Tillkommer-> homeassistant: true

/opt/zigbee2mqtt/data $ cat configuration.yaml
homeassistant: true
permit_join: true
frontend: true
mqtt:
  base_topic: zigbee2mqtt
  server: mqtt://mosquitto:1883
  serial:
    port: /dev/ttyACM0
advanced:
  network_key:
    - 83
    - 167
    - 122
    - 111
    - 152
    - 187
    - 251
    - 221
    - 157
    - 203
    - 144
    - 186
    - 225
    - 195
    - 90
    - 229
  pan_id: 47421
  ext_pan_id:
    - 47
    - 2
    - 145
    - 208
    - 4
    - 107
    - 71
    - 30
  homeassistant_legacy_entity_attributes: false
  legacy_api: false
  legacy_availability_payload: false
device_options:
  legacy: false

Vid omstart av tjänsten så dyker dina devices upp i slutet av configuration.yml

devices:
  '0xa4c138bc77452fe7':
    friendly_name: '0xa4c138bc77452fe7'
  '0xa4c1386b3c858e78':
    friendly_name: '0xa4c1386b3c858e78'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment