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:
https://developer.amazon.com/docs/smarth...skill.html
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:
https://developer.amazon.com/blogs/post/...-Login-wit
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:
    Macro=\User\ECHO\Lights
KitchenLights
BreakfastLights
KitchenPendants
FamilyRoomLights
KeepingRoomLights
FloodLights
StairHallChandelier
BedroomLights
BathroomLights
    EndMacro
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:
https://developer.amazon.com/docs/smarth...lates.html
Have fun
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:
https://developer.amazon.com/docs/smarth...skill.html
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:
https://developer.amazon.com/blogs/post/...-Login-wit
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:
    Macro=\User\ECHO\Lights
KitchenLights
BreakfastLights
KitchenPendants
FamilyRoomLights
KeepingRoomLights
FloodLights
StairHallChandelier
BedroomLights
BathroomLights
    EndMacro
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:
https://developer.amazon.com/docs/smarth...lates.html
Have fun