TL;DR Namine now has a couple voice-activated lights in her room. Check out the video, and keep on reading if you’re interested in the setup.
I didn’t want to just buy a Google Home. Instead, I bought a Raspberry Pi and some other equipment:
- Raspberry Pi 3
- Wires + LED light
- Smart plugs (I found a 2-pack on Amazon)
Following this tutorial, I was able to get the Pi connected to my Google account as an Assistant client. For the most part, the tutorial worked like a charm. Unfortunately, there were a couple sticky bits.
When setting up the speakers and microphone, I had to change the
rate line from “16k” to “16000” on these two lines to avoid getting an invalid argument error:
arecord --format=S16_LE --duration=5 --rate=16k --file-type=raw out.raw
aplay --format=S16_LE --rate=16k out.raw
When I initially ran the
main.py script, I got another error:
TypeError: __init__() missing 1 required positional argument: 'device_model_id'
This was because since the article was written, Google updated the Assistant API. (Google gonna Google.) Since making these changes, developers now have to register custom devices like the Raspberry Pi. A couple extra steps proved fairly easy to do (as documented by Google here ), and the Raspberry Pi was up and running as a Google Assistant.
Following the tutorial’s directions, I was able to get the LED connected just fine. It lights up when the Pi is listening, and turns off when it’s not.
Here’s where the tutorial ended, and I had to figure out the next steps for myself. I had my 2-pack of smart plugs, and as it turned out, they have a companion app: Smart Life.
I plugged in the two smart plugs in Namine’s room. I plugged her lamp into one, and her moon night light into the other. (The lamp was plugged into the outlet controlled by the light switch, which Namine can’t reach. Now it’s plugged into an always-on outlet.)
In retrospect, I probably should have taken some screenshots of the setup process. Anyway, the app required me to create an account, then it scanned for available devices. It detected the two I had just plugged in and turned on, so it let me add them and name them.
The app also let me define rooms, so I could turn every smart device off in a room, were I so inclined. The app also has timing capability, for turning lights on or off at a certain time of day, and so on.
But that’s enough of that. The Smart Life app was simply a means to an end; I never meant to control anything in the apartment from this app on a long-term basis. The real goal was connecting the devices to Google Assistant, which, as it turned out, was just as easy as the initial device detection.
I opened the Google Assistant app, and navigated to Settings > Home control. I clicked the blue “plus” button in the bottom right corner to create a new device — rather, in this case, connect an existing device.
Starting out fresh, there were no linked services. I scrolled down and found Smart Life in the list, thereby allowing me to access my two smart plugs from within Google Assistant. Because Assistant is configured to use my Google account both on my phone and on the Raspberry Pi, I can control them from either device. (That includes controlling the lights when I’m away from home, as well.)
The rooms configured in Smart Life have no bearing on the rooms in Google Assistant, so I created new rooms with the same names. The two plugs’ names carried over from Smart Life: “Lamp” and “Moon.”
Here’s where things get tricky, because as much as these digital assistants (Google Assistant, Siri, Alexa, Cortana, and others) are touted as AI, they are still not capable of true natural language. It also — at least in Assistant’s case — is not yet capable of being taught how to pronounce new words or names.
I initially named Namine’s lamp “Namine’s lamp” with the intention of saying, “Hey Google, turn on Namine’s lamp.” That didn’t work; it never recognized Namine’s correctly pronounced name.
Interestingly enough, if I said “turn on the lamp” it did turn on the lamp, but it would then respond, “Turning on the nominee’s lamp.” So not only did there seem to be no way for me to teach Assistant how to pronounce Namine’s name, but it also didn’t recognize the possessive noun. No matter what, it always responded by referring to it as “the [nickname].” After some trial and error, I ended up giving it the phonetic nickname “lamp in naameenayz room.” (It took a few tries to get it to pronounce Namine’s name just right.)
Despite all this, it still does not recognize the command “turn on Namine’s lamp” (even though the phonetic name is exactly how we pronounce her name), although the simpler “turn on the lamp” still works. It then responds with “turning on the lamp in Namine’s room,” which is acceptable enough. Content with the results — or content enough, for now — I set up Namine’s moon, which hangs from her ceiling, in the same way.