Hey everyone! I wanted to share my journey of setting up two Home Assistant instances to communicate via MQTT. At first, I was a bit overwhelmed by the configuration, but I managed to get everything working smoothly. I’ve included some tips below that might help others facing similar challenges.
The Setup:
I have a master instance running on a Raspberry Pi and a slave instance on another device. Both are running Home Assistant 0.54.0. My goal was to have the slave instance trigger specific actions on the master, like playing music through Clementine.
The Challenges:
Initially, I noticed a lot of disconnections. The slave kept reconnecting every couple of minutes, and the master was logging warnings about failed CONNECT packets. I checked my firewall settings and confirmed that port 1883 was open, but the issue persisted.
The Solution:
After some research, I realized the problem was with the MQTT broker settings. I adjusted the mosquitto.conf file to increase the connection timeout and retry delay. This gave the slave more time to establish a stable connection. I also ensured both instances were using the same MQTT protocol version and added some logging to monitor the connection status.
Tips for Others:- Check Broker Settings: Make sure your MQTT broker is configured to handle multiple connections, especially if you’re running embedded brokers.- Log Monitoring: Use Home Assistant’s built-in logging to track MQTT activity. It’s a great way to spot connection issues early.- Firewall Rules: Double-check your firewall settings to ensure MQTT traffic isn’t being blocked.
Final Thoughts:
It’s been a learning experience, but now my two instances are communicating perfectly. The slave can trigger actions on the master without any hiccups. If anyone has questions or needs help, feel free to ask! ![]()