MQTT Hub/Gateway

@Robert_Zwetsloot I’m still here, reading along!

As far as I know, most of the questions asked are already answered many times before and most solutions are known by the community, or don’t need my assistance. Many other problems are just configuration issues (e.g. wrong ip-address) or issues with external platforms (HA, NodeRed, etc.). Ofcourse I know some problems with the app are left unsolved and feature requests remain open.

E.g. the connection issue; this is a known problem with the socket connection between Homey apps. It can be solved by restarting the MQTT Client & Hub apps in that particular order.
The MQTT Hub isn’t the only app with this particular issue: [App] Tasmota MQTT - #265 by Joka. Yes it’s annoying…

Maybe I mised something, but where is your contribution? Feel free to provided solutions to any remaining issues. The source is open and I’m willing to assist with pull requests.

The thing is: I migrated my complete setup to HA about two years ago and therefore the MQTT Hub is low priority. Nowadays my Homey is just an expensive football, so it’s much harder to test and answer questions and there is no personal benefit in any way. Although there is no active development from my side, the project is not abandoned. I’ll be here if things fall apart :slight_smile: !

I just hope many people enjoy the work put into this project!


No intention to offend you, or one of the other MQTT developers in place, in any way, please accept my apologies if you felt so.

Fully understand that time is precious and in time attention and priorities are changing.

Fist a small remark/comment to the above:
I too have to restart both mqtt client app and mqtt hub app sometimes. When restarting Homey I usually disable the mqtt client app, restart and let homey settle. Then start the mqtt client app. I think it is needed due to having a quite busy and chatty mqtt server. Ofthen it is solved just by a bit of waiting, sometimes a restart is needed.

Now to my main comment:

IKEA has release two new Trådfri products.

(GU10 spot will be added soon to Homey official app. E14 shortly after product is available in NL)

When trying to add these to Homey now, they are added as “Basic Zigbee Device”. On/Off and Dim works, but not colour adjustments. Fair enough, awaiting the support for the products in the app.

However - the integration to Home Assistant via MQTT Hub for the Basic Zigbee devices does not work. The MQTT Hub app is doing its thing correctly, but there seems to be an icon item included in the JSON. That icon item makes Home Assistant not picking up the device from the config JSON message.
So I did a quick and dirty workaround (via Node Red, but via Homey ore Home assistant would work to):
I listen to the config topic, if the icon item exists I simply remove the icon item and re-post the Json.

Small hint if someone else is struggling with the same.
(Don´t know if fix for this should be done in Homey, MQTT Hub or Home Assistant. Maybe it is so rare occurring that fix is not needed. )

1 Like

We definately enjoy your hard work here, @HarriedeGroot! Thx!

Has anyone already found a solution? I keep getting “error publishing message” in the hub
I tried:

  • restarting, dis/-enabling the apps in the mentioned order
  • downgraded Hub from v2.2.5 to 2.1.9
  • used the broker on my Synology NAS (which worked before) ànd the Broker on Homey (v1.0.5)
  • uninstalled everything, did a PtP and re-installed apps

I have problems with NodeRed and Home Assistant, which both worked before.
Am on Homey v5.0.4 by the way.

If you were in the mood and have time to be of assistance, that would be very helpfull and appreciated, @HarriedeGroot. I’d be happy to buy you some beer… :slight_smile:

After the client update (v2.4.1) I’ve had the same publishing problems as you have; which I interpret as the hub can’t reach the client.
I’ve spent the whole yesterday evening resetting the MQTT triangle. My sequence of above did not work out.
I came across:
no errors but no information in the broker,
all devices with properties in the broker without any measures,
only error publishing messages.

In the end after >10 attempts in different order, I succeeded by stopping the client (deactive), Restarting homey and waited till the hub log was reporting "waiting for client’ then I reactivated the client. Since then I still have “error publishing message” left but I can’t trace which ones that could be as far as I can see now all devices and measures are available in the broker.

20210324-22:42:07 message: with value: 84196
20210324-22:42:07 Error publishing message
20210324-22:42:03 message: kaifa-kaifa-meter/measure-powerl3 with value: 84
20210324-22:42:03 Error publishing message

It is a sensitive connection between the client and the hub and it might be a client problem instead of the hub. Maybe @scanno is willing to have a look at this?

In the meantime, keep trying till you succeed, in the end it will work.

(Hint: Did the restart of the apps on my phone and analyzed the logs via 3 homey developer pages on a laptop)

and another resolution : Node Red: A widget based dashboard working with Homey trough MQTT - #743 by Khoi_Ho_Si

Have tried all sorts of orders for restarting, disabling, etc, but no luck anywhere…
Just spend a few saturdays designing a nice map of my home to use in HA or NR… :frowning:

Haha, bit frustrated here, sorry… :slight_smile:

1 Like

What is not working exactly? I see messages published in the MQTT client and posted on the broker from the MQTT hub.

For me everything just works after a reboot.

Both you and Harry justly state the apps work as they intented to do. The question is how do you get them to work together.
See the posts above, from here, MQTT Hub/Gateway - #784 by mits? (and in other forums too).
The hub reports publishing problems, after a Homey restart/upgrade or after the latest update of the client and is practicaly impossible to resolve these errors.
It is unclear if this due to the hub or the client, it’s unclear how to fix theses as there does not seem to be a “works for all sequence” in how to start the MQTT triangel trio.
Hopefully you are able to bring a light in the dark.

@Robert_Zwetsloot You forgot Homey. Homey is responsible for maintaining the socket connection between the apps. If the connection isn’t stable, there’s isn’t much we can do about it.
The number of complaints about this issue is increased enormously with Homey v5.
The issue was there from the beginning though.

Have you tried running the app from the command line to see if it logs any additional error data?

@HarriedeGroot I found the issue: apparently, an API endpoint needs to return proper JSON, otherwise ApiApp throws an exception. The MQTT Client API endpoints don’t return JSON, so an error is generated.

This is, of course, not documented anywhere :confounded:

Issue here: ApiApp throws exception when endpoints return un-JSON-serializable data · Issue #184 · athombv/homey-apps-sdk-issues · GitHub

1 Like

Thanks @robertklep! Does it mean the exceptions should be catched by the Hub? And/or does the Client of @scanno needs some changes?

From what I understand from Athom’s response, the client app should be modified so it always returns something that can be serialized to JSON.

Something like this:
let response = {
result: -1,
error: “”

Lol even the broker now gets rate limited when MQTT Hub is broadcasting all the states

Or just return {}.

uploaded a test build
Well a return code with an error description could bring more possibilities in the future

1 Like

Anyway back to writing my thesis :confused:

The broker doesn’t have any flow cards though, does it?

But adding a JSON result does not solve the startup problems