Homey Community Forum

MQTT Hub/Gateway


I would take that as a yes.


The implementation of the app settings page is finished.
Adding/removing devices, start/stop the service & modifying the topic structure/additional settings should be fully functional, without the need of rebooting the app.

I did a full re-write of the app boot process, implemented most of the settings, added a log stream & fixed many event listeners (preventing duplicate messages being dispatched).

The ‘instructions’ page still needs a little attention…also the app readme is extremely outdated by now :slight_smile:
The topic structure as described in the readme is deprecated and replaced by the Homie Convention with the option to inject the device class & zone into the topic.

Is someone willing to test (homie2 branch)?


Edit2: Works after a Homey restart

Hi. I just tested the homie2 branch and it´s not working for me.
I think that the “Running” slider doesn´t save.

I have:
Homey V-2.0.2-RC.2
MQTT Client V-2.2.0-BETA (which is working as it´s sending mqtt messages from flows)
MQTT Gateway (downloaded from homie2 branch 25min ago) had old version that i uninstalled first.

Here are the settings & log:

So Switch is ON but no mqtt messages are sent.
When i go back and in again into the settings the switch “Running” is off.
I turn it on but nothing happens.

Edit: In the MQTT Client log i get this:
Listener publishMQTT_Adv called
But nothing happens (no mqtt messages sent)


I did a prommissing test with this Version yestwerday (needs some restarts).

I will test the new Version this evening.

homeyVersion “2.0.0”
MQTT Client “2.20beta”



It works now after a Homey restart.


I will update it when I get home from work.


[solved] I had to manually uninstall the app and then do a reinstall and that worked

Struggling Harrie - I do not get the MQTT-Gateway app listed in settings (MQTT Client etc are listed there)
RC2 and latest homie2

Tried lots of restarts of both Gateway app and Homey - and the ‘Enabled’ button



@xAPPO Up and running? Any remaining issues?


Up and running :smiley: - your settings page is the best I have seen on any Homey 2 app - really well done.

I have one question. When you disable a previously enabled device does it stop any further posts to MQTT for that device AND does it remove the device from MQTT to the extent that it removes the previous entry and makes that topic no longer retained ?

I have reduced my devices to just a couple … and restarted MQTT-Explorer but it still picks up all my devices as ‘retained’ .

I have a couple of other issues but I’ll mention those later or by PM.


The device should send a disconnect state as defined in the Homie Convention.


Ahh - I don’t look for those … yet… and I’m not seeing them in the topic tree - 1 sec let me rename my Homey so I get a new tree as although I see devices I see no initial state information for the devices, only seeing $name and $type


@xAPPO Does a broadcast resolve this? I don’t want to do a full broadcast after each device change (broadcasts are resource heavy).


My new topic tree looks better - I restarted your app and I have all device status information for my enabled devices… So not sure if this was the restart that populated them. I still haven’t worked out the disconnect though - is that sent on a per device basis or overall - does it publish an MQTT message and if so where ? Let me read the spec and clue myself up.

OK As I understand it that is the state of the device… which in this case is the whole Homey - whereas we are enabling and disabling individual nodes within the device (i.e. the Homey devices which become nodes in homie3)


Yes it does publish a disconnect message (it should) on the device/$state channel.


Do you also take into account that the MQTT explorer doesn’t ‘forget’?


There is only the one $state topic on the Homey device itself - not on each node (ie Homey Device).
The topics are retained on the MQTT broker.
MQTT-Explorer only reloads all topics from the MQTT broker that are retained. If they are published not retained then they are not shown, until new data is published on that topic.

No $state topic at the node level

Just the one relating to the whole Homey


Just configured ip and port in the client app, tried both with and without ssl.
Have the latest gateway now as well without success (I see all new nice settings)


You can send an empty payload on a topic and the broker will remove it fron retained memory. That is how I handled an unsubscribe.


I think that’s what has to happen for each disabled device as they’re removed and retained flag has to be changed to off too. . Which is tedious.

I then need to watch for the “” value - which I hope gets sent by the MQTT broker and I will know that a device within Homey has been removed, but actually I don’t think there is a HomeAssitant ‘undiscover’ or ‘forget’ spec - so it’s state would hopefully just go blank.

I don’t think the homie3 spec has considered this situation… where one of it’s nodes disappears


Harrie - I have to go out now for the evening… I haven’t had a chance yet to check if ‘buttons’ now work - they previously had no state reported.