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

<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:** [April 29, 2021, 8:04pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/930 "2021-04-29T20:04:43Z")

</div>

Any idea what the problem (and hopefully) solution could be, @HarriedeGroot?

---

<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:** [April 29, 2021, 8:52pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/931 "2021-04-29T20:52:04Z")

</div>

@Henk_Renting Nope sorry, Netflix won this evening 🍿

---

<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:** [April 29, 2021, 9:05pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/932 "2021-04-29T21:05:46Z")

</div>

Haha, no problem. Not in a hurry and will be able to survive without.  
Hope you saw a good movie/series… 😉

---

<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:** [April 30, 2021, 7:30pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/933 "2021-04-30T19:30:18Z")

</div>

**Version 3.3.2**

- Color temperature fix

---

<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:** [April 30, 2021, 8:46pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/934 "2021-04-30T20:46:43Z")

</div>

Wow, thx @HarriedeGroot!  
Now I am able to change color temperature from within HA. The value in Homey gets updated accordingly (obviously). Great!

But the value set in Homey doesn’t get updated in Home Assistant.  
And the setting ranges from 153-500. 1-100 would be more logical. Or perhaps 2200-4000 K.  
Is that a MQTT Client problem and/or something that can be finetuned?

Thanks so far for the great help.  
Bought you a few drinks on the newly opened terraces! 😉

 ![SmartSelect_20210430-223004_Home Assistant](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/8/a8cb3ff64252c434d121977c6b7e45992464d288.jpeg)

---

<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:** [April 30, 2021, 9:50pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/935 "2021-04-30T21:50:17Z")

</div>

This was a quick fix.

The color handling actually needs a full rewrite…  
The current implementation was mainly written for the connection with OpenHab, which is based on communication with RGB values. Hence the color topic. The hue, saturation and temperature topics should be made available themselves, to prevent some strange conversions and false assumptions.

