[App][Pro] MQTT Server - Publish Homey Pro's devices as an MQTT server

MQTT Server App

This discussion is started to centralize all questions, answers and information around the app.

Links and information:

Regular version:

Test version (if available):

MQTT Server App for Homey | Homey

Report Bugs for this App to the Developer

Please use the link in the App Store and follow the community guidelines, the more information provided the faster it can be solved.

Note:

This topic is not actively monitored by the developer.

Feel free to ask and discuss anything around the app here!

Information about the app and how to use it, published in the App Store

This app creates a MQTT Server (also called Broker), and publishes Homey Pro’s devices’ state to it.

USAGE
First, create a new user with a username & password in the app’s Advanced Settings.

Then, download any MQTT Client and connect to Homey Pro’s IP address on your LAN. All topics should be visible automatically.

To set the status of a device, publish a JSON-strigified value to homey/devices/<device-id>/capabilities/<capability-id>. For example, publish true to homey/devices/abc...efg/capabilities/onoff to turn on a device.

NOTES
The server also supports the ‘homie’ convention (see https://homieiot.github.io) for compatibility with 3rd party MQTT clients.

Reserved

I need MQTT protocol also for getting data from my micro solar inverter resp. from a DTU (Data Transfer Unit).

An info which I posted just on Slack:

Before the MQTT Server App was released, I used the Broker and the Client App and it worked without any problems.
After the MQTT Server App was released (first without any flow cards), I installed this App, deactivated the MQTT Broker and activated/configured the MQTT Server App. Because there were no flow cards in the Server App available, I still used the MQTT Client App. And this worked also with no problems, the flow wasn’t never deactivated due to much executed.
After Emile added some flow cards for the MQTT Server App, I deactivated the MQTT Client App and rebuild the flow with the new flow cards from the Server App. After this was done it took just some minutes and the flow was deactivated due to much executions.
But as you can see at the screen shots, the flow is a duplicate from the “old” flow with the flow cards from the MQTT Client App. So nothing was changed, just the flow cards were replaced.

In Short:

  • MQTT Broker + MQTT Client (Flow) = :white_check_mark:
  • MQTT Server + MQTT Client (Flow) = :white_check_mark:
  • MQTT Server + Flow = :x:

Additional infos:

  • Publishing interval micro solar inverter/DTU: 5 seconds
  • Sum of topics/messages: 15

I had to make a new attempt and I can actually see messages coming through to the MQTT Client but for some reason it doesn’t update my virtual device. Not sure what’s happening. Either way I have to retract my previous statements, the official app does work as a broker.
When I can do it without upsetting normal operation I will modify my setup to use the cards from the new app.

If you “feed” the virtual device with the flow cards of the MQTT Client App, then you have to modify this flow with the cards of the MQTT Server App, of course.

I proceeded as follows:
– duplicated the flow with the flow cards from the MQTT Client App and deactivated the duplicated flow immediately
– replaced the flow cards with the flow cards from the MQTT Server App
– deactivated the MQTT Server App
– activated the new flow with the MQTT Server flow cards

The “old” flow with the flow cards from the MQTT Server App doesn’t need to be deactivated, because this flow doesn’t work anymore because the MQTT Client App is deactivated.

At this point I had already deactivated the MQTT Broker App and the topics were already published via the MQTT Server App.

The MQTT Client app takes considerable care to only start flows for messages to topics that it knows it will have a positive trigger for.

The MQTT Server app starts the flow on every single message that gets published, and will then check if the message is published to a topic that it should trigger on. Which is too late to prevent the flow from being rate limited. Even if a flow only has one trigger topic, if the broker receives enough messages the flow will be rate limited (even if none of those messages are actually published to the trigger topic).

Interesting information on the different trigger behavior.
Anyway, I have had it running for a while now with the MQTT Server trigger cards and as far as I can tell it works as expected.
In my particular setup the message rate is rather low and the majority are handled so the difference in triggers between this and the MQTT Client app shouldn’t be an issue.
I seem to remember Athom having previously dismissed the idea to have MQTT support built in, which is a pity in my mind, but an official app is welcome.

Indeed very interesting.

I have just done a test with the MQTT Explorer program.
First I activated the MQTT Server app and observed the data traffic in the MQTT Explorer program for approx. 10-15 seconds:
image
(MQTT Server App)

Then I deactivated the MQTT Server App and activated the MQTT Broker App and also observed the data traffic for approx. 10-15 seconds:
image
(MQTT Broker App)

In other words, the MQTT Server App processes a lot more data than just the MQTT Broker app, caused by homey and homie.

I know that the MQTT Server App is a broker, client and hub in one.
Are the topics homey and homie published more or less by the hub of the MQTT Server App? Are these data from all devices in Homey, e.g. to publish the for Home Assistant, @robertklep?

Yes.

Yes, although the Homie implementation is not compliant so I don’t know if it actually works with HA.

1 Like

For a seamless HA integration, the HA Auto discovery is needed. Else you have to add all topics manually to HA :sweat_smile:

PS: I asked Emile on Slack about this. If the MqttServer should replace the MqttHub in future, the community has to add this functionality to MqttServer (fork+PR). Same for device list/filter…

Or proper Homie support.

You also got an answer :stuck_out_tongue:

HA was just an example, I don’t want to send any topics to HA, so no HA auto discovery needed… :wink:

I would be interested to know whether Emile would really integrate the PRs and publish the app in the App Store if, for example, HA auto discovery was added.
To be honest, I doubt that. Especially when a HA integration is involved.

Well, he said:


So I think he will add the PR if anyone is doing it.

And HA was only an example for a similar use case where I also had the flow/memory issue.

I read that, but I still doubt it.

Same here.

Well, I think he actually means: you are free to fork the app, add the functionality needed for HA, and CLI install the app.

1 Like


Still it’s quite funny because there is this certain Athom app

he apparently forgot about :man_shrugging:
In fact, a few days ago it’s updated, to support the (wild guess: South Korean) language
Screenshot from 2024-08-10 16-55-44


This might sound cynical and all, but it’s not meant as such. It’s just funny.

Nah, that’s just the other way around, from HA to Homey. I guess with the idea to make it easier for people to migrate from HA to Homey. And he doesn’t want to provide a way to make it easier to do that in reverse :stuck_out_tongue_winking_eye:

No, it’s for both ways, I quote ¨I’m not going to actively build anything for Home Assistant" :crazy_face:
But, the Athom HA app already has been built, fair enough haha

1 Like