# Grafik Eye Control with Amazon Alexa



## MichiganMan (Aug 4, 2008)

I have an older 6-ch 16-Scene Grafik Eye lighting controller. Its I/R only. 

Is there a way to use Alexa voice control to some how blast I/R commands? I have all the learned codes just need a simple way to interface and trigger the codes.

Any ideas?


----------



## bignordique (Nov 23, 2011)

I have my Alexa set up to send IR commands to my Panasonic TV. Same thing could be done with the Graphik Eye, just different codes.

However.....

This is no small feat. And there are some drawbacks.

It requires a domain name registration and a CA Certificate. At best both of these require "maintenance". The domain name registration is $10-20 a year. A self signed (free) CA Certificate can be used, but I think the maximum validity time is two years.

My theater has a whole bunch of lights/fans/screens etc. for which there is no other way to control them except via the Alexa path. It is cool to utter "Alexa! Lower the screen" and the screen comes down. Makes you feel a bit like James T. Kirk. But... I've found Alexa's voice recognition is not all that great. It can be cumbersome to control things through Alexa with your voice.

Part of the idea was to reduce/eliminate the need for a whole pile remotes. But, pushing buttons on the motes is generally more efficient that yelling at Alexa. Sorry .

And then.... recently Bezos and company has changed some things. Like the rules for skill invocation word. I haven't worked too hard at this, but overall, Alexa's ability to recognize invocation words seems to have tanked?? 

One of the interesting things about writing your own skills for Alexa is its "free"... I guess. I do know that Bezos didn't become the richest man in the world by giving things away. I'm suspicious that one of the things they've changed is the quality of the voice recognition is somehow related to how much money you send to Amazon.

The bottom line for me is that given the cumbersome nature of voice control and the uncertainty around what Amazon is doing, a different solution is required. I'm working on a web interface so that these lights/fans/screens can be controlled through a phone.

If you're still interested in pursuing the Alexa thing, let me know and I'll give you a run down of the pieces required.


----------



## MichiganMan (Aug 4, 2008)

Yes I'm curious on the pieces you're using.

My theater is light controlled so pitch black. My old TSU3000 remote only has so much room for buttons per screen. A simple voice command would sure simplify things.

I'm going to play with my Harmony Hub this weekend. It has Grafik Eye support (just loaded it) so If I can create a functional group It might work. Wish me luck


----------



## bignordique (Nov 23, 2011)

My theater has an embedded controller based on a Xilinx Zynq FPGA. Part of this FPGA is an ARM processor that runs Linux.

Because this is an embedded controller, each time it powers up it basically starts from the image its programmed with. You can't just apt install like on a regular Debian system. You have to the build file system image, and then install the image. I used Yocto to build this file system image, which a whole adventure on its own. 

You could do this with a Raspberry Pi. Cheaper, and generally more accessible. And Raspbian is not an embedded system. But be sure you have some backup in case your image becomes corrupt. If you don't need the FPGA stuff, it would be the way to go.

So now you've got a Linux based controller for your theater. It can send commands down the LAN. In my case, some of the things I controlled are over GPIO. For the IR stuff, I used a Global Cache IP2IR box.

So now you can control all the stuff in your theater. How to connect that to Alexa?

Amazon has this Alexa development console. They actually go to some lengths to make it easy to develop "Alexa Skills". 

An Alexa skill consists of two major pieces. The voice interaction model and the logic behind it. 

The voice interaction model consists of a invocation word, intents and slots. These are used to define the interaction with the user. They have a nice GUI to do this, or you can write some JSON.

Behind the voice interaction model is the logic. The logic receives calls from the voice service. It generates the response and tells the Alexa box what to say.

The easiest way to implement this logic is in AWS lambda functions. It can be done in Python, Node, or probably just about any other language you care to use. AWS lambda is by definition ephemeral. I don't think there is any way to control real hardware.

Another Alexa supported means of implementing this logic function is by a "web service". A web service is simply a server that communicates over the HTTP protocol. Nominally with puts and gets. So, basically, Alexa can be set up to convert some voice input into HTTP (HTTPS actually) transactions that can be sent to any server connected to the world wide web.

So you need an HTTPS server running at your house, connected to the world wide web. This is where the domain name and CA certificate come in. You'll also probably need to set up dynamic DNS on your router, unless you happen to have a static IP. And you'll probably need program your router to forward the Alexa packets to your controller.

There is a bunch of protocol and security stuff necessary to communicate with Alexa. Rather than figure this out for myself, I used the Python Flask/Ask library. Flask/Ask takes care of the peculiarities of dealing with Alexa. You end up with a template to fill out for each call from Alexa.

Flask/Ask runs under the HTTP server process. You need to get your commands back and forth to the process that's running your theater controller. I basically used sockets for this.

Before I went down this path, I tried to use Amazon's IOT thing. Actually got the screen to go up and down, but its really not the right way to do this sort of thing.

I've probably skipped a few steps. But that's most of it. Don't say I didn't warn you.


----------



## MichiganMan (Aug 4, 2008)

bignordique said:


> I've probably skipped a few steps. But that's most of it. Don't say I didn't warn you.


  You did indeed! 

I'm just a novice programmer and I hate that all these services go out to the cloud and back. That's why I have a closed MQTT network for some of my simple home data/stuff.

I only briefly played with the Harmoney Hub this weekend. I might be on to something but it is too early to tell. 

I might circle back around to the Pi stuff too, I have a couple sitting around.


----------

