# MQTT Hub/Gateway

**URL:** <https://community.homey.app/t/mqtt-hub-gateway/6766>\
**Category:** Apps\
**Created:** [January 14, 2019, 6:59pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766 "2019-01-14T18:59:50Z")\
**Posts on this page:** 1\
**Showing post:** 1248

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [November 18, 2023, 12:05pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/1248 "2023-11-18T12:05:50Z")

</div>

I had a lot of problems on HP23. The MQTT hub was sending a massive amount of devices to MQTT broker at start up. This caused the MQTT client to crash due to CPU usage and the MQTT hub due to memory usage.  
Only every 10th ot 20th app start was running to the end.

As solution I added an app setting to the MQTT hub app to define a send delay (in ms). The possibility was already in the code, but nut customizeable via app settings.  
This way the send process gets extended. It takes longer until all devices are synced, but the CPU load is nearly 0% instead of 100% before.

If someone has similar issues on HP23, this setting could help.

It’s documented in a pull request.

> <https://github.com/harriedegroot/nl.hdg.mqtt/pull/97>
>
> Hi Harrie,
> 
> I added app settings for send delay to be able to set individual d…elay and created this pull request for.
> 
> The reason for this change is:
> HomeyPro23 is processing messages so fast that the MqttClient app CPU usage is hitting 100% and gets stopped due to CPU warnings. MqttHub gets stopped due to Memory warning. 
> This delay makes both apps much more stable on HP23. I use 100ms delay now and got no stopped apps since this change.
> 
> I changed the app settings page (new field at the end under "Performance" header).
> The setting is passed creating the MessageQueue instance. So the new setting is read on app start.
> I also added the app events for memwarn and cpuwarn and the handler functions. But it seems these events are not called anymore on HP23. I left the code to get a debug log if Athom is answering my comment on Slack and hopefully add these events for HP23.
> 
> I forgot to uncheck the .gitignore file (Homey-CLI added the /.homeybuild/) and ./vscode/ folder (I added debug options for HP23).
> You can ignore/revert these changes.
> 
> I hope the fix is in your interest and you can add it to your branch and publish a new test version.
> Many thanks in advance.
> 
> Ronny

Hopefully @HarriedeGroot can find some time to merge and provide a test version 🙂

---

_[View the full topic](https://community.homey.app/t/mqtt-hub-gateway/6766)._
