Documentation

Welcome to the documentation for the Google Assistant Smart Home Action Node-RED node.

Create Account

Before starting you will need to create an account, if you have not yet done this you can do this here.

You can now create your first device using the wizard to pick the type and traits you need.

When you create the account please use a real email address. This address will only ever be used to allow you to reset your password and to send you messages about the state of the service.

Join the Google Group

To be able to access the Action you will need to join the following Google Group with the same Google ID that you use with Google Assistant.

https://groups.google.com/forum/#!forum/node-red-google-home-bridge

Any email addresses linked to Google accounts will never be used or released to any 3rd parties. Only if they match the email address linked to the account created in the previous step, and then only for the reasons already stated.

Create Devices

Once you have an account you can start creating devices to expose to the Goolge Assistant.

Device Types:

  • Light
  • Switch
  • Outlet
  • Blind
  • Door
  • Thermostat
  • Fan
  • Heater
  • Pureifier
  • Scene

Traits:

  • OnOff
  • Brightness
  • ColorSetting
  • FanSpeed
  • TemperatureSetting
  • OpenClose

There are some extras in the lists in the wizard for creating devices that are disabled, they are there while I work out a good way to expose their triats so they can be easily configured.

Link Account

Now you have and account you can enable action in the Google Home app and link the account you've just created.

  • First click the "Add" button.

  • Then "Set up device"

  • And next select "Works with Google" and then finally find "NR-GAB" in the list with the following icon.

  • Finally sign in with the username and password you created earlier.

Install Nodes

There are 2 ways to install the required Node-RED nodes.

  • First using the pallet manger

    Search for node-red-contrib-googlehome

  • Second on the command line

    Make sure you are in the Node-RED userDir (normally ~/.node-red) and then run

    npm install node-red-contrib-googlehome

Building Flows

There are 2 nodes available in the pallet, google home and google home response. For most situations you can get away with using the google home as this is the node that output the commands when you ask Google Assistant to do something.

Configure Nodes

When you drag the first Google Home node on to the canvas you will need to create a config node. To do this, click on the pencil icon next to the first input. This will open a new dialog, where you can enter the same username/password from the first step and hit the "Add" button. For all subsequent nodes you should just pick the entry from the drop down that matches your username.

Once you have picked the right config node, after a second or so the list of devices should be populated. If you have recently created or deleted a new device then you can hit the refresh button to the right of the drop down and the node will update it's list from the service.

To start with you should leave the Auto Acknowledge box ticked. This will assume that any incoming command has succeed and report that back to the Google Homegraph1.

The Google Home node will output a message object that looks like the following when a command arrives:

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

The msg.payload.command value will be one of the commands identified in the traits identifiers from the Google Smart Home Action API. The msg.payload.params will hold the settings to be updated on the device.

Example messages from the supported traits (click on trait name to expand):

  • OnOff
    {
      topic: "",
      name: "Light"
      raw: {},
      payload: {
        command: "action.devices.commands.OnOff",
        params: {
          on: true
        }
      }
    }
  • Brightness
    {
      topic: "",
      name: "Light"
      raw: {},
      payload: {
        command: "action.devices.commands.BrightnessAbsolute",
        params: {
          brightness: 30
        }
      }
    }
  • ColorSetting

    Colours in RGB

    {
      topic: "",
      name: "Light"
      raw: {},
      payload: {
        command: "action.devices.commands.ColorAbsolute",
        params: {
          "color": {
           	"name": "magenta",
            "spectrumRGB": 16711935
          }
        }
      }
    }

    Colour Temperature in K

    {
      topic: "",
      name: "Light"
      raw: {},
      payload: {
        command: "action.devices.commands.ColorAbsolute",
        params: {
          "color": {
           	"name": "warm white",
            "temperature": 4000
          }
        }
      }
    }
  • FanSpeed
  • TemperatureSetting
  • OpenClose

More traits and configuration options for traits when I get time to work out how to nicely expose them.

Sending a response

If you are triggering an action that may fail, then you can untick the Auto Acknowledge box. When you do this you will have to terminate the flow with a Google Home Response node.

You need to configure the response node to point to the same device as the input node it is connected to by selecting the account name and device name from the dropdowns provided.

This node takes the same msg.payload format as output by the input node. The msg.payload.params should be updated to match the new state of the device.

Updating Google Homegraph state without a command

Google Assistant keeps track of the state of all devices to allow it to keep the GUI in the App or on devices with screens up to date. This informaton is kept in something called the Homegraph.

If you are updating the device state without using Google Assistant you can can update the Homegraph using the Google Home Response node.

In the case above the light is turned on, and the state sent back to the Home Graph, but 5 mins later the trigger node turns the light back off and updates the Home Graph again with out the need for a new input message.