- mqtt_audio_bridge.py: MQTT_USER / MQTT_PASS are read from the environment, falling back to ~/.config/environment.d/10-secrets.conf (mode 600). The environment.d trap means a fresh SSH shell needs the file fallback. - docker-compose.yml: pass MQTT_USER / MQTT_PASS through; keeps the live network_mode / Dockerfile topology. - start_bridge.sh: launcher that sources the secrets file before compose up. - app.py: commits the live initial_prompt that was uncommitted. - .gitignore: add venv/ (was missing), __pycache__, *.bak*, *.wav. - git rm -r --cached venv/: 13,413 tracked venv files removed from the index. Credential note: MQTT_PASS was hardcoded in edaf914. origin/main was later force-rewritten to redact it, but the value was exposed and must still be rotated. Removing venv/ from the index does not shrink the repository: the objects stay in history until a history rewrite and GC. Co-Authored-By: Paperclip <noreply@paperclip.ing>
Voice Assistant Bridge (Docker Backend)
This repository contains the backend infrastructure for the local Voice Assistant system. It acts as the middleware between the ESP32 audio stream and Home Assistant.
🏗️ Architecture
graph LR
ESP32[ESP32 Hardware] -->|MQTT Audio Stream| Bridge
Bridge[Python Bridge] -->|HTTP Request| Whisper[Faster-Whisper Container]
Whisper -->|Text| Bridge
Bridge -->|MQTT Text Command| HA[Home Assistant]
Bridge -->|MQTT Status| ESP32
🧩 Components
1. docker-compose.yml
Orchestrates two containers:
voice-bridge: The logic handler. Listens to MQTT audio, buffers it, detects Wake Words viaOpenWakeWord, and handles routing.whisper-api: A lightweight Flask API wrappingfaster-whisperfor Speech-to-Text conversion.
2. mqtt_audio_bridge.py
The main Python script running inside the voice-bridge container.
- Input: Listens to raw PCM audio on
voice/audio_stream(Broker .13). - Processing:
- Uses OpenWakeWord to detect "Hey Jarvis".
- Buffers audio and sends to Whisper API.
- Safety mechanisms (Memory limits, Log rotation).
- Output: Publishes transcribed text to
homeassistant/voice/text(Broker .30).
3. app.py
The Whisper API endpoint.
- Model:
small.en(Optimized for CPU usage withint8quantization). - Language: Locked to English to prevent hallucinations on static/silence.
🚀 Deployment
- Requirements: Docker & Docker Compose.
- Configuration: Update IP addresses in
mqtt_audio_bridge.pyfor your MQTT brokers. - Run:
docker compose up -d
🔧 Debugging
View Logs:
docker compose logs -f voice_bridge
Restart Stack:
docker compose restart
Description
Languages
Python
81.9%
Shell
15.3%
Dockerfile
2.8%