Thursday, 22 February 2018

OK, Google

My Google Home mini arrived, and it's rather nice. It's a puck-shaped thing, about four inches across, and I can ask it to do things. So, for example, I asked it how long it would take me to drive to Leighton Buzzard, and it told me 55 minutes, which is right. And the weather, and whether pigs have wings. And apparently, some people think they do. Huh. Who knew?

But what I really want to do, is use it to control things.

So first, I installed the Google Home app on my iPhone, and used that to go through the rather simple setup steps for the Google Home. Mostly, this is to tell it the password for my wifi. And then - let's take CONTROL ...

I already set up a Pi Zero with a pair of relays, controlled via the GPIO ports, and a cgi so that I can switch them on and off over the web. So I decided to use that for the experiment.

Here's how I did it.

The key thing is the ifttt web site. I registered on that, and set up an app.
What my app does, is if I say "OK Google, switch on one" then Google Home talks to ifttt, and ifttt accesses my Pi Zero over the internet, and runs the cgi. The URL it accesses looks like this.'lights=on&port=1'

Where instead of on I could say "off" and instead of 1 I could say 2. Except that it doesn't seem to be able to understand the word "two". But it can understand three. Not four. Yes five. Then I thought, Two is a homonym for "to" and "too". Four is a homonyn for "for". So what works is 1, 3, 5, 6, 7, 8, 9, 10, 11, 12. So I think it's a homonym problem.

The way round it is to say "OK Google, switch on number two" and that works.

So I can switch either of the two relays on or off with a voice command.

Wow! This has potential!

There's a way I can use a Google SDK to make a Google Home on a Raspberry Pi, and I'm planning to have a bash at that; I have a few Pies not doing anything right now.

No comments:

Post a Comment