# Gbridge - a Google Smart Home to MQTT bridge

**URL:** https://discourse.nodered.org/t/gbridge-a-google-smart-home-to-mqtt-bridge/6582
**Category:** General
**Created:** [8 January 2019 23:06 UTC](https://discourse.nodered.org/t/gbridge-a-google-smart-home-to-mqtt-bridge/6582 "2019-01-08T23:06:00Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![DeanC](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/deanc/32/298_2.png) [@DeanC](https://discourse.nodered.org/u/DeanC)
#### Post date: [8 January 2019 23:06 UTC](https://discourse.nodered.org/t/gbridge-a-google-smart-home-to-mqtt-bridge/6582/1 "2019-01-08T23:06:00Z")

</div>

I haven't had a chance to look at this in any detail but it sounds good.

[https://about.gbridge.io/](https://about.gbridge.io/)

> gBridge is an application, that provides a Bridge between Google Assistant smart home devices and MQTT, an open and available messaging protocol that is supported by many smart home applications and devices.
> 
> _mic_ "Hey Google, set the ceiling light to 43%." _arrow\_forward_ gBridge/u1/ceiling\_light/brightness: 43
> 
> Since gBridge is an open source project, you can host it on your own systems.

There is both a hosted and self hosted version.

---

<div class="post-metadata">

### Author: ![Hed](https://avatars.discourse-cdn.com/v4/letter/h/7bcc69/32.png) [@Hed](https://discourse.nodered.org/u/Hed)
#### Post date: [9 January 2019 13:45 UTC](https://discourse.nodered.org/t/gbridge-a-google-smart-home-to-mqtt-bridge/6582/2 "2019-01-09T13:45:28Z")

</div>

I've been trying this out for a few days and it has worked well. With all the trouble it can be to set up google integration it was nice to have it up and running in literally about 10 minutes.

---

<div class="post-metadata">

### Author: ![role2mail](https://avatars.discourse-cdn.com/v4/letter/r/4bbf92/32.png) [@role2mail](https://discourse.nodered.org/u/role2mail)
#### Post date: [9 January 2019 20:04 UTC](https://discourse.nodered.org/t/gbridge-a-google-smart-home-to-mqtt-bridge/6582/3 "2019-01-09T20:04:19Z")

</div>

Is there something like this for Alexa??

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [10 January 2019 12:16 UTC](https://discourse.nodered.org/t/gbridge-a-google-smart-home-to-mqtt-bridge/6582/4 "2019-01-10T12:16:35Z")

</div>

Yes, same here.  
The MQTT response is really fast, and consistent.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [11 January 2019 21:27 UTC](https://discourse.nodered.org/t/gbridge-a-google-smart-home-to-mqtt-bridge/6582/5 "2019-01-11T21:27:32Z")

</div>

Ah, very cool. While I'm always cautious about using 3rd-party services connected to the house, at least there is a nice easy way to get started before setting up a home server.

I did check out the Ts&Cs and the privacy page. The former seem OK, the privacy page is rather lacking as it only refers to the web site, not the service. There is an implication that they don't reuse personal data but it isn't explicit which isn't so good. But being based in Germany is good as they are generally pretty strict.

I'll definitely be trying this out at some point to complement my Telegram bot and home dashboard. My Wiser heating system already has Google Home integration but being able to use "scenes" to control multiple rooms via Node-RED would be nice.

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [22 January 2019 20:17 UTC](https://discourse.nodered.org/t/gbridge-a-google-smart-home-to-mqtt-bridge/6582/6 "2019-01-22T20:17:27Z")

</div>

I noticed a few days ago, that some new features have been added, [see this post](https://community.gbridge.io/t/gbridge-roadmap-and-updates/17/7).  
Two of the features in particular caught my attention;

## Acknowledgement

**Hey Google, turn on {device name}**  
_Are you sure you want to turn on {device name}?_  
**Yes.**  
_OK, turning on {device name}_

and

## Acknowledgement

**Hey Google, turn on {device name}**  
_Can I have your security code to turn {device name} on?_  
**1234**  
_OK, turning {device name} on_

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [6 February 2020 10:11 UTC](https://discourse.nodered.org/t/gbridge-a-google-smart-home-to-mqtt-bridge/6582/7 "2020-02-06T10:11:51Z")

</div>

Link - [gBridge service closing](https://discourse.nodered.org/t/gbridge-service-closing/21343)

---

<div class="post-metadata">

### Author: ![Olaa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/olaa/32/73030_2.png) [@Olaa](https://discourse.nodered.org/u/Olaa)
#### Post date: [5 January 2023 11:03 UTC](https://discourse.nodered.org/t/gbridge-a-google-smart-home-to-mqtt-bridge/6582/8 "2023-01-05T11:03:57Z")

</div>

Hi there 🙂  
I'm really bad in code and need some help.  
When I use the bridge I gott a long message from it sent to my Mqtt. See below.  
I want to use an IF in a function node to have a response on the state "true" / "false" and send on / off instead to the mqtt.  
Please help.

```auto
{
  topic: "",
  name: "Light"
  raw: {},
  payload: {
    command: "action.devices.commands.OnOff",
    params: {
      on: true
    }
  }
}

```

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [5 January 2023 11:34 UTC](https://discourse.nodered.org/t/gbridge-a-google-smart-home-to-mqtt-bridge/6582/9 "2023-01-05T11:34:05Z")

</div>

Lots of ways, but here is one using a [ternary operator](https://www.javascripttutorial.net/javascript-ternary-operator/)...  
Try the below code into a function node.

```auto
let result = msg.payload.params.on? "on" : "off"
return { payload: result }

```

```auto
[{"id":"88c190a4645879b4","type":"inject","z":"217df193.d774ce","name":"True","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"command\":\"action.devices.commands.OnOff\",\"params\":{\"on\":true}}","payloadType":"json","x":165,"y":535,"wires":[["44d72ed86afee168"]]},{"id":"3d2d01e6919ffd4a","type":"debug","z":"217df193.d774ce","name":"debug 29","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":455,"y":550,"wires":[]},{"id":"44d72ed86afee168","type":"function","z":"217df193.d774ce","name":"function 7","func":"let result = msg.payload.params.on? \"on\" : \"off\"\nreturn { payload: result }","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":305,"y":550,"wires":[["3d2d01e6919ffd4a"]]},{"id":"c04febdc6d16de87","type":"inject","z":"217df193.d774ce","name":"False","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"command\":\"action.devices.commands.OnOff\",\"params\":{\"on\":false}}","payloadType":"json","x":165,"y":575,"wires":[["44d72ed86afee168"]]}]

```

---

<div class="post-metadata">

### Author: ![Olaa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/olaa/32/73030_2.png) [@Olaa](https://discourse.nodered.org/u/Olaa)
#### Post date: [5 January 2023 19:44 UTC](https://discourse.nodered.org/t/gbridge-a-google-smart-home-to-mqtt-bridge/6582/10 "2023-01-05T19:44:13Z")

</div>

Thank you so much 🙂  
works perfect and I have learned new things!

Thank you for fast and nice response!

Have a nice day.

sincerely  
Ola A in Sweden.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [19 January 2023 19:44 UTC](https://discourse.nodered.org/t/gbridge-a-google-smart-home-to-mqtt-bridge/6582/11 "2023-01-19T19:44:31Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
