Mosquitto - MQTT Broker
Central message bus for the smart home - connects Home Assistant, Frigate, Tasmota, Shelly and ESP devices.
Access
| Endpoint |
Details |
| MQTT TCP |
192.168.1.132:1883 (authentication required) |
| WebSockets |
192.168.1.132:9001 |
| Web UI |
None (headless broker) |
Configuration
- Image:
eclipse-mosquitto:2 (pinned to 2.x series)
- Network:
network_mode: host
- Config:
./mosquitto/config/mosquitto.conf
- Passwords:
./mosquitto/config/mosquitto.passwd (bcrypt format)
- Data:
./mosquitto/data/
- Logs:
./mosquitto/log/
Key Settings
| Setting |
Value |
Notes |
allow_anonymous |
false |
Authentication mandatory |
persistence |
false |
Retained messages cleared on restart - fine for typical HA sensor workloads |
persistent_client_expiration |
3m |
Offline clients removed after 3 minutes |
max_inflight_messages |
40 |
|
| Log level |
errors, warnings, notifications only |
No per-connection logging |
Optional config fragments can be placed in config/conf.d/*.conf (loaded via include_dir).
Architecture
Mosquitto MQTT Broker (:1883)
├── Home Assistant - subscribes/publishes device states
├── Frigate - publishes detection events (topic: frigate/#)
├── ESPHome - some devices via MQTT instead of native API
├── Tasmota - smart plugs, switches
└── Shelly - relays, power meters
User Management
# Add a new user (inside container)
docker compose exec mosquitto mosquitto_passwd /mosquitto/config/mosquitto.passwd <username>
# Change password
docker compose exec mosquitto mosquitto_passwd /mosquitto/config/mosquitto.passwd <username>
# Restart after changes
docker compose restart mosquitto
Useful Commands
# Follow broker logs
docker compose logs -f mosquitto
# Subscribe to ALL topics (requires mosquitto-clients on host)
mosquitto_sub -h 192.168.1.132 -u mosquitto -P <password> -t '#' -v
# Subscribe to Frigate events only
mosquitto_sub -h 192.168.1.132 -u mosquitto -P <password> -t 'frigate/#' -v
# Publish a test message
mosquitto_pub -h 192.168.1.132 -u mosquitto -P <password> -t 'test/topic' -m 'hello'