Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Native amazon echo implementation
In another post, I mentioned I had implemented a smart home skill on the ECHO such that I can say things like "Alexa, turn on the kitchen lights", and "Alexa, lock the gate". Here is the general approach. It's by no means plug and play, but after you understand the flow and study the code, it should make sense.

So first, just like the current echo setup, you have to make a developer's account and set things up. Unlike the current setup, there is no interaction model...instead we select the pre built smart home model.
This page walks through the steps:

The code for the lambda function is included in the zip file. You do have to add your cqc url in two places.

Unlike the skills version, the smart home version requires account linking via OAuth2. You can use LoginWithAmazon, again explained here:

Basically, I tried to leverage the work Dean has already done to make voice control work, so I had to make what was already done work in my new model. So first, we need a configuration file. It's a long JSON encoded file with a lot of redundency, so I instead start with a simple configuration file which looks like:

Light,KitchenLights, Kitchen Lights, Cans in Kitchen
Speaker, 01,Kitchen Music, Music zone
Lock, FrontGate, Gate, Front Gate control

For the first line, that's the device type (Light), the endpointID sent to CQC (KitchenLights), the voice command to address the device (Kitchen Lights), and then a description of the device (Cans in the Kitchen).
I then run the included python script to transplate the file into the JSON.
That file is placed in a /ECHO subfolder of my CQC htmlroot directory.
All the files are included in the zip.

When you say "Alexa, discover new devices", the ECHO will load the configuration file and the devices will show up in the alexa app.

Then when a command is received by the ECHO, say" Alexa, turn on Kitchen lights", a command is sent to the ECHO URL on CQC just as in the current version. You then use the exact same configuration file, so there would be an entry like this:

The Light macro then runs and decodes the command sent by the echo and does the appropriate thing. Again, the example macro is included.

Since the same configuration file is used, you can have both the current CQC echo control and the smart home version working currently.

So, all in all, it seems a bit complicated, but overall it is fairly straightforward. There is just more work on the backend, as I had to work within the confines of what was already done.

However, it would be fairly simple matter to make this a seamless experience with the V2devices (lights, locks, thermostats, etc), where you simple click a field to make it voice controlled, add a voice control name, and then CQC automatically generates a configuration file and handles the control aspect automatically.
Also, amazon now supports a huge variety of device types:

Have fun

Attached Files
.zip (Size: 5.89 KB / Downloads: 6)
Thanks!,  look forward to trying this out.
Like I mentioned above, you can't simply drop this into your system. It's geared to my system and not generic, but 90% of the work is done if someone wants to adapt it for their own system. The hardest part of the process was simply getting the lambda function to talk to CQC, exchange and decode the JSON and format the right response. That's already done in the python code and the macro.

If you look at the python code, you see that for each type of voice command, it simple setups the "intent,key,parms" format that is currently used by the CQC Echo interface. The "parms" entry hold an encoding for the command (e.g. "TurnOn", "AdjustBrightness:50", "SetBrightness:50", "Lock", etc). It's then up to the cqc macro to decode the parms entry and do whatever action is required. It should be fairly simply for someone to adapt and or extend the work already done.
I finally got around to trying this out, and of course a few gotchas, but did get it working.  I just did a simple test so far, but after a few hurdles on setup, seems to work great.  Thanks so much on sharing this.

If anyone else is interested, I can update NishanF's info he provided with the issues I had to resolve.  Overall about 2 hours to get it up and running!  Now I am off to change some CQC Echo tasks to the Native Echo.

Thanks a ton for sharing!

Possibly Related Threads...
Thread Author Replies Views Last Post
  I think Amazon may have screwed us Dean Roddey 26 1,123 1 hour ago
Last Post: znelbok
  Echo integration still working for folks? IVB 5 1,697 01-15-2018, 06:18 PM
Last Post: IVB
  CQC on Amazon Ron Haley 34 9,620 12-30-2017, 08:28 AM
Last Post: RichardU
  Echo as Text-To-Speech jkmonroe 8 3,867 12-13-2016, 07:43 AM
Last Post: potts.mike
  how deep is your (echo voice control) love? IVB 197 23,607 05-23-2016, 08:47 AM
Last Post: Dean Roddey
  Amazon Echo Smart Home Skills API jkmonroe 23 4,462 04-19-2016, 08:40 PM
Last Post: IVB
  Amazon Echo $153 today only (on sale) IVB 0 1,079 04-19-2016, 01:09 PM
Last Post: IVB
  Increasing Echo->SmartThings suckage? IVB 0 1,023 04-18-2016, 07:08 PM
Last Post: IVB
  Echo Code Snippets potts.mike 5 1,741 03-23-2016, 12:10 PM
Last Post: kblagron
  Increment Volume via Echo? jkmonroe 2 1,499 02-10-2016, 08:27 AM
Last Post: kblagron

Forum Jump:

Users browsing this thread: 1 Guest(s)