# 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:** 20\
**Page:** 10

<div class="post-metadata">

**Author:** ![Rocodamelshekima](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rocodamelshekima/32/8209_2.png) [@Rocodamelshekima](https://community.homey.app/u/Rocodamelshekima)\
**Post date:** [January 28, 2019, 9:01pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/182 "2019-01-28T21:01:42Z")

</div>

> [@Jeroen\_Bos](#):
>
> Just to be clear, do we still need HA for this

> [@Phuturist](#):
>
> The only thing extra is that you need to connect Google Assistant to Home Assistant

I would take that as a yes.

---

<div class="post-metadata">

**Author:** ![HarriedeGroot](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/harriedegroot/32/56160_2.png) [@HarriedeGroot](https://community.homey.app/u/HarriedeGroot)\
**Post date:** [January 29, 2019, 8:16am UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/183 "2019-01-29T08:16:16Z")

</div>

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 🙂  
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](https://github.com/harriedegroot/nl.hdg.mqtt/tree/homie2))?

---

<div class="post-metadata">

**Author:** ![Midhet\_Cirkic](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/midhet_cirkic/32/5326_2.png) [@Midhet\_Cirkic](https://community.homey.app/u/Midhet_Cirkic)\
**Post date:** [January 29, 2019, 8:54am UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/184 "2019-01-29T08:54:44Z")

</div>

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:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/f/f9fe8047ed7638dfc0b760e72bbcc7e87cee8aa4.png) ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/f/f3beee509e909989a2b5e0512c37b13a6f2ef7bf.png) ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/8/8664700a6768d9867c401c6e52c1715f300cdf14.png)

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)

---

<div class="post-metadata">

**Author:** ![odig](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/odig/32/13681_2.png) [@odig](https://community.homey.app/u/odig)\
**Post date:** [January 29, 2019, 8:58am UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/185 "2019-01-29T08:58:28Z")

</div>

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

> <https://github.com/harriedegroot/nl.hdg.mqtt/commit/af4dfb81d25b531939257f8d32f1eff8c3b7da6d>

I will test the new Version this evening.

homeyVersion “2.0.0”  
MQTT Client “2.20beta”

Ciao  
Odig

---

<div class="post-metadata">

**Author:** ![Midhet\_Cirkic](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/midhet_cirkic/32/5326_2.png) [@Midhet\_Cirkic](https://community.homey.app/u/Midhet_Cirkic)\
**Post date:** [January 29, 2019, 9:13am UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/186 "2019-01-29T09:13:02Z")

</div>

It works now after a Homey restart.

---

<div class="post-metadata">

**Author:** ![Camelen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/camelen/32/9613_2.png) [@Camelen](https://community.homey.app/u/Camelen)\
**Post date:** [January 29, 2019, 10:17am UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/187 "2019-01-29T10:17:40Z")

</div>

I will update it when I get home from work.

---

<div class="post-metadata">

**Author:** ![xAPPO](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/xappo/32/13726_2.png) [@xAPPO](https://community.homey.app/u/xAPPO)\
**Post date:** [January 29, 2019, 4:25pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/189 "2019-01-29T16:25:39Z")

</div>

[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

K

---

<div class="post-metadata">

**Author:** ![HarriedeGroot](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/harriedegroot/32/56160_2.png) [@HarriedeGroot](https://community.homey.app/u/HarriedeGroot)\
**Post date:** [January 29, 2019, 4:51pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/190 "2019-01-29T16:51:05Z")

</div>

@xAPPO Up and running? Any remaining issues?

---

<div class="post-metadata">

**Author:** ![xAPPO](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/xappo/32/13726_2.png) [@xAPPO](https://community.homey.app/u/xAPPO)\
**Post date:** [January 29, 2019, 5:14pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/191 "2019-01-29T17:14:04Z")

</div>

Up and running 😃 - 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.

---

<div class="post-metadata">

**Author:** ![HarriedeGroot](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/harriedegroot/32/56160_2.png) [@HarriedeGroot](https://community.homey.app/u/HarriedeGroot)\
**Post date:** [January 29, 2019, 5:18pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/192 "2019-01-29T17:18:21Z")

</div>

The device should send a disconnect state as defined in the [Homie Convention](https://homieiot.github.io/specification/#qos-and-retained-messages).

---

<div class="post-metadata">

**Author:** ![xAPPO](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/xappo/32/13726_2.png) [@xAPPO](https://community.homey.app/u/xAPPO)\
**Post date:** [January 29, 2019, 5:22pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/193 "2019-01-29T17:22:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![HarriedeGroot](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/harriedegroot/32/56160_2.png) [@HarriedeGroot](https://community.homey.app/u/HarriedeGroot)\
**Post date:** [January 29, 2019, 5:37pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/194 "2019-01-29T17:37:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![xAPPO](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/xappo/32/13726_2.png) [@xAPPO](https://community.homey.app/u/xAPPO)\
**Post date:** [January 29, 2019, 5:41pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/195 "2019-01-29T17:41:28Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![HarriedeGroot](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/harriedegroot/32/56160_2.png) [@HarriedeGroot](https://community.homey.app/u/HarriedeGroot)\
**Post date:** [January 29, 2019, 5:44pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/196 "2019-01-29T17:44:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![HarriedeGroot](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/harriedegroot/32/56160_2.png) [@HarriedeGroot](https://community.homey.app/u/HarriedeGroot)\
**Post date:** [January 29, 2019, 5:46pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/197 "2019-01-29T17:46:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![xAPPO](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/xappo/32/13726_2.png) [@xAPPO](https://community.homey.app/u/xAPPO)\
**Post date:** [January 29, 2019, 5:48pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/198 "2019-01-29T17:48:46Z")

</div>

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  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/5/5e9452f90f00e4ace21a9105065fe85d3d9e2cc9.png)

Just the one relating to the whole Homey  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/3/31362869286bf5f8c69c69ceda493e8e73b10b9b.png)

---

<div class="post-metadata">

**Author:** ![dhanjel](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dhanjel/32/10878_2.png) [@dhanjel](https://community.homey.app/u/dhanjel)\
**Post date:** [January 29, 2019, 5:54pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/199 "2019-01-29T17:54:29Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![Eelke](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/eelke/32/9188_2.png) [@Eelke](https://community.homey.app/u/Eelke)\
**Post date:** [January 29, 2019, 5:56pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/200 "2019-01-29T17:56:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![xAPPO](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/xappo/32/13726_2.png) [@xAPPO](https://community.homey.app/u/xAPPO)\
**Post date:** [January 29, 2019, 6:03pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/201 "2019-01-29T18:03:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![xAPPO](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/xappo/32/13726_2.png) [@xAPPO](https://community.homey.app/u/xAPPO)\
**Post date:** [January 29, 2019, 6:08pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/202 "2019-01-29T18:08:39Z")

</div>

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.

[Previous page](https://community.homey.app/t/mqtt-hub-gateway/6766.md?page=9)

[Next page](https://community.homey.app/t/mqtt-hub-gateway/6766.md?page=11)