I was looking at the [chroma.js](https://gka.github.io/chroma.js/) lib to do the heavy lifting.

---

<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:** [April 30, 2021, 9:55pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/936 "2021-04-30T21:55:33Z")

</div>

Ok, thank you could arrange it so far then.  
Something which could be on the to do list or is it simply too much work?

---

<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:** [April 30, 2021, 10:01pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/937 "2021-04-30T22:01:16Z")

</div>

Nothing is ‘too much’ and everything is possible 🤓.  
But rewriting the color handling needs some thinking and it is not a small change, possibly with breaking changes…

---

<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:** [April 30, 2021, 10:07pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/938 "2021-04-30T22:07:22Z")

</div>

Hmmmm, I get it. 😕  
Is that why commands from HA don’t get through to Homey too then?  
That would be the biggest advantage, I suppose…

---

<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:** [April 30, 2021, 10:09pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/939 "2021-04-30T22:09:43Z")

</div>

No, probably a wrong conversion from temperature to HSV and reverse. While this conversion isn’t necessary in the first place.

The current implementation detects if a device contains any color capabilities and translates them to HSV and/or RGB values and does the reversed calculations for incoming messages/data. This process can be skipped (partially) if the original capabilities (hue, saturation & temperature) are exposed themselves.

---

<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:** [April 30, 2021, 10:16pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/940 "2021-04-30T22:16:02Z")

</div>

Hmmm, that is mostly too much programming language for me… Haha.  
Well, would be great if it could be fixed, but of course I fully understand if that consumes too much time and effort…

---

<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:** [May 1, 2021, 6:34pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/941 "2021-05-01T18:34:35Z")

</div>

I’m really thankful that you haven’t abandoned this app eventhough you’ve migrated away from Homey. I’m growing more and more reliant on the app each day it feels like. Right now I’m trying to migrate more stuff into MQTT to be platform agnostic kind of.

Anyway, I think it would be nice if you could add the optional “node\_id” topic to the Home Assistant Discovery topic. Either to set it manually or leave it to “homey” or something.  
Then if you make some own HA-discovery configs it’s easier to organize them in the MQTT tree structure.

Example:  
homeassistant/sensor/ **homey** /motion\_sensor

I’ve been a long time user and the app has worked pretty flawlessly for a very long time since you helped me understand how MQTT worked.

---

<div class="post-metadata">

**Author:** ![Urban](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/urban/32/18440_2.png) [@Urban](https://community.homey.app/u/Urban)\
**Post date:** [May 1, 2021, 8:19pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/942 "2021-05-01T20:19:17Z")

</div>

Thanks for all your effort for this great app Harrie!

Last week I made the MQTT connection between my Homey and HA. Didn’t take a lot of time to get it running. 😃

This morning I noticed some Errors in my HA logbook:  
2021-05-01 21:20:06 ERROR (MainThread) [homeassistant.util.logging] Exception in color\_temp\_received when handling msg on ‘homie/homey/light/lamp-tv-staand/color/v’: ‘50’  
Traceback (most recent call last):  
File “/usr/src/homeassistant/homeassistant/components/mqtt/debug\_info.py”, line 32, in wrapper  
msg\_callback(msg)  
File “/usr/src/homeassistant/homeassistant/components/mqtt/light/schema\_basic.py”, line 354, in color\_temp\_received  
self.\_color\_temp = int(payload)  
ValueError: invalid literal for int() with base 10: ‘326.5’

I didn’t notice these errors before, could this be related to the changes in the 3.3.2 version?

---

<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:** [May 1, 2021, 8:34pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/943 "2021-05-01T20:34:52Z")

</div>

@Urban you’re correct. This error originates from the latest update. The light temperature value send from Homey to HA is invalid. Before this value wasn’t send at all and the latest update resolved the issue in the other direction (HA =\> Homey). The consequence: if the light temp is modified in Homey, the HA value isn’t updated accordingly.

By accident I also saw this error in my HA log this morning. Thanks for reporting.

---

<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:** [May 1, 2021, 10:52pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/944 "2021-05-01T22:52:49Z")

</div>

@Camelen wouldn’t it be more logical to use the device name as node\_id. So instead of …/homey/device-capability, it becomes …/device/capability.  
Need to test if this also is the actual solution to the [‘naming’ issue](https://github.com/harriedegroot/nl.hdg.mqtt/issues/24).

Does HA use the optional node\_id as a ‘device’ indicator and sub-topics will be the linked entities?

---

<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:** [May 2, 2021, 5:13am UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/946 "2021-05-02T05:13:35Z")

</div>

In doing a bit more investigation I guess you ARE using the optional node\_id in the MQTT\_hub already in the way you describe it in the post above right (as the device)?

And I also agree that it’s the logical way to do it. I was expecting the ability to use an extra topic.

And no HA does not seem to use the optional node\_id for anything practical inside HA. Just as a help to structure the MQTT-tree better.

Edit:  
Regarding the naming issue I can really see the problem. Since the sensor entities created needs to have the name with the capability included.  
i.e. Table lights - Power  
While the on/off capability shouldn’t have the capability in it’s name.

I’m not sure if that’s easily achievable or not and if there might be a problem with devices with two or more switches. But I guess they are considered different devices in Homey so I guess it should be fine if possible.

---

<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:** [May 2, 2021, 9:33am UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/947 "2021-05-02T09:33:32Z")

</div>

I expected HA to handle the naming correctly, since devices are first class members in HA nowadays. But that’s not the case…Both the device name and entity (=capability) name are provided. I once tried without the device name in the entity name, but that didn’t work as intended and the change was reversed. Don’t know if adding an alternative behavior for ‘onoff’ values is the way to go. Guess I’ll leave it as is for now … it’s easy to modify the names in HA afterwards anyway. You can even choose your own icon 😉

---

<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:** [May 2, 2021, 4:09pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/948 "2021-05-02T16:09:06Z")

</div>

Yes indeed, I don’t see the name thing to be an issue really.

---

<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:** [May 3, 2021, 10:48am UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/949 "2021-05-03T10:48:12Z")

</div>

**Version 3.3.3**

- Color temperature fix: Homey =\> HA

---

<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:** [May 3, 2021, 12:45pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/950 "2021-05-03T12:45:20Z")

</div>

Works like a charm, @HarriedeGroot!  
Thanks, very much appreciated! 👍🏻😃

To make it really neat, I have to find a way to change the min and max values in HA (now 153 and 500), but I suppose that has something to do with the calculations in HA.  
Great work, thx!

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

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