Google Assistant Home Control Actions – Introduction

During Google I/O 2017, Google launched its’ Assistant voice-enabled AI platform for iPhone. Google also released more Google Actions developer tools, including a console to configure “Home control” actions. Until now, developers like us had to fill out a form and wait for people from the Google Home Control Actions team enable a development skill.

Google Home Control actions functionally serve the same purpose as Amazon Alexa Smart Home skills – allowing users to control their smart devices, such as plugs, lights, and thermostats with voice. Much like Alexa, Google supports account linking with OAuth. Google Home Control action, also sends one of the predefined intents. Just like with Alexa Smarthome, Home Control does not support custom utterances.

Coding for processing Google actions may be hosted on Google Cloud, or anywhere else. Commands are sent as HTTP requests. Essentially, Home Control actions processing software for Google Cloud is a custom Express.JS application middleware. Our client decided to host the development code on Google Cloud and the production version on AWS Lambda. To move our Google Cloud project to AWS Lambda hosting, we used an existing piece of software – AWS Serverless Express.

Your wrapper AWS Lambda code might look like:

'use strict';

import { actionHandler } from './google_home_control';
const atob = require('atob');
const awsServerlessExpress = require('aws-serverless-express');
const awsServerlessExpressMiddleware = require('aws-serverless-express/middleware');
const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');
const compression = require('compression')
const app = express();

app.use(bodyParser.urlencoded({ extended: true }));
app.use(awsServerlessExpressMiddleware.eventContext());'/', actionHandler);

const server = awsServerlessExpress.createServer(app);

export function lambda_handler(event, context, callback) {
    console.log("LAMBDA STARTED: ");
    console.log("LAMBDA EVENT: ", event);
    console.log("LAMBDA CONTEXT: ", context);
    console.log(`EVENT BODY IS BASE64: ${event.isBase64Encoded}`);
    try {
        if(event.isBase64Encoded) {
            event.body = atob(event.body);
            event.isBase64Encoded = false;
        awsServerlessExpress.proxy(server, event, context);
    catch(error) {
        console.log("ERROR IN awsServerlessExpress: ", error);

Home Control actions API comes down to three (3) intents: SYNC – called when an account is linked using OAuth, QUERY to read the state of the devices and EXECUTE to perform control commands on behalf of the users. The SYNC intent is roughly a functional equivalent of Alexa Smart Home DISCOVERY. Unlike Alexa Smarthome API version 2, invoking different control intents depending on the desired action, Google Home control has only one control intent with specific action requests being passed in the payload, like "command": "action.devices.commands.OnOff". The device capabilities are called traits in Google terminology, for example, to support power control, devices must have action.devices.traits.OnOff.

If you have questions or need help with Amazon Alexa skills or Google Assistant actions, reach out to our experts.

Please follow and like us: