# 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:** 1\
**Showing post:** 671

<div class="post-metadata">

**Author:** ![Satoer](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/satoer/32/38113_2.png) [@Satoer](https://community.homey.app/u/Satoer)\
**Post date:** [October 4, 2019, 6:42pm UTC](https://community.homey.app/t/mqtt-hub-gateway/6766/671 "2019-10-04T18:42:47Z")

</div>

Well… I’ve made a “hack” to resolve the issue. It works but it’s not pretty.

I capture the MQTT scentence in a flow, and push it to a HomeyScript.

 ![setlightcolor](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/3/d32559cca215797e8016864b9a14ddd21f3b5758.png)

This script searches for the light and changes the hue:  
(Example topic string: “homey/lights/light-name/set 360”)

```
let devices = await Homey.devices.getDevices(); 
function CleanName(NameToChange) { //Removes spaces, - and _
var NewName=NameToChange
  return NewName.replace(/_/g, '').replace(/\s+/g, '').replace(/-/g, '').toLowerCase();   
}

var topic=args[0]; //retrieve argument
var LightName=CleanName(topic.split("/")[2]); //distilling light name
var HueValue=parseInt(topic.split("set ")[1])/360; //converting 360 degree string to 0-1 float

_.forEach(devices, device => { //search trough devices for light name
     if (CleanName(device.name)==LightName) {
       device.setCapabilityValue('light_hue', HueValue); // set the hue;
      }
  
   });
```

---

_[View the full topic](https://community.homey.app/t/mqtt-hub-gateway/6766)._
