# \[App\]\[Pro\] MQTT Broker for Homey

**URL:** <https://community.homey.app/t/app-pro-mqtt-broker-for-homey/5129>\
**Category:** Apps\
**Tags:** app, tools\
**Created:** [December 8, 2018, 7:18pm UTC](https://community.homey.app/t/app-pro-mqtt-broker-for-homey/5129 "2018-12-08T19:18:31Z")\
**Posts on this page:** 20\
**Page:** 7

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [March 14, 2024, 7:34am UTC](https://community.homey.app/t/app-pro-mqtt-broker-for-homey/5129/126 "2024-03-14T07:34:59Z")

</div>

> [@Something not working after a Homey firmware update? HERE'S THE SOLUTION](https://community.homey.app/t/something-not-working-after-a-homey-firmware-update-heres-the-solution/67824):
>
> [Pull The Plug](https://community.homey.app/t/how-to-ptp/17304) (on Homey). (and if that doesn’t work, and your Homey pre-2023 model is still using the original Athom power supply: replace it!)

---

<div class="post-metadata">

**Author:** ![Claus\_Mortensen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/claus_mortensen/32/73211_2.png) [@Claus\_Mortensen](https://community.homey.app/u/Claus_Mortensen)\
**Post date:** [March 14, 2024, 7:38am UTC](https://community.homey.app/t/app-pro-mqtt-broker-for-homey/5129/127 "2024-03-14T07:38:38Z")

</div>

Mine is working this morning and I can see 10.3.2 is installed.

---

<div class="post-metadata">

**Author:** ![Erbru](https://avatars.discourse-cdn.com/v4/letter/e/ad7895/32.png) [@Erbru](https://community.homey.app/u/Erbru)\
**Post date:** [March 14, 2024, 8:00am UTC](https://community.homey.app/t/app-pro-mqtt-broker-for-homey/5129/128 "2024-03-14T08:00:53Z")

</div>

Earlier this morning I did a soft restart of Homey. But no response. Pull The Plug (on Homey) did work. Thanks for this simple and easy solution [robertklep](https://community.homey.app/u/robertklep)

---

<div class="post-metadata">

**Author:** ![ChrisG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/chrisg/32/8825_2.png) [@ChrisG](https://community.homey.app/u/ChrisG)\
**Post date:** [May 16, 2024, 5:47am UTC](https://community.homey.app/t/app-pro-mqtt-broker-for-homey/5129/129 "2024-05-16T05:47:16Z")

</div>

Attention & Important:

After three days of trying to isolate the problem why my app aborts with the error “ECONNREFUSED” when connecting to the MQTT Broker without any code changes on my part.

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/3/73b32f2fbbb07fac1f39b79848ba1c3f1ed6a838.png)

I finally came to the conclusion that one of the most commonly used [MQTT[.js] libraries](https://www.npmjs.com/package/mqtt) (\>v5.5) is no longer compatible with the Aedes library (v0.48.1) you are using.

Could you please upgrade this to the current (v50.1) version, so that not only my apps but also other apps will no longer have problems with version incompatibility in the future.

THX Chris

---

<div class="post-metadata">

**Author:** ![AlexFromNL](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/alexfromnl/32/81912_2.png) [@AlexFromNL](https://community.homey.app/u/AlexFromNL)\
**Post date:** [June 26, 2024, 11:35am UTC](https://community.homey.app/t/app-pro-mqtt-broker-for-homey/5129/130 "2024-06-26T11:35:25Z")

</div>

Would it be possible to use OTA updates via an MQTT Broker?

> **[OTA updates | Zigbee2MQTT](https://www.zigbee2mqtt.io/guide/usage/ota_updates.html)**
>
> Zigbee to MQTT bridge, get rid of your proprietary Zigbee bridges

---

<div class="post-metadata">

**Author:** ![scanno](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/scanno/32/8358_2.png) [@scanno](https://community.homey.app/u/scanno)\
**Post date:** [June 26, 2024, 12:26pm UTC](https://community.homey.app/t/app-pro-mqtt-broker-for-homey/5129/131 "2024-06-26T12:26:49Z")

</div>

> **[MQTT Broker](https://homey.app/en-nl/app/nl.scanno.mqttbroker/MQTT-Broker/test/)**
>
> A MQTT Broker for Homey

Updated to aedes 0.51.2. Perhaps you can test as I do not have a recent homey (running the 2016 kickstarter version)

---

<div class="post-metadata">

**Author:** ![scanno](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/scanno/32/8358_2.png) [@scanno](https://community.homey.app/u/scanno)\
**Post date:** [June 26, 2024, 12:37pm UTC](https://community.homey.app/t/app-pro-mqtt-broker-for-homey/5129/132 "2024-06-26T12:37:14Z")

</div>

It depends if someone gets Zigbee2MQTT running on homey.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [June 26, 2024, 2:13pm UTC](https://community.homey.app/t/app-pro-mqtt-broker-for-homey/5129/133 "2024-06-26T14:13:39Z")

</div>

How to start an OTA update for a z2m-handled device is explained here: [OTA updates | Zigbee2MQTT](https://www.zigbee2mqtt.io/guide/usage/ota_updates.html#update-to-latest-firmware)

---

<div class="post-metadata">

**Author:** ![ChrisG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/chrisg/32/8825_2.png) [@ChrisG](https://community.homey.app/u/ChrisG)\
**Post date:** [June 27, 2024, 7:54am UTC](https://community.homey.app/t/app-pro-mqtt-broker-for-homey/5129/134 "2024-06-27T07:54:42Z")

</div>

> [@scanno](#):
>
> Perhaps you can test

Sure, no problem !😉!

---

<div class="post-metadata">

**Author:** ![ChrisG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/chrisg/32/8825_2.png) [@ChrisG](https://community.homey.app/u/ChrisG)\
**Post date:** [June 27, 2024, 2:45pm UTC](https://community.homey.app/t/app-pro-mqtt-broker-for-homey/5129/135 "2024-06-27T14:45:10Z")

</div>

Hi Menno,

The broker crashed during the installation, you may see something in the Developer Tools \> Crashes

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/a/2a311e8ab370e644fc47fc6b7b5281d9eb8ac5ac.png)

---

<div class="post-metadata">

**Author:** ![ChrisG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/chrisg/32/8825_2.png) [@ChrisG](https://community.homey.app/u/ChrisG)\
**Post date:** [June 27, 2024, 4:02pm UTC](https://community.homey.app/t/app-pro-mqtt-broker-for-homey/5129/136 "2024-06-27T16:02:07Z")

</div>

In the meantime, I have uninstalled and reinstalled the MQTT Broker. Now I have the problem that when I press the “Save Settings” button in the settings, the broker also crashes

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/4/7/478beb8dd1df97f19936c418674cf62954b39dbc.png)

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/6/160ad51ae2a3f38e18b5601ac5f34e06bac5ac6a.png)

* * *

GM @scanno

I have bad and good news. After some testing, I noticed the following:

The current version (3.0.2) doesn’t work either. Even after uninstalling the broker app and restarting the HP2023, I still get the timeline error message:

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/4/5/454c328f6eec2c70102831581c6a892f82749b05.png)

**And now the good one:**

After some trial and error with the settings I came up with the following workaround:

1. install MQTT Broker App.

2. set all broker settings to enable & Save Settings  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/f/8/f85145582e36b1e063d1868fc46dd22de5685c1a.png)

3. set username/password  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/3/e3f89eae6069cc1937128a56dac3b78ac3547db9.png)

4. disable unused settings & Save Settings  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/e/1e46c20733651f738327d1eb9fd4e331c95bdc53.png)

Hooray now it’s running and I can start testing !🥳!

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/4/9/492f5d443944f8db5e72e9928308a49550a2c112.png)

---

<div class="post-metadata">

**Author:** ![scanno](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/scanno/32/8358_2.png) [@scanno](https://community.homey.app/u/scanno)\
**Post date:** [June 28, 2024, 7:42am UTC](https://community.homey.app/t/app-pro-mqtt-broker-for-homey/5129/137 "2024-06-28T07:42:09Z")

</div>

All I can see in the dev console is that port 1883 is already in use…

All I can assume is that after you save the settings and start the broker, the broker crashes because something already uses port 1883…

I have not found a way to catch that error and send a notification or something similar.

The EONOENT error is thrown because there is no config file available. As soon as the settings are saved, this is no longer shown and the error is not a fatal one.

---

<div class="post-metadata">

**Author:** ![ChrisG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/chrisg/32/8825_2.png) [@ChrisG](https://community.homey.app/u/ChrisG)\
**Post date:** [June 28, 2024, 7:52am UTC](https://community.homey.app/t/app-pro-mqtt-broker-for-homey/5129/138 "2024-06-28T07:52:28Z")

</div>

> [@scanno](#):
>
> All I can see in the dev console is that port 1883 is already in use…

But then the port would have to be released again after a Homey restart without the app.

BDW: What about the workaround, now everything works fine again and the broker receives data?

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [June 28, 2024, 7:52am UTC](https://community.homey.app/t/app-pro-mqtt-broker-for-homey/5129/139 "2024-06-28T07:52:59Z")

</div>

I’m also seeing a similar issue with HomeKitty, where it often crashes because there’s already a process listening on the (fixed) port that the app uses. My guess is that it’s possible for apps to run multiple times, or that older instances don’t get cleaned up properly.

---

<div class="post-metadata">

**Author:** ![ChrisG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/chrisg/32/8825_2.png) [@ChrisG](https://community.homey.app/u/ChrisG)\
**Post date:** [June 28, 2024, 8:07am UTC](https://community.homey.app/t/app-pro-mqtt-broker-for-homey/5129/140 "2024-06-28T08:07:59Z")

</div>

I give @robertklep right. Are you using the onUninit() hook to terminate the broker ?

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [June 28, 2024, 8:12am UTC](https://community.homey.app/t/app-pro-mqtt-broker-for-homey/5129/141 "2024-06-28T08:12:31Z")

</div>

Beware that `onUninit()` has been broken [for a long time](https://github.com/athombv/homey-apps-sdk-issues/issues/259).

---

<div class="post-metadata">

**Author:** ![ChrisG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/chrisg/32/8825_2.png) [@ChrisG](https://community.homey.app/u/ChrisG)\
**Post date:** [June 28, 2024, 8:33am UTC](https://community.homey.app/t/app-pro-mqtt-broker-for-homey/5129/142 "2024-06-28T08:33:13Z")

</div>

> [@robertklep](#):
>
> Beware that `onUninit()` has been broken.

But he is still in the [doc](https://apps.developer.homey.app/guides/homey-cloud#app-lifecycle) !!

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [June 28, 2024, 9:34am UTC](https://community.homey.app/t/app-pro-mqtt-broker-for-homey/5129/143 "2024-06-28T09:34:28Z")

</div>

That’s because it’s an issue that Athom doesn’t understand 🤷🏼‍♂️

---

<div class="post-metadata">

**Author:** ![ChrisG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/chrisg/32/8825_2.png) [@ChrisG](https://community.homey.app/u/ChrisG)\
**Post date:** [June 28, 2024, 3:31pm UTC](https://community.homey.app/t/app-pro-mqtt-broker-for-homey/5129/144 "2024-06-28T15:31:13Z")

</div>

I have looked in my code. Try App#onUnload(), it is not documented, but it is called🤦‍♂️

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [June 28, 2024, 3:36pm UTC](https://community.homey.app/t/app-pro-mqtt-broker-for-homey/5129/145 "2024-06-28T15:36:16Z")

</div>

I can’t reproduce that (also can’t find any reference to `onUnload` anywhere).

[Previous page](https://community.homey.app/t/app-pro-mqtt-broker-for-homey/5129.md?page=6)

[Next page](https://community.homey.app/t/app-pro-mqtt-broker-for-homey/5129.md?page=8)
