Read my mind Alexa
I’ve tricked out the house with Alexa compatible gadgets, a bunch of plugs, a whole set of bulbs and three echo dots in three different rooms. I was watching The First and there are lots of sci-fi type things in the show, which is primarily actually a drama with sci-fi things occassionally going wrong. So they have the standard sci-fi-ish stuff with one of the main characters living in a smart house and another one in a smarter house. Typical future expectation like you walk into a room and lights come on and fireplace starts etc. I saw one of the characters ask for the TV to turn on by saying “screen on” or something similar into the ether and the TV screen turned on with the channel showing what he wanted to see. That got me thinking, I’m pretty sure I should be able to do that with Alexa and Routines and the only real difference is that I would have to say the wakeword, Alexa, first.
So I tried it and it works well enough as I have the TV plugged into a smart plug and the TV is an older LED one that returns to its on/off state whenever power is turned off and back on. As long as I don’t use the remote to turn off the TV, it works. Here is where it starts to get complicated, I have, gasp two TVs. There’s one in the living room and one in the bedroom (which also is on a smart plug and has an echo dot nearby). If I want my new fancy routine to work with the TV in the living toom and the TV in the bedroom I’d need to say which screen. I’d need to say “living screen on” or “bedroom screen on” and while that would work, it’s not as nice as it should be.
I want to be able to say “screen on” near the echo dot in the living room and it turns on the living room TV and say “screen on” near the echo dot in the bedroom and it turns on the bedroom TV. The problem with this is that Alexa doesn’t care where it hears the command, it executes without additional context. Now that I’ve discussed the problem, here’s my idea for a solution.
It seems that the Alexa API now lets you request additional location information for your skill, inclusive of a Device ID. To get the routine to work though, I would need to create a proxy smart home skill that would hopefully have the device id in the request JSON somewhere. Once I can get that, I’d need to find the devices associated with the device id, which I would have to setup externally and then change the devices to suit. Seeing as there is no API for me to automate Alexa itself (why Amazon, whyyyyy?), it looks like I’ll have to figure out the API to control the devices outside of the Alexa ecosystem.
It turns out I was a bit lucky and bought a set of TP Link based bulbs and plugs and it turns out that someone already has a command line app (nodejs based) that I should be able to use to turn my bulbs and plugs on and off. It looks like I should only need to learn one API and command line the rest of it based on the plug and bulb ids.
Thinking about it a bit more, I shouldn’t even have to say “Alexa, screen on”, I should just have to say “Alexa, screen” and the skill will know the state of the plug. If it’s on it turns it off and if it’s off it turns it on. This should be able to extend to lights as well, “Alexa, lights” should be able to toggle the lights near the device on and off.
Let’s see if I can get any traction on this when I get my time machine working. :).