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(compression());
app.use(cors());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(awsServerlessExpressMiddleware.eventContext());

app.post('/', 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:

Amazon Alexa vs Google Assistant vs Microsoft Cortana

During the 2017 Build event, Microsoft unveiled the promised Cortana Assistant -powered speakers and released Cortana to developers looking to introduce voice skill. We have hands-on experience with Amazon Alexa “custom” and “smarthome” skills. Our engineers were also lucky to participate in Google Assistant “Home control” actions Early Access Program, and built regular Google Assistant actions. We, however, have not had a chance to get our hands on Cortana before the official release. Let’s look at all three platforms, based on the publicly available information.

Amazon Alexa
Alexa is the first voice-enabled speaker on the market. Skills are easy to configure, through an intuitive web interface. Amazon has great documentation and paid developer support is available. There are tons of examples for programmers building both custom and smart home skills. The code could be hosted on AWS Lambda, but it is not a must. Hosting on AWS allows invoking skill processing code by ARN. If the skill is simple, with a few tricks such as keeping lambda warm with CloudWatch events, you might be able to host an extremely quick autoscaling skill while fitting onto the AWS Lambda free tier. Alexa currently supports the US and UK English, as well as German.

Google Assistant
Google Assistant is available on Google Home and Google Pixel phones, but it is coming to every Android smartphone and other surfaces. Actions execution endpoints could be hosted on Google Cloud, or elsewhere. Google Assistant actions are still less mature than Alexa skills. Documentation is less thorough, probably because Google started later in the game. Google Assistant Home control actions are still in the Early Access Program. We won’t discuss specifics until Home control has been officially released. There are however Home control actions running in production. Most major smarthome hardware manufacturers have either already introduced their products on Google Home, or in the process. Google’s one apparent advantage is many more languages than Alexa. Further, Google Assistant is designed to integrate with other Google services, starting from the calendar. We believe that Google Assistant has a lot of potential. Time will tell how Google will execute leveraging its’ strengths and making actions development partner-friendly.

Microsoft Cortana
Based on the publicly available information, there is no Alexa smart-home or Google Assistant “Home control” -style API, yet. Cortana supports more languages than Alexa, yet fewer than Google Assistant. Several manufacturers partnered with Microsoft and announced their Cortana speakers, yet none have been released. It appears that Cortana skills have to be hosted on Microsoft Azure and nowhere else.

Conclusion
Microsoft is a bit late to the party, but this is probably only the beginning. There are rumors of an Apple Siri speaker, which may not pan out, or we might see one come out of Cupertino.
We believe that the main battle might take place in the cockpit of your car, where speakers make even more sense.
In the meantime, please stay tuned. Once Google releases “Home control” to the public, we will tell you how we managed to build a complex product for Google Assistant, in just one week, leveraging our Alexa experience and assets.

Please follow and like us: