# 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:** 4

<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 20, 2019, 5:49pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/62 "2019-01-20T17:49:21Z")

</div>

> [@HarriedeGroot](#):
>
> Device discovery within openHAB via the Homie Convention:

Just thought I’d let you know I’m following along. Not sure what’s working yet but here’s what I see.  
I get my devices discovered 😃 , but the connection thing goes offline

_Device did not send heartbeat in time_

and with control I get a communication error

_No connection or readOnly channel!_

But looking very promising.

---

<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 20, 2019, 6:03pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/63 "2019-01-20T18:03:29Z")

</div>

Yes, I noticed Homey is very busy in the startup phase (registering devices) and does sometimes not have enough time to respond to the heartbeat during this period. Restarting the Gateway app, resolves this problem most of the time.

FYI: Currently I’m working on handling color & enum values.

---

<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 20, 2019, 10:20pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/64 "2019-01-20T22:20:39Z")

</div>

Just completed the [implementation](https://github.com/harriedegroot/nl.hdg.mqtt/tree/homie) of the [Homie Convention v3.0.1](https://homieiot.github.io/specification/) for Homey v1.5.13.  
I’ve got a fully working [HABpanel](https://www.openhab.org/docs/configuration/habpanel.html) with the ability to control all of my Homey devices (auto detected).

Next: Homey v2.0 & app settings

---

<div class="post-metadata">

**Author:** ![GauteKlyve](https://avatars.discourse-cdn.com/v4/letter/g/f4b2a3/32.png) [@GauteKlyve](https://community.homey.app/u/GauteKlyve)\
**Post date:** [January 20, 2019, 10:51pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/65 "2019-01-20T22:51:31Z")

</div>

I have been waiting for something like this!

Looking very promising! 🙂

---

<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 20, 2019, 10:59pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/66 "2019-01-20T22:59:11Z")

</div>

That’s great - it seems there’s an issue with handling the heartbeats/timeouts in OpenHAB - I posted here and there’s a new update coming in a 2.5 nightly.

> **[MQTT2 (Homie Convention) - Thing goes offline permanently](https://community.openhab.org/t/mqtt2-homie-convention-thing-goes-offline-permanently/63163/13?u=xappo)**
>
> @David\_Graeff Can you explain section 5 of the Homie 3 spec a little more… \> ## Timings \> \> As soon as a device starts to publish any Homie related topic, it MUST finish with all topics within a timeframe of 500ms. Controllers should assume the...

There might also still be an issue of whitespace inclusion in Homey node topic ID’s still. But it might not be a problem. I have topics with whitespace after the second text e.g. “kitchen-counter near”

Kevin

PS Do you intend to implement the (alternative much simpler/less capable) HomeAssistant MQTT discovery protocol too - as I think more people on here use that ?

---

<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 20, 2019, 11:11pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/67 "2019-01-20T23:11:36Z")

</div>

I also noticed the heartbeat timeout is an openHab issue. The dashboard is working correctly even if the Homie MQTT device is stated offline.

Do you want to create [GitHub issues](https://github.com/harriedegroot/nl.hdg.mqtt/issues) for your findings?

HomeAssistant MQTT discovery wasn’t on my radar yet. Could be a nice addition. But let’s first create a ‘stable’ app for both Homey versions. Also a settings page is a must before the app can be published.

---

<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 20, 2019, 11:28pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/68 "2019-01-20T23:28:35Z")

</div>

Yes, you’re right to get to stable first.

I think a few will later apppreciate HomeAssistant support - and it’s way easier than homie3 .

I’ll raise GitHub issues. I don’t know why whitespace is not supported in the homie3 spec. Not sure how to do GitHub pull requests yet.

I can’t get two way control of devices because I constantly get timeouts and when I control anything I get read only on the set topic, so it is never published from openHAB. I have around 70 devices and the population through homie3 takes around 15 seconds.

Some topicsID’s have that whitespace issue although I quickly patched it out. I think openHAB is assigning defaults, specifically $settable = false to my nodes. They can’t be controlled through Paper UI.

---

<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 20, 2019, 11:35pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/69 "2019-01-20T23:35:35Z")

</div>

The settable property is read from the Homey device capability.

---

<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 20, 2019, 11:55pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/70 "2019-01-20T23:55:31Z")

</div>

Yes but it’s then published as a property via MQTT and openHAB assigns default values if it hasn’t received ALL the related node MQTT messages within 1.5 sec (I think) of homie protocol $state ‘init’ - so OH is missing this and defaulting it back to false unfortunately, … but it still shows true in MQTT of course. So OH thinks its not controllable.

I think this 1.5 secs is going to be eliminated in an upcoming OH 2.5 build and await $state ‘ready’ instead.

This is going to be great when it’s ready 😀 thanks for the app !

---

<div class="post-metadata">

**Author:** ![Talzac](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/talzac/32/4220_2.png) [@Talzac](https://community.homey.app/u/Talzac)\
**Post date:** [January 21, 2019, 9:40pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/71 "2019-01-21T21:40:30Z")

</div>

I do not understand how to use this? Can some one help me?

---

<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 21, 2019, 11:21pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/72 "2019-01-21T23:21:25Z")

</div>

It’s all experimental for now, but roughly follow these steps:

1. Install an mqtt broker (Homey app/mosquito/HiveMQ, etc.)
2. Install the BETA version of the MQTT Client app & connect to the broker
3. Install the MQTT Gateway app from the GitHub ‘homie’ branch via the athom-cli (Homey v1.5.13 only).
4. Install OpenHAB or any other application with the ability to communicate over mqtt (HASS, Node RED, mobile app, etc.) & configure the connection with your mqtt broker
5. Add a ‘Homie MQTT device’ to your application and let it automatically discover the Homey devices and their capabilities. Or manually configure the MQTT communication channels (see the Homie Convention)
6. Build your dashboard

---

<div class="post-metadata">

**Author:** ![Talzac](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/talzac/32/4220_2.png) [@Talzac](https://community.homey.app/u/Talzac)\
**Post date:** [January 21, 2019, 11:32pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/73 "2019-01-21T23:32:18Z")

</div>

Thanks, i have updated to v2… so then i have to wait? The beta ver 2 app in store not working ?

---

<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 21, 2019, 11:33pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/74 "2019-01-21T23:33:20Z")

</div>

Auto discovery (the Homie convention) is not yet implemented for Homie v2.0. you need some patience here…work in progress.

Custom Device communication is working for Homey v2.0 (beta channel, see app readme).

---

<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 22, 2019, 1:16pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/75 "2019-01-22T13:16:20Z")

</div>

@Talzac Are you already using MQTT elsewhere in your setup, if so with what devices / applications ?

The existing v2 store (beta) release works fine, it’s just that there is a new ‘discovery’ protocol implemented in another branch of the GitHub implementing the ‘homie 3’ protocol. ‘Homie 3’ is not a ‘Homey’ specific thing - they’re unrelated just a similar name. AFAIK openHAB and the associated HABPanel application are the only mainstream applications that support this homie 3 protocol at the moment.

---

<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 22, 2019, 7:39pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/76 "2019-01-22T19:39:11Z")

</div>

I’ve partially written a nodeRED flow that takes the homie 3 published discovery information and republishes it in the HomeAssistant discovery format - which means that the Homey devices are now auto discovered within HomeAssistant too. It then translates the control and status bi-directionally.

So far I’ve only done this for a couple of simple device types (on/off and dimmer) but if there’s interest I could map more. How many people would find this useful and also use HomeAssistant and nodeRED (and 1.5) ? It will become tidier later by obviating the need for nodeRED, when the HA discovery protocol might be implemented directly within MQTT Gateway. I may even look at how difficult that would be and submit a pull request.

I’ll post a screenshot over the next day or so … just as a teaser because you can then use the various HA dashboards too, in addition to the openHAB ones offered through homie 3

Kevin

---

<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 22, 2019, 7:47pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/77 "2019-01-22T19:47:26Z")

</div>

There’s also a rather interesting aspect of ‘auto creating’ or at least selectively allowing creation of Homey devices from MQTT … as virtual devices

---

<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 22, 2019, 7:52pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/78 "2019-01-22T19:52:14Z")

</div>

I’m updating my Homey to v2 (right now…fingers crossed!). Homie 3 for Homey v2 is next.

---

<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 22, 2019, 7:54pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/79 "2019-01-22T19:54:09Z")

</div>

Implementing HA discovery within the gateway app would be nice!

---

<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 22, 2019, 8:01pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/80 "2019-01-22T20:01:09Z")

</div>

I’ve never done a GitHub pull before so it’ll be a learning experience for me. (I’m an electronics engineer with software embraced as an adjunct) . I’m just going to get this alternative nodeRED flow working as a temporary step. I’ll peruse your code this weekend though and see if I feel capable.

The HomeAssistant discovery protocol is really simple though - you only need to publish one message on a topic that effectively just ‘titles’ the device and tells HA what ‘type’ it is and then where the state and command information goes (i.e. the device’s topics). It’s nowhere near as complicated, or capable, as homie 3 although it does support using the original devices topic structure rather than requiring a device supports homie 3 - which is a good move for existing devices.

K

---

<div class="post-metadata">

**Author:** ![Blarp](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/blarp/32/10278_2.png) [@Blarp](https://community.homey.app/u/Blarp)\
**Post date:** [January 22, 2019, 9:00pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/81 "2019-01-22T21:00:50Z")

</div>

I’m not going to lie, some things rock your boat.  
‘Home Assistent MQTT Auto Discovery’ of _devices_ trough Mqtt-gateway into Virtual Devices in Homey is Affengeil

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

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