MQTT Broker Add On Stops

New user (long time OpenHAB user) looking to take advantage of some HA abilities. Specifically Big Ass Fans integration since the last Haiku firmware update broke connections (and HA group fixed rather quickly). I installed Home Assistant OS on an Generic X86 (actually had an Intel NUC available) and everything went smooth. I’m also new to MQTT, but the process was easy to set up (MQTT Statestream is a very slick tool) and I am able to communicate back and forth to control the fan, update states, and update scene controllers.

The problem I am having is the MQTT broker just stops working after about 48 hours. In the UI, sometimes the broker looks like it is running, and a simple restart fixes the problem. Other times it looks like it has been stopped, but clicking the start button produces a pop up with a message like “Something is already connected to port 1883”. Being a novice, the only way I have found around the second error is to reboot the machine. I am still learning to decipher HA logs and such, and I should probably post here for more info, but I am just wondering if this is an unusual issue perhaps related to my installation method.

I have a couple other places I can install a broker, so I will try that to see if it produces better results, but any advice would be appreciated.

Hi,
I’m another ex-openHAB user (about 2 years parallel running before moving across) with a lot of experience running MQTT for Tasmota and custom Python embedded kit.

I don’t have any experience with MQTT Statestream (looks like a client to push HASS state data into MQTT for external use?), nor “Big Ass Fans”, however HASS + Mosquitto Add-In + MQTT Integration works reliably without any issue here. Indeed, Mosquitto is also the broker I used with openHAB.

the MQTT broker just stops working after about 48 hours

What do you mean exactly please?

  • Can you connect to Mosquitto from an external tool (such as https://mqtt-explorer.com/ )
  • Can you telnet to the MQTT port? (telnet hostname 1883)
  • Does a command-line client work? (mosquitto_sub -d -h hostname --username 'user' --pw "pass" -v -t '#')
  • Have you tried mDNS hostnames / IPv4 / IPv6 (IPv6 has issues on HASS OS due to the underlying virtualisation)?

The 48h duration sounds a bit like a default DHCP client lease time, but there should be lots of lease renewals before then. The ‘already connected to 1883’ sounds like a server is still active on TCP port 1883 - hence the tests above to connect and see the state of Mosquitto.

HASS doesn’t mind a broker installed locally (HASS OS automagically sets the IPv4 details), or on a remote machine (which is how I parallel ran HASS + openHAB for a long time).

The main difference between MQTT on openHAB and HASS is that in general:

  • openHAB configures each client on the SERVER with lots of topic defines
  • HASS prefers configuration on the CLIENT with auto-discovery (Tasmota or HASS protocols) meaning there is nothing to do on the SERVER.
  • You can also manually set up MQTT devices in HASS with lots of topic defines (but is less common)

The HASS OS Mosquitto Add-In has a web interface for MQTT logs, but vanilla Mosquitto isn’t that hard to find the logs.

At the risk of parroting myself in yet another post, more MQTT help if you need it can be found here (with lots of links to the docs:

If this helps, :heart: this post!

Thanks for the reply. I should have been a bit more clear. I can get the MQTT Broker Add On up and running, and all works well between OH and HA (controlling fan). As mentioned, after about 2 days the broker stops running. Verified by trying to connect via MQTT Explorer without success. In the end I installed a MQTT Broker on another linux machine and it has been solid for 4 days.

I use MQTT Statestream because it seemed like an easy way to get started with MQTT. Yes, it pushes HASS state automatically for every device (you can use include or exclude to limit), and much more detail but I only use State and Percentage (speed).