For a long time, I have been using Alexa as my home automation device purely because adding smart devices in NodeRED was very simple. Now, integrating Google Assistant and NodeRED is equally easy. Thanks to gBridge.io. Also thanks to @Happy_Cats2017 for the tip!
While self-hosting will be a possible way to dodge the shutdown, consider checking available alternatives in this post.
Smart devices, Google Assistant and NodeRED
If you are into NodeRED or Home Assistant, chances are that you have MQTT or HTTP devices linked to your server. Without a designated skill/service, it was nearly impossible to link them with Alexa and Google Assistant unless you were happy to use IFTTT. Previously, NodeRED skill for Alexa was the best way to integrate project like my $5 connected NEST-alike thermostat with Alexa and have full control over temperature settings and feedback (not possible with IFTTT alone) but thanks to gBridge you can do the same with Google Assistant.
gBridge MQTT service
After a successful Kickstarter campaign, gBridge offers free* link between Google Assistant and NodeRED (or any MQTT service). This is great, as you can flash your Sonoff Basic with Tasmota, or make your own sockets with ESP8266 and MQTT support – and easily integrate it with Google Assistant!
It gets better, the dev is working on the bridge for Alexa devices too, which means more options to integrate devices. The dev is committed to privacy in his statement and the source code is published on GitHub! A lot of home automation users will appreciate the transparency!
*free up to 4 devices, then pay as much as you want for unlimited!
How to use gBridge?
NodeRED integration is very simple. First, open an account on https://gbridge.kappelt.net/. You can add up to 4 free devices before you are asked to contribute to the project. Before you add any device, head to “my account” and set an MQTT password. You will need this to set up your MQTT client.
Follow the steps from the docs to create the MQTT config and create a new device. Each device will come with Name, device type and capabilities. Set these to your preference. The list of supported device types is impressive, to say the least, and should cover your needs!
Each device will come with 2 MQTT topics:
- Action Topic: (for MQTT IN node) where you receive status updates triggered via Google Assistant (yes it’s slightly confusing)
- Status Topic: (for MQTT OUT node) where you send the updates about the changes made to your device so Google server was aware of it.
Create a simple flow where you can receive and update the statuses via newly added MQTT server. Save and deploy.
[{"id":"2939705f.c6c74","type":"mqtt in","z":"eff8376b.1671d8","name":"Bench","topic":"gBridge/u2491/bench/status","qos":"0","datatype":"auto","broker":"476aee80.20987","x":190,"y":260,"wires":[["1fcc0173.67523f"]]},{"id":"aac0f85d.2ce008","type":"mqtt out","z":"eff8376b.1671d8","name":"Bench","topic":"gBridge/u2491/bench/status","qos":"0","retain":"","broker":"476aee80.20987","x":450,"y":540,"wires":[]},{"id":"1fcc0173.67523f","type":"debug","z":"eff8376b.1671d8","name":"Feedback","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":380,"y":260,"wires":[]},{"id":"589991b2.189da","type":"inject","z":"eff8376b.1671d8","name":"","topic":"","payload":"on","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":460,"wires":[["aac0f85d.2ce008"]]},{"id":"f9fa3367.dcfa7","type":"inject","z":"eff8376b.1671d8","name":"","topic":"","payload":"off","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":500,"wires":[["aac0f85d.2ce008"]]},{"id":"6fbb57b4.d31718","type":"mqtt in","z":"eff8376b.1671d8","name":"Bench","topic":"gBridge/u2491/bench/set","qos":"0","datatype":"auto","broker":"476aee80.20987","x":190,"y":120,"wires":[["4695a563.e25d2c","698b13b5.c92e9c"]]},{"id":"4695a563.e25d2c","type":"debug","z":"eff8376b.1671d8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":410,"y":160,"wires":[]},{"id":"2fd35c7.deee0a4","type":"comment","z":"eff8376b.1671d8","name":"Google Assistant feedback","info":"","x":150,"y":80,"wires":[]},{"id":"a07ebd22.f22","type":"comment","z":"eff8376b.1671d8","name":"Toggle Feedback","info":"","x":120,"y":220,"wires":[]},{"id":"24d3f492.8b2d2c","type":"comment","z":"eff8376b.1671d8","name":"Alexa","info":"","x":90,"y":660,"wires":[]},{"id":"6dbabfe3.def01","type":"mqtt in","z":"eff8376b.1671d8","name":"Bench light","topic":"/oittm/switch/state","qos":"0","datatype":"auto","broker":"e8ba5257.a9821","x":100,"y":540,"wires":[["aac0f85d.2ce008","26d8ce3b.e3b942"]]},{"id":"5a1ef7bb.7a24b8","type":"mqtt out","z":"eff8376b.1671d8","name":"Bench light","topic":"/oittm/switch/cmd","qos":"0","retain":"","broker":"e8ba5257.a9821","x":490,"y":700,"wires":[]},{"id":"698b13b5.c92e9c","type":"change","z":"eff8376b.1671d8","name":"Change payload","rules":[{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"str","to":"on","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"0","fromt":"str","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":120,"wires":[["13701c11.14adb4"]]},{"id":"3b924cde.15e4f4","type":"comment","z":"eff8376b.1671d8","name":"Update if triggered from elsewhere","info":"","x":180,"y":420,"wires":[]},{"id":"858ffe7b.a48e3","type":"alexa-home","z":"eff8376b.1671d8","conf":"381d30ec.dc8e3","device":"68301","acknoledge":true,"name":"Bench","topic":"","x":90,"y":700,"wires":[["ac9a072a.c1e748"]]},{"id":"ac9a072a.c1e748","type":"change","z":"eff8376b.1671d8","name":"Change payload","rules":[{"t":"change","p":"payload","pt":"msg","from":"true","fromt":"bool","to":"on","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"false","fromt":"bool","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":260,"y":700,"wires":[["5a1ef7bb.7a24b8"]]},{"id":"f6d7efb9.ef451","type":"inject","z":"eff8376b.1671d8","name":"","topic":"","payload":"on","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":760,"wires":[["5a1ef7bb.7a24b8"]]},{"id":"49d2c718.5fca38","type":"inject","z":"eff8376b.1671d8","name":"","topic":"","payload":"off","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":800,"wires":[["5a1ef7bb.7a24b8"]]},{"id":"13701c11.14adb4","type":"mqtt out","z":"eff8376b.1671d8","name":"Bench light","topic":"/oittm/switch/cmd","qos":"0","retain":"","broker":"e8ba5257.a9821","x":630,"y":120,"wires":[]},{"id":"26d8ce3b.e3b942","type":"debug","z":"eff8376b.1671d8","name":"Feedback","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":420,"y":600,"wires":[]},{"id":"7d4b0d03.707894","type":"comment","z":"eff8376b.1671d8","name":"gBridg Action Topic","info":"","x":370,"y":80,"wires":[]},{"id":"f0dba30.fd1006","type":"comment","z":"eff8376b.1671d8","name":"gBridg Status Topic","info":"","x":310,"y":220,"wires":[]},{"id":"c4346c2d.97842","type":"comment","z":"eff8376b.1671d8","name":"gBridg Status Topic","info":"","x":490,"y":500,"wires":[]},{"id":"476aee80.20987","type":"mqtt-broker","z":"","name":"GBridge","broker":"mqtt.gbridge.io ","port":"8883","tls":"8657602a.df371","clientid":"","usetls":true,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"e8ba5257.a9821","type":"mqtt-broker","z":"","name":"MQTT","broker":"192.168.1.10","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"381d30ec.dc8e3","type":"alexa-home-conf","z":"","username":"quintaar"},{"id":"8657602a.df371","type":"tls-config","z":"","name":"gbridge cert","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"mqtt.gbridge.io","verifyservercert":true}]
Use MQTT IN node to receive feedback from Google Assistant. To configure it correctly, you have to use Action Topic. Each time the device changes the state via voice commands, the msg.payload
will get populated. For lights toggles, it is 1
or 0
.
You can use that feedback and change the payload into a compatible message so a locally connected MQTT device would change its state accordingly.
To update the Google Assistant about any changes made by an external switch or Alexa command, you can pass a compatible payload over to the gBridge and assigned Status Topic.
Open Google Home – go to your linked services and look for Kappelt gBridge, authorise your account and you are ready to issue your standard commands as you would have with eWeLink or Yeelight.
Conclusion
It looks like Google Assistant is taking the lead in the battle against the Amazon Echo devices. Something tells me the war is far from over, and I will try to find a way of making Alexa devices speaking on its own. For now, it’s time to add all my Alexa devices to Google Assistant. The hardest part will be to change my habit of saying “Alexa”! What do you think? Will you be trying gBridge? Let me know in this Reddit thread.