Creating Custom Google Home entities for integration with Home-Assistant & Node-red

Creating Custom Google Home entities for integration with Home-Assistant & Node-red

This post has been a long time coming. I’ve been looking at an easy way to create and control custom entities with Google assistant much like the way I can do with Alexa. We have both voice assistants in our household and well it was bugging me that I couldn’t incorporate my flows into Google home as readily as I could do with Amazon’s little box of tricks. For those of you who haven’t seen my post on how to set up custom entities under Alexa, you can read more here on how I effectively took a standard humidifier and made it smart here.

Now for those of you that want to get straight into it, in this tutorial, I’m going to show you how to create a custom entity, set it up in Google’s ecosystem, and then use our newly formed entity to toggle a switch that I have set up in home-assistant. I’ll try and make this as quick and straight forward as possible. In order to to this, we’re going to need to rely on a third party bridge that’s able to pass the data inbetween node-red and google’s servers. I’m perfectly comfortable with this. I’ve been doing it for a year without issue on the Alexa side. Clearly for some of you this might be a no go. In which case, you can create your own api and work with Google directly. More info on how to do that here.

Let’s get started:

  1. Create an account here.
  2. Then we need to link the account that we just set up to our Google Home account. This can be done by adding a device (plus icon top left hand side) > Have something already set up? > “Works with Google”

    works with google
    works with google
  3. You’re going to be presented with a list of manufacturers and services, scroll down until you find NR-GAB. Select this.

    NR-GAB
    NR-GAB
  4. You’ll be faced with the usual authentication. Login with the details you created in step 1 and hit authorise.
  5. Go to your node-red install and using the pallet manager search and install the following node: node-red-contrib-googlehome

    node-red-contrib-googlehome
    node-red-contrib-googlehome
  6. After a brief moment, you should be able to scroll down your list of installed nodes until you see the two new Google Assistant nodes we just installed.

    new google nodes
    new google nodes
  7. Drag out the google home node and double click it. We’ll need to configure it accordingly. Hit the edit icon on the side and again, add your login and password. The configuration is effectively complete. Now all that remains to be done is to create our custom entities.
  8. Navigate to this page and select Add Device.
  9. I’ve created a device here called tester. I’ve set it up to be a simple switch, as you can tell from the configuration.
    Add Device Page
    Add Device Page

    device list
    device list
  10. Next we need to go to google home and discover devices. After a short while your custom device should appear. Finish the set up in the app as necessary (room, group etc).

    Google Home App
    Google Home App
  11. Next go back to Node-red and double click again the google home node we dragged out earlier. Hit the little refresh icon on the right. There you should be able to now see your custom entity in the little drop down list. Select it.
    google home tester
    google home tester

    In order to test that the connection was there I attached a debug node to the entity and then deployed. I clicked on and off in the app and was met with the following JSON, confirming that we were indeed connected and working. The first payload was me pressing on in the app, and the second was off. You can see only one parameter changes. On: true or false.

    debug output
    debug output
  12. Finally to finish my proof of concept, i connected a service call node and configured that to toggle my office lamp on and off as I needed. It works via the Google Home app as well as the voice assistant.
    simple flow
    simple flow

    toggle office lamp
    toggle office lamp 

You’ve just created your own custom entity and you can now trigger whatever you want, whenever you want. As I mentioned before, I’ve been using such a bridge with Alexa with great results. It’s really improved my automation game.

I’ve just touched on the most basic functionality here. If you want to read further about the incoming JSON and what else you can expose to Google and for more advanced features you can read the documentation here.

I hope you found this useful! Check out my other posts for similar related content!

 

If you enjoyed this type of content and would be interested in sharing your own solutions, tips and tricks with like minded people perhaps you’d consider joining our facebook group. The aim of this group will hopefully be more show and tell rather than support, but that’s not to say we can’t lend a helping hand 🙂

https://www.facebook.com/groups/386238285944105

 

 

My most recent book..

 

Leave a Reply

Your email address will not be published. Required fields are marked *