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

<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:** [December 21, 2021, 7:19pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/1071 "2021-12-21T19:19:42Z")

</div>

Do use your own mosquito broker and not the internal / Homey App. This is because the internal one doesn’t support retention of payloads.

---

<div class="post-metadata">

**Author:** ![Zimo](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/zimo/32/16621_2.png) [@Zimo](https://community.homey.app/u/Zimo)\
**Post date:** [December 21, 2021, 9:58pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/1072 "2021-12-21T21:58:37Z")

</div>

It is quite complicated to configure message exchange between your mosquitto and internal MQTT client, which you will eventually need - it’s better to connect your homey client to external mosqitto and live with just one broker.

---

<div class="post-metadata">

**Author:** ![matrover](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/matrover/32/12112_2.png) [@matrover](https://community.homey.app/u/matrover)\
**Post date:** [December 27, 2021, 5:42pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/1073 "2021-12-27T17:42:46Z")

</div>

Question, i’ve setup the connection between Home assistant and Homey. i can toggel devices and get all readings of temprature sensors. i’ve put al sensors in the respective areas and am trying to make use of the new area card [Area Card - Home Assistant](https://www.home-assistant.io/lovelace/area/) the lights and switches are displayed, but the temprature isnt (there are multiple temprature readings in the specific area). anybody has an clue or hint?

---

<div class="post-metadata">

**Author:** ![Henk\_Renting](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/henk_renting/32/87634_2.png) [@Henk\_Renting](https://community.homey.app/u/Henk_Renting)\
**Post date:** [December 30, 2021, 8:36pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/1074 "2021-12-30T20:36:26Z")

</div>

Since a while, I am having difficulties with MQTT in combination with Home Assistant (for dashboard purposes).

At some point HA seems to loose connection with Homey. Devices freeze in HA, cannot be switched on/off (the switch then automatically returns to it’s previous state without any change in Homey) and changes in Homey don’t come through to HA.

Only thing that helps is turning off all devices in MQTT Hub, broadcasting, switching all devices back on and broadcast again.  
Previously I used the MQTT broker on my Synology NAS, but have switched now to the MQTT broker as app on my Homey: same problem.

Anyone any idea how to solve this?  
I have made and send in a diagnostic report, if @HarriedeGroot would be so kind to help as well…

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [December 30, 2021, 10:27pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/1075 "2021-12-30T22:27:12Z")

</div>

> [@Henk\_Renting](#):
>
> Anyone any idea how to solve this?

I’ve seen this behaviour only after restart of HA. Could be also after Homey restart (not sure about this).  
In this case I have to send all devices again with a broadcast.

---

<div class="post-metadata">

**Author:** ![Henk\_Renting](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/henk_renting/32/87634_2.png) [@Henk\_Renting](https://community.homey.app/u/Henk_Renting)\
**Post date:** [December 30, 2021, 11:05pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/1076 "2021-12-30T23:05:07Z")

</div>

> [@RonnyW](#):
>
> I’ve seen this behaviour only after restart of HA.

Seems a great tip, thx!  
A Watchtower script automatically updates my Docker containers and therefor the HA container too. HA did get an update today and with manually restarting the HA container I can reproduce the error now. Triggering a new broadcast doesn’t help in that case, restarting the MQTT Hub app does.

For now I have set a mailnotification when HA is restarted (i.e. after updating) to see if that really is the problem. If so I can have HA trigger restarting the MQTT Hub in Homey.

That will eliminate the symptom, but will not eliminate the problem itself. Anyone know a solution how to make sure HA is reconnecting correctly to Homey (via MQTT) after a restart?

---

<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:** [December 30, 2021, 11:27pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/1077 "2021-12-30T23:27:08Z")

</div>

@Henk_Renting

Are you using the Homey internal MQTT Broker, the HA addon broker or an external broker ?

---

<div class="post-metadata">

**Author:** ![Henk\_Renting](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/henk_renting/32/87634_2.png) [@Henk\_Renting](https://community.homey.app/u/Henk_Renting)\
**Post date:** [December 30, 2021, 11:34pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/1078 "2021-12-30T23:34:01Z")

</div>

I have the same behaviour when using an external MQTT Broker (in Docker on my Synology NAS) and using the Homey MQTT broker app

---

<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:** [December 30, 2021, 11:42pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/1079 "2021-12-30T23:42:05Z")

</div>

OK - The Homey internal broker doesn’t support payload retention so you get this behavior of requiring a new broadcast. Your ‘external’ one I assume does so that should have fixed it.

---

<div class="post-metadata">

**Author:** ![Henk\_Renting](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/henk_renting/32/87634_2.png) [@Henk\_Renting](https://community.homey.app/u/Henk_Renting)\
**Post date:** [December 30, 2021, 11:54pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/1080 "2021-12-30T23:54:33Z")

</div>

But as said, my external Broker on my Synology NAS gives the same errors. That’s what started the problems and changing to the Homey MQTT Broker app did not solve it…  
Or am I misunderstanding you?

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [December 31, 2021, 12:17am UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/1081 "2021-12-31T00:17:55Z")

</div>

I use the so called Birth and Last Will functionality.  
So when Homey or HA comes (back) online, this gets noticed and then a broadcast is started.

Homey:

> ![Screenshot_20211231-011533_Homey](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/a/caf0fc615ab004bc8c55982ff455fafdf4004f37.jpeg)

> ![Screenshot_20211231-011457_Homey](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/6/8639712c281b8cc63303e27b0ffa99fa974b12ba.jpeg)

.  
HA (I changed the topic to `homeassistant/status`)

> ![Screenshot_20211231-012000_Chrome](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/9/e921571cdba6a046e96e0d2f3951a5cd87ef1a12.jpeg)

Not sure if this flow is needed:

---

<div class="post-metadata">

**Author:** ![Joost\_van\_Kempen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/joost_van_kempen/32/10067_2.png) [@Joost\_van\_Kempen](https://community.homey.app/u/Joost_van_Kempen)\
**Post date:** [December 31, 2021, 12:52pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/1082 "2021-12-31T12:52:08Z")

</div>

I have the same behaviour, fixed it with a workaround: created a virtual button in Homey which will restart MQTT Client app and MQTT Hub app (in this order). This is the flow: [Gedeelde Flow | Homey](https://homey.app/nl-nl/flow/tFOxgU/)

The virtual button is available in HA, created an automation to trigger this 1 minute after every HA restart. This will work, because sending commands from HA to Homey is working, only the feedback is missing.

At the moment the button is unfortunately displayed as a switch in HA, made a feature request to fix this 😉

---

<div class="post-metadata">

**Author:** ![Henk\_Renting](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/henk_renting/32/87634_2.png) [@Henk\_Renting](https://community.homey.app/u/Henk_Renting)\
**Post date:** [December 31, 2021, 1:33pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/1083 "2021-12-31T13:33:34Z")

</div>

You mean you can operate devices from HA then? In my case I cannot operate them too. So a switch Homey wouldn’t be effective. I’d rather use a webhook for triggering the flow in Homey.  
Unfortunately cannot find an option to send a webhook from HA.

---

<div class="post-metadata">

**Author:** ![Joost\_van\_Kempen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/joost_van_kempen/32/10067_2.png) [@Joost\_van\_Kempen](https://community.homey.app/u/Joost_van_Kempen)\
**Post date:** [December 31, 2021, 1:44pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/1084 "2021-12-31T13:44:55Z")

</div>

I can operate from HA to Homey, however status is not broadcast from Homey to HA. Have been experimenting with birth and last will, not working for me

---

<div class="post-metadata">

**Author:** ![Robert\_Zwetsloot](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robert_zwetsloot/32/12399_2.png) [@Robert\_Zwetsloot](https://community.homey.app/u/Robert_Zwetsloot)\
**Post date:** [December 31, 2021, 5:25pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/1085 "2021-12-31T17:25:28Z")

</div>

The same over here, Mosquitto (on docker, or the same in synology) Docker log log says:  
New client connected from 192.168.2.25:43540 as homey\_8b525af3 (p2, c1, k30).  
Client homey\_8b525af3 disconnected due to malformed packet.  
Cant find any reason why suddenly this malformed packet showed up  
MQTT explorer has no problem with connection to the broker.

---

<div class="post-metadata">

**Author:** ![Robert\_Zwetsloot](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robert_zwetsloot/32/12399_2.png) [@Robert\_Zwetsloot](https://community.homey.app/u/Robert_Zwetsloot)\
**Post date:** [January 1, 2022, 5:51pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/1086 "2022-01-01T17:51:20Z")

</div>

Went back to the homey broker and everythings works as before. Something must have been changed in the latest version of Mosquitto , I will see if I can found out wihich version I used before

---

<div class="post-metadata">

**Author:** ![Henk\_Renting](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/henk_renting/32/87634_2.png) [@Henk\_Renting](https://community.homey.app/u/Henk_Renting)\
**Post date:** [January 3, 2022, 8:17am UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/1087 "2022-01-03T08:17:45Z")

</div>

To everyone experiencing the same problem as me (having to rebroadcast/restart MQTT Hub after HA restart):

I now notice that this also needed (in my case at least) after a restart of Homey. I’ve made a flow for this:

---

<div class="post-metadata">

**Author:** ![Marcel\_1988](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/marcel_1988/32/13750_2.png) [@Marcel\_1988](https://community.homey.app/u/Marcel_1988)\
**Post date:** [January 3, 2022, 4:44pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/1088 "2022-01-03T16:44:06Z")

</div>

Hello,

Had someone also when you restart the app some lights go on when broadcast?

Delete the app already and install back but same result…

So hope someone has any idea for this…

Thanks

Marcel

---

<div class="post-metadata">

**Author:** ![Metatron](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/metatron/32/40136_2.png) [@Metatron](https://community.homey.app/u/Metatron)\
**Post date:** [January 8, 2022, 5:27pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/1089 "2022-01-08T17:27:24Z")

</div>

Hello,

I am struggling with the JSONPATH.  
The data I am trying to read looks like follows:  
`tele/Garagentor/SENSOR {"Time":"2022-01-08T18:21:06","SR04":{"Distance":3.561}}`

I want to read the distance, which is a HC-SR04 ultrasonic sensor measuring the position of my garage door.  
So, please, what would the the right/appropriate sensor type? (it is a floating value)  
And what is the correct JSONPATH?

It is a Tasmota flashed device, but the Tasmota App does not recognise my sensor. Therefore I am using MQTT Hub, just in case you where wondering.

Regards, Meta

---

<div class="post-metadata">

**Author:** ![RonnyW](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ronnyw/32/10879_2.png) [@RonnyW](https://community.homey.app/u/RonnyW)\
**Post date:** [January 9, 2022, 4:50pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/1090 "2022-01-09T16:50:10Z")

</div>

> [@Peter\_Kawa](#):
>
> I use the so called Birth and Last Will functionality.  
> So when Homey or HA comes (back) online, this gets noticed and then a broadcast is started.

I’ve checked my config and it seems to be ok.

HA:

 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/8/283271e6126416ecd5bf7e9c34c6af0f37f2d5a2.png)

Homey:

 ![Screenshot_20220109-173201_Homey](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/4/d/4dbbe5f97200c3c34468f6227386ec618887ef1a.jpeg)

So HA should send hass/status in restart and Homey-MQTT-Hub should react on it and reconnect (or resend all device attributes.

It seems, that the MQTT Hub reacts on the HA status and is boradcasting the data:

 ![Screenshot_20220109-173808_Homey](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/3/337041213ab33b5b7450c5b06baa5cc72d3a9f27.jpeg)

But even with this broadcast it’s not working. The devices in HA are only refreshed if the value changes in Homey.  
Example: the first valve got updated in Homey and it’s synced with HA. The others are not visible in HA after the broadcast.

 ![grafik](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/f/5fb2398989b1349478438e81847cd6877c23c49c.png)

To get all states visible in HA, the MQTT hub app needs to be restarted.

@HarriedeGroot  
Can you give us a hint why the states are not broadcasted to HA after a HA restart?  
Is there something I can test - or some settings I missed?  
Many thanks.

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

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