A bridge between Google Home and Windows Embedded devices and Azure IoTHub.

Preamble

This might be a solution chasing a problem! Thinking of Home Automation devices such as the Google Nest, its “nice” being able to verbally ask Google, Alexia, or even Cortana for the local temperature, turn on lights etc. It retrieves this information from services on the internet It would be even better if there was a bridge between Google Home etc to custom hardware or even Azure IoT Hub such that you could say, for example, “Hey Google, what is the temperature on HAL” where HAL is an IoT device somewhere in the universe! Or “Alexa, shut down HAL” (but please don’t sing Daisy, Daisy..) 😄

The objective here is to be able to activate, for example, a .NET sensor reading app on a remote Raspberry Pi via a voice command on a Google Nest, return the result to the Nest and enunciate the result there as a response to the command. Better still, to get that from an Azure IoT Hub!


Whilst there are a number of possible solutions for this, the solution discussed here focuses upon Google Home and makes use of:

“TRIGGERcmd is a cloud service that allows you to securely and remotely run commands on your computers.”

“Cast is a Windows command line utility which lets you send text (as spoken words), music, or videos to your Google Assistant (Home, Mini, or Max), a Chromecast enabled device (like your TV), or PC Speakers.”

TRIGGERcmd

TRIGGERcmd installs on a Windows PC, a Mac, or Linux (especially on Debian on a RPi). Follow the link as above. When installed an agent runs either in the foreground or background. You also install it on Android via the Google Home app there. There is a file commands.json placed in [user folder]/.TRIGGERcmdData which lists all of the commands that can be activated on the device/PC along with certain properties for each. There is a command property which states the application or script to be run when the command is activated. There is also a a voice property that is what is said to activate it. On an Android phone, the Google Home app is able to discern all devices/PCs running TRIGGERcmd agent locally and obtain the commands on each as listed in commands.json. One then can use the “Hey Google, …“ command message to activate a command on a local device. To specify a command you use its voice property and if not on the default device/PC then you also include the device name. Some examples where the device name is Pi with command voice properties sensor and motor are:

"Hey Google, start sensor on Pi"
"Hey Google, start motor on Pi"

Cast

In the case of starting or stopping a motor you don’t need a specific audible response the command. But in the case where it is reading and returning a value you probably want the Google Nest to speak the result. As a first step you can just use the audio of the device. This has been demonstrated on a RPi where the temperature is measured with DHT22 and BME240 sensors. A string is generated stating the temperature which is passed to T2S on the RPi. The cast app, which can be installed on a Windows device (only) is able to send a string to be spoken on the Google Nest. Some simple example of casting text to the Nest are:

cast -text This is a test
cast -file c:\temp\temperature.txt

Given that cast is not available on the RPi running Debian, the generated temperature string is passed to PC with cast installed and relayed from there to the Google Nest.

WhatCanISay

I have always found it useful with voice activated devices such a in-car GPS to be able to ask, “What can I say” to get a list of commands that can be used. This has been implemented as a .NET cross platform app which when activated returns a list of commands from a device, to be spoken on the Nest, after interrogating commands.json.

Azure IoT Hub

Finally, wouldn’t it be nice to get a Google Nest to interact with an Azure IoTHub .. the “Holy Grail” in all of this. More on that later, but it has been done!

Repositories

These concepts will be expanded upon in subsequent blogs (coming) which will discuss some GitHub repositories:


 TopicSubtopic
<  Prev:   Blazor Helpers App Twilio
   
 This Category Links 
Category:IoT Index:IoT
  Next: > Google Home Windows Bridge
<  Prev:   Blazor-IoT