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: 40)
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!
I finally have done about all I want to do with this for now, and very happy! Right now I have these devices automated within Echo:

 Family Speaker
 Master Speaker
 Gameroom Speaker
 Office Speaker
 Outside Speaker
 Master Bath Speaker
 Kitchen Speaker
 Patio Speaker
 Pool Speaker
 All Speakers
 Family TV
 Master TV
 Gameroom TV
 Office TV
 Pool Pump
 Pool Cleaner
 Water Fall
 Air Blower
 Pool Light
 Spa Light
 Quad Cam
 Entry Way Cam
 Back Yard Cam
 Inside Cam
 Driveway Cam

I already had native Echo integration with Sonos and my Insteon light switches, so just about everything is covered now.

The three Alexa devices I configured from Nishan's work were Speaker, TV, and Switch.   The Speaker devices have the ability to switch power, turn volume up or down, mute, or set the volume to a particular level. (It accesses my B&K CT600 Unit).   The TV device allows you to turn on the TV, change channels, and switch the video input - all of my TV's are one way control, so I can't really control volume since I don't know what the settings are at the time of the command. (One TV has a one way Samsung Serial Driver, the other three use the Global Cache IR device)  Since I use DirecTV, I can change channels just by saying the number in any way.  I think you could also do it by a call sign, but didn't look into that.

The Cameras are viewed on one or more of the four TV's. The Cameras are displayed from an Analog feed on a channel that is distributed throughout the cable in my house.  I originally wanted it to be able to turn on the TV's and view the cameras, but since the Echo device wants to get a message back in a certain amount of time, it was too lengthy waiting for the TV to power on, then switch inputs, and Alexa would bark about not getting a response (even though it would turn on the TV and switch the inputs).  So now I decided to just use the "Turn on TV" command, and once its powered up, give the command to "Turn on Cam So and So".  If the TV is already on, you can just say "turn on the Cam" and it will switch.

I also was able to configure it to access CQC using a secure and non-standard port, so that was nice as well.  The hardest part of the learning curve was the need to use a Macro .vs. an Action since Echo wants a confirmation back, but Nishan's work made that relatively easy once I figured out how I wanted to do it with multiple devices.

Thanks again Nishan for providing this.  The WAF is very high after doing this.
I am interested in this, as my old Alex Hue Simulation driver has been blocked by Philips, so I am looking for a new solution.  My first problem is that I cannot run the CQCWeb Server with external access. I have tried a dynamic DNS service (no luck) and am now contacting my ISP as I think they are blocking most ports into my router.

It may be a stupid question, but why should each CQC user have to go through the pain of setting up a web server, registering for a developer account etc.  None of the other Smart Home applications seems to work that way.   Why can't there be a single CQC server (in the cloud) that you register with and that is automatically updated with a list of the users devices, names etc from the Administrator Interface.  I for one would be happy to pay a small monthly subscription to pay for such a service.
I have AT&T, and if you have that, I had set up the Pace 5268ac as a pass-thru to the router I use.  A bit of a pain, but I do know that they had some ports blocked on it in the 8000 range, which happened to be the ones I initially chose for the Web Server.  I have since gone to all secure ports that are non standard.  If this pertains to you I can dig a little deeper and see if I can re-remember, I believe it was 8000 - 8015.
(07-08-2019, 08:33 PM)kblagron Wrote: I have AT&T, and if you have that, I had set up the Pace 5268ac as a pass-thru to the router I use.  A bit of a pain, but I do know that they had some ports blocked on it in the 8000 range, which happened to be the ones I initially chose for the Web Server.  I have since gone to all secure ports that are non standard.  If this pertains to you I can dig a little deeper and see if I can re-remember, I believe it was 8000 - 8015.

I have found its an extra 8 euro per month (I live in Italy) for a fixed IP address with ports open so I asked to upgrade my service.  When it works, I will try new driver.

Try ngrok.

i too have an ISP that uses NAT so port forwarding does not work. I recently found ngrok and it creates a secure tunnel to allow external access. It turns out Blue Iris also recommend ngrok for the same reason.

My initial test shows that it works fine with CQC.
Mykel Koblenz
Illawarra Smart Home
Kblagron, please provide the updates to HishanF's information. I'm trying to add this to my home CQC system. Thanks, Bryan

Possibly Related Threads…
Thread Author Replies Views Last Post
  I think Amazon may have screwed us Dean Roddey 32 11,630 06-20-2019, 08:53 PM
Last Post: Dean Roddey
  Echo integration still working for folks? IVB 5 4,142 01-15-2018, 06:18 PM
Last Post: IVB
  CQC on Amazon Ron Haley 34 19,555 12-30-2017, 08:28 AM
Last Post: RichardU
  Echo as Text-To-Speech jkmonroe 8 6,536 12-13-2016, 07:43 AM
Last Post: potts.mike
  how deep is your (echo voice control) love? IVB 197 55,576 05-23-2016, 08:47 AM
Last Post: Dean Roddey
  Amazon Echo Smart Home Skills API jkmonroe 23 10,394 04-19-2016, 08:40 PM
Last Post: IVB
  Amazon Echo $153 today only (on sale) IVB 0 1,960 04-19-2016, 01:09 PM
Last Post: IVB
  Increasing Echo->SmartThings suckage? IVB 0 1,868 04-18-2016, 07:08 PM
Last Post: IVB
  Echo Code Snippets potts.mike 5 3,768 03-23-2016, 12:10 PM
Last Post: kblagron
  Increment Volume via Echo? jkmonroe 2 2,667 02-10-2016, 08:27 AM
Last Post: kblagron

Forum Jump:

Users browsing this thread: 1 Guest(s)