# Guide to Connecting gBridge to Homey for Google Assistant

**URL:** <https://community.homey.app/t/guide-to-connecting-gbridge-to-homey-for-google-assistant/9234>\
**Category:** Devices\
**Created:** [February 15, 2019, 3:04pm UTC](https://community.homey.app/t/guide-to-connecting-gbridge-to-homey-for-google-assistant/9234 "2019-02-15T15:04:24Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![KonradWalsh](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/konradwalsh/32/147_2.png) [@KonradWalsh](https://community.homey.app/u/KonradWalsh)\
**Post date:** [February 15, 2019, 3:04pm UTC](https://community.homey.app/t/guide-to-connecting-gbridge-to-homey-for-google-assistant/9234/1 "2019-02-15T15:04:24Z")

</div>

This guide was put together with the help of @HarriedeGroot, @Camelen, @xAPPO, @scanno and **others**. All I am doing is collating everything below this post to help others.

**First Step - gBridge**  
Go to [gBridge.io](http://gBridge.io) and open a free account. ([http://gbridge.io/](http://gbridge.io/))  
With in the Account Settings you will see you username - uXXX and the connection information:

- MQTT server: [mqtt.gbridge.io](http://mqtt.gbridge.io/)
- MQTT port: 8883

**Second step - Homey Side**  
Install MQTT Client - [https://apps.athom.com/app/nl.scanno.mqtt](https://apps.athom.com/app/nl.scanno.mqtt)  
Install via Hub - [https://apps.athom.com/app/nl.hdg.mqtt](https://apps.athom.com/app/nl.hdg.mqtt)

**Third Step - Set up Connections**

**in MQTT Client Settings**

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/6/6fdfbdecd91fc88ec9dd3c85f5fbdcee9e87b481.png)

**In MQTT Hub Settings:**

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/6/6301376f6ce02ebce9e2c8272901d1a9fd6ca7f4.png)  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/4/40ee64c89cb93eecf391c8cff1289b7469b72c62.png)

## **_REBOOT HOMEY_**

Choose just one device for now… on the devices tab, you can add more later.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/d/dca0d3a94e01621ca3f23ee1cbd1c6dc4e142522.png)

## Go to settings and click broadcast once

Go back to [gBridge.io](http://gBridge.io) and create a device

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/3/3a6bc73d4c7877170b9749b90c2c80df49acc4aa.png)

note in the above screenshot how the **ACTION**  **and STATUS** topic have been amended to match what homey is sending outwards —\>gBridge

Also note - the change from _brightness_ to **dim**  
So my light was called Front Door Lights in Homey. MQTT Hub amended that to front-door-lights and sends it out. You want to catch that on the gBridge side.

**Last Step**  
Say - Ok, Google, Sync Devices  
after that you should have something similar to this

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/a/ae812ff3b2cb7ebdd5101342e34dbca161b4e07f.png)

You may need to scroll to the bottom to see them

---

<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:** [February 15, 2019, 3:49pm UTC](https://community.homey.app/t/guide-to-connecting-gbridge-to-homey-for-google-assistant/9234/2 "2019-02-15T15:49:52Z")

</div>

I will try to connect the gBridge to my mosquitto broker that I have on my rpi. Hopefully I can get it to work this way.

The broker works fine with 2.0 but is on separate hardware.

Well see if I might get a local version of gBridge to work as well.

---

<div class="post-metadata">

**Author:** ![KonradWalsh](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/konradwalsh/32/147_2.png) [@KonradWalsh](https://community.homey.app/u/KonradWalsh)\
**Post date:** [February 15, 2019, 4:36pm UTC](https://community.homey.app/t/guide-to-connecting-gbridge-to-homey-for-google-assistant/9234/3 "2019-02-15T16:36:05Z")

</div>

I’ll try the same tonight

---

<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:** [February 15, 2019, 10:15pm UTC](https://community.homey.app/t/guide-to-connecting-gbridge-to-homey-for-google-assistant/9234/4 "2019-02-15T22:15:16Z")

</div>

Ok I have some news, after a lot of testing.  
I’m really not very knowledgeable of Linux but I am pretty good at googling. Just putting that out there to make people know that there’s probably a lot of things I haven’t thought of, managed or tried.

So first of all my setup is the following:  
Homey Pro  
-MQTT Client  
-MQTT Hub  
RPi 3  
-MQTT Broker, Mosquitto

I managed to connect gBridge to my mosquitto broker by using the guide on their documentation page:  
[https://doc.gbridge.io/firstSteps/mqttServer.html](https://doc.gbridge.io/firstSteps/mqttServer.html) (at the bottom)

And I also followed the steps shown on their page on how to connect Google Home to gBridge the normal way.  
In my broker I saw some topics getting added. However I had a bit of a problem, homey got added like this:  
homie/homey/items  
while gBridge had the following:  
gBridge/{userID}/items

And I had no control of the gBridge broker (i tried to install it locally but I didn’t manage. My skills ends there and I have given up on that, which means I’m bound to the gBridge service).

What I did was in the MQTT Hub i changed Root Topic and Device ID to match the things added to gBridge. And when I added the item in gBridge i put it like this:

 ![54](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/c/c2e6c70c30b5dad3b5299063c44c75feff2ccd3b.png)

And it actually works right now.  
I have only tried a simple switch, no dimmer or anything else. But a simple switch, on/off works with google. home now without adding any flows to homey 🙂

Maybe I’m flooding his server. I’m not sure actually.

---

<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:** [February 16, 2019, 11:28am UTC](https://community.homey.app/t/guide-to-connecting-gbridge-to-homey-for-google-assistant/9234/5 "2019-02-16T11:28:27Z")

</div>

I’ve tried adding dimming possibility but I can’t really get it to work out of the box.  
The value showing from homey is 0.1 for 10% while gBridge has the value 10 for 10%.

I’m not sure if this is changeable, maybe in the MQTT Hub? Is this controlled by the Homie-convention? And is this something that is chosen by @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:** [February 16, 2019, 12:19pm UTC](https://community.homey.app/t/guide-to-connecting-gbridge-to-homey-for-google-assistant/9234/6 "2019-02-16T12:19:50Z")

</div>

@Camelen It’s not chosen by me, but by Athom. I just forward the capability values.  
To overcome this problem I intend to include a ‘property scaling’ option in the hub.

---

<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:** [February 16, 2019, 12:29pm UTC](https://community.homey.app/t/guide-to-connecting-gbridge-to-homey-for-google-assistant/9234/7 "2019-02-16T12:29:23Z")

</div>

That would be great and flexible!

Edit: although it would be better if there would be a standard for this for compatibility between all devices/services.

---

<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:** [February 17, 2019, 9:02pm UTC](https://community.homey.app/t/guide-to-connecting-gbridge-to-homey-for-google-assistant/9234/8 "2019-02-17T21:02:24Z")

</div>

gBridge and MQTT-Hub (homie3) direct link for on/off devices - really easy using nodeRED.

Device ‘eating’ directly mapped to ‘kitchen-table’.  
louey is the name of my Homey.

![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/a/a09f5c6cae0cacb20dde9bd661e91f77a97b71e7.png)

If you use level (dim) devices you can link their level topic with a \*100 and a /100 to match with MQTT-Hub’s use of 0-1.0 in dim .

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/7/76e91e993633dbd3314e0063ebd86660fe1be982.png)

The default range of 0 - 1.0 used by Homey is powerful in that it doesn’t mandate the upper range value or the gradation involved. cf. a value like 0.98765 with 0-100 (integer ) which limits you to 101 steps and 0-100. 0-1.0 is very flexible although it doesn’t directly translate naturally to the value for things like temperatures or a 0-255 device or negative values.

---

<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:** [February 17, 2019, 9:27pm UTC](https://community.homey.app/t/guide-to-connecting-gbridge-to-homey-for-google-assistant/9234/9 "2019-02-17T21:27:11Z")

</div>

Looks very easy and straight forward.

The positive thing with my solution is that we require one less application for this to work. The great thing about having node red in between seems to be that we can adjust for every possible scenario or mismatch.

---

<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:** [February 17, 2019, 10:03pm UTC](https://community.homey.app/t/guide-to-connecting-gbridge-to-homey-for-google-assistant/9234/10 "2019-02-17T22:03:34Z")

</div>

I don’t understand how your solution works with the required dim level conversion ?  
You’re requiring others to adapt to your needs.

---

<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:** [February 17, 2019, 10:05pm UTC](https://community.homey.app/t/guide-to-connecting-gbridge-to-homey-for-google-assistant/9234/11 "2019-02-17T22:05:00Z")

</div>

Right. No it doesn’t work with dim, only on/off. But MQTT Hub is getting an update that manages this. So yeah, right now dimming needs node red. On off doesn’t.

For the record. I haven’t required anything.

---

<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:** [February 17, 2019, 10:05pm UTC](https://community.homey.app/t/guide-to-connecting-gbridge-to-homey-for-google-assistant/9234/12 "2019-02-17T22:05:36Z")

</div>

There’s going to be a lot of similar situations.  
MQTT-Hub being a Homey app should publish capability values as Homey presents them … or it becomes a translation layer - which is not it’s role.

Until homie3 or ‘another’ defines a way of matching value ranges this is a problem that will require massage by middleware.

---

<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:** [February 18, 2019, 5:26am UTC](https://community.homey.app/t/guide-to-connecting-gbridge-to-homey-for-google-assistant/9234/13 "2019-02-18T05:26:03Z")

</div>

I agree. That’s basically what I said in my edit above, but I am not the developer and it wasn’t my idea to do the transformation.

---

<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:** [February 18, 2019, 6:34am UTC](https://community.homey.app/t/guide-to-connecting-gbridge-to-homey-for-google-assistant/9234/14 "2019-02-18T06:34:15Z")

</div>

@Camelen scaling percentage values to the 0…100 range is implemented on the ha branch by now.

---

<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:** [February 18, 2019, 7:28am UTC](https://community.homey.app/t/guide-to-connecting-gbridge-to-homey-for-google-assistant/9234/15 "2019-02-18T07:28:05Z")

</div>

Thank you! Is there anything else that differs with the HA-branch that could break anything? (except unforseen bugs ofcourse)  
Or is the HA-branch more of an alpha of HA-implementation to the beta-branch? =)

I appreciate that you add this since I’m not very hopeful that a standard for this will emerge in a close future.

---

<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:** [February 18, 2019, 4:15pm UTC](https://community.homey.app/t/guide-to-connecting-gbridge-to-homey-for-google-assistant/9234/16 "2019-02-18T16:15:11Z")

</div>

I updated to HA-branch and now dimming works with google home by setting percentage format int. 👍👍👍

---

<div class="post-metadata">

**Author:** ![Wout\_F](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/wout_f/32/7474_2.png) [@Wout\_F](https://community.homey.app/u/Wout_F)\
**Post date:** [February 20, 2019, 8:03pm UTC](https://community.homey.app/t/guide-to-connecting-gbridge-to-homey-for-google-assistant/9234/17 "2019-02-20T20:03:02Z")

</div>

I’m running into the same problem as @KonradWalsh and was wondering if anyone had made any progress yet?

- I’ve linked my gBridge-account to Google Assistant and added a device
- I’ve installed the MQTT Hub on Homey and configured the Root Topic and Device ID. It should send the commands in the format gBridge is expecting, e,g: “gBridge/u796/Slaapkamer\_dimmer/onoff”. I can see these commands show up in the logs of the MQTT Client, which is also running.

The problem is connecting the MQTT Client to the gBridge-broker. I keep seeing this in the logs:

> 20190220-20:52:32 Broker not connected, attempting connection  
> 20190220-20:52:32 Broker URL: mqtts://mqtt.gbridge.io:8883  
> 20190220-20:52:32 keepalive: 60  
> 20190220-20:52:32 clientID = homey\_b80fc642  
> 20190220-20:52:32 rejectUnauthorized: true  
> 20190220-20:52:32 getLogLines called  
> 20190220-20:52:32 MQTT error occured: Error: Connection refused: Unacceptable protocol version

I’m kinda stuck here. Any ideas? @HarriedeGroot @scanno

---

<div class="post-metadata">

**Author:** ![Wout\_F](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/wout_f/32/7474_2.png) [@Wout\_F](https://community.homey.app/u/Wout_F)\
**Post date:** [February 20, 2019, 9:08pm UTC](https://community.homey.app/t/guide-to-connecting-gbridge-to-homey-for-google-assistant/9234/18 "2019-02-20T21:08:15Z")

</div>

As a workaround I installed Mosquitto on my Home Server and hooked it up to gBridge as a bridge. I feel like I’m really close to getting it working, but not quite there yet.

When I try to switch on Slaapkamer\_dimmer in the Google Home app, I see this in my mosquitto logs

> 1550696457: Received PUBLISH from local.gbridge-u796-sdjlnsdbkdshjsd (d0, q0, r0, m0, ‘gBridge/u796/slaapkamer-dimmer/onoff’, … (1 bytes))

So it seems the command is sent to my broker. I would then expect a sending publish message, just like happens here

> 1550696285: Sending PUBLISH to local.gbridge-u796-sdjlnsdbkdshjsd (d0, q0, r1, m0, ‘gBridge/u796/toon/meter-power’, … (4 bytes))  
> 1550696285: Received PUBLISH from local.gbridge-u796-sdjlnsdbkdshjsd (d0, q0, r1, m0, ‘gBridge/u796/toon/meter-power’, … (4 bytes))

With my basic knowledge of MQTT it seems like the command is correctly received from gBridge, but isn’t forwarded to Homey. I’m guessing Homey isn’t ‘subscribed’ to the topic. Does anyone know how I fix that? @Camelen perhaps?

---

<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:** [February 20, 2019, 9:35pm UTC](https://community.homey.app/t/guide-to-connecting-gbridge-to-homey-for-google-assistant/9234/19 "2019-02-20T21:35:25Z")

</div>

First I’d like to say that I also use mosquitto as a bridge and haven’t even attempted to connect MQTT Hub directly to gbridge.

Anyway have you tried to use MQTT Explorer? I find it to be a good debugging tool.

If you connect MQTT Explorer to Mosquitto you can see if the publish from both homey and gBridge is correct.

You can see that the topics change in real time when you make changes in both Google Home and Homey.

Try that and you could take a screenshot how the values look and show here if you need further help 🙂

Edit: it’s also important to note that gbridge switches the action and status topics by default. So the action topic should be:  
slaapkamer-dimmer/onoff/set

And the status topic:  
slaapkamer-dimmer/onoff

Default is the other way around!

---

<div class="post-metadata">

**Author:** ![Wout\_F](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/wout_f/32/7474_2.png) [@Wout\_F](https://community.homey.app/u/Wout_F)\
**Post date:** [February 20, 2019, 10:32pm UTC](https://community.homey.app/t/guide-to-connecting-gbridge-to-homey-for-google-assistant/9234/20 "2019-02-20T22:32:00Z")

</div>

> Edit: it’s also important to note that gbridge switches the action and status topics by default. So the action topic should be:  
> slaapkamer-dimmer/onoff/set  
> And the status topic:  
> slaapkamer-dimmer/onoff  
> Default is the other way around!

Thx, switched those around.

In MQTT Explorer I only see two elements in the treeview: gBridge and $SYS. Shouldn’t Homey be showing there as well?

 ![Capture](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/6/6fd85ae0cf1a76fd590d8505d31514f986eb06cf.jpeg)

This is what I’m seeing in the log after starting mosquitto

> 1550701196: mosquitto version 1.4.14 (build date 2017-07-10 23:55:18+0100) starting  
> 1550701196: Config loaded from mosquitto.conf.  
> 1550701196: Opening ipv6 listen socket on port 1883.  
> 1550701196: Opening ipv4 listen socket on port 1883.  
> 1550701196: Bridge local.broker1 doing local SUBSCRIBE on topic #  
> 1550701196: Connecting bridge bridge-01 (192.168.1.184:1883)  
> 1550701196: Bridge broker1 sending CONNECT  
> 1550701196: Bridge local.gbridge-u796-sdjlnsdbkdshjsd doing local SUBSCRIBE on topic gBridge/u796/+/+  
> 1550701196: Bridge local.gbridge-u796-sdjlnsdbkdshjsd doing local SUBSCRIBE on topic gBridge/u796/+/+/set  
> 1550701196: Connecting bridge kappelt-gbridge ([mqtt.gbridge.io:8883](http://mqtt.gbridge.io:8883))  
> 1550701196: Bridge gbridge-u796-sdjlnsdbkdshjsd sending CONNECT  
> 1550701196: Received CONNACK on connection local.gbridge-u796-sdjlnsdbkdshjsd.  
> 1550701196: Bridge local.gbridge-u796-sdjlnsdbkdshjsd sending SUBSCRIBE (Mid: 2, Topic: gBridge/u796/+/+, QoS: 0)  
> 1550701196: Bridge local.gbridge-u796-sdjlnsdbkdshjsd sending SUBSCRIBE (Mid: 3, Topic: gBridge/u796/+/+/set, QoS: 0)  
> 1550701196: Received PUBACK from local.gbridge-u796-sdjlnsdbkdshjsd (Mid: 1)  
> 1550701196: Received SUBACK from local.gbridge-u796-sdjlnsdbkdshjsd  
> 1550701196: Received SUBACK from local.gbridge-u796-sdjlnsdbkdshjsd

Shouldn’t there be a mention of Homey subscribing too?

When I for instance try to switch the light on through Google Home, I see the following

> 1550701612: Received PUBLISH from local.gbridge-u796-sdjlnsdbkdshjsd (d0, q0, r0, m0, ‘gBridge/u796/slaapkamer-dimmer/onoff/set’, … (1 bytes))  
> 1550701612: Sending PUBLISH to mqttjs\_332f7476 (d0, q0, r0, m0, ‘gBridge/u796/slaapkamer-dimmer/onoff/set’, … (1 bytes))

It gets published to MQTT Explorer, but not to Homey. When switching through Homey I see the following

> 1550701771: Received PUBLISH from homey\_276051ba (d0, q0, r1, m0, ‘gBridge/u796/slaapkamer-dimmer/onoff’, … (4 bytes))  
> 1550701771: Sending PUBLISH to local.gbridge-u796-sdjlnsdbkdshjsd (d0, q0, r1, m0, ‘gBridge/u796/slaapkamer-dimmer/onoff’, … (4 bytes))  
> 1550701771: Sending PUBLISH to mqttjs\_332f7476 (d0, q0, r0, m0, ‘gBridge/u796/slaapkamer-dimmer/onoff’, … (4 bytes))

Like I said, i’m very new at this, but it seems as if Homey is only sending MQTT commands out, but not receiving them and acting on them. I’ve already looked through the settings of the MQTT Client and MQTT Hub on Homey, but can’t find a setting/option that might affect this.

[Next page](https://community.homey.app/t/guide-to-connecting-gbridge-to-homey-for-google-assistant/9234.md?page=2)
