New to Alexa SDK's and have some fundamental questions...
Hi Everyone, I'm new to the SDK's that seem to just have been made (more?) public. I have two Echo devices in my house and they work great with the stock functionality. But what I would really like to do is extend it with capability to tell me things such as what the temperature is in a particular room in my house, set the thermostat, turn lights on/off, etc. My home automation system consists of a conglomerate of devices from Smarthome for lighting with the ISY controller, home-brew temperature and thermostat control using a PLC as well as .NET modules, etc. The code I would write using the ASK (skills) would be specifically for my implementation only, since my home automation system is unique in many ways. While the API's and cloud-centric behavior is geared mostly towards apps that anyone could use, my case is very different. So the questions I have that hopefully you guys can help me with are: - Can I create an ASK skill and keep it restricted to my two Echo's only? And if so, do I need to go through Amazon testing etc. before I can use these skills? - What would the best architecture be? Based on what I read so far, it seems like hosting my own "endpoint" is the way to go since I'd rather directly get to my network so the responses will be as fast as possible. So in that case I would set up a local https server with some code behind it to handle the Echo requests that come in, correct? - If I host on a server in my home, I do not have a FQDN, but I have a DDNS reference to my IP. Certificates will be difficult to handle in that case, right?. Is that something I can forego? And for added security, can Echo send requests on a non-standard port #? Any other suggestions or tips would be more than welcome!
If you bought a domain (a few dollars a year) you could set up a DDNS entry for that FQDN to your house. Blocked ports will prevent you from doing it though - I don't believe I was able to use a port other than 443.
1. Yes, you could create your own app and never publish it. I am doing the exact same thing for my ISY-powered house. The Alexa request to your app endpoint even includes a User GUID, so you can verify off of that to doubly-ensure that nobody else could use your endpoint. 2. All Alexa requests come from the Amazon servers, NOT from your Echo directly. So you are going to be leaving your local network no matter what. For my ISY solution, I exposed my ISY to the web via HTTPS only, and my Alexa app runs on AWS Lambda and does a request in to my network to actually do the magic. This will be more annoying for you due to needing to access multiple different controllers inside your network. Therefore it would probably be easiest to run your endpoint in your local network, exposed to the Internet. IF you were going to publish this as an app, you'd have issues because the HTTPS certificate would need to be trusted, but that's not a requirement when your app is in dev mode. 3. I have not tried specifying a port for the app endpoint but I don't see why it wouldn't work!
The SDK is now fully public, and welcome! Home automation is a pretty common request, and several other people have been working on similar solutions, so you're in good company.
For restricting your ASK skill, as long as you do not submit the app for certification, it will only be available on your registered Echos. While it is in testing mode, it does not have to go through our official testing process.
For the endpoint, the easiest way would be if you could host it on your own network, as you can directly access the home automation devices without having to create a tunnel between a remote endpoint and your local network. This also makes security concerns less of an issue.
Certificates will probably the more difficult part of this setup. If you can get a self-signed wilcard cert for your DDNS reference, that should work, as long as the app is only for you and is only ever in testing node. There is no way to forgo the encryption and certificates, and all requests must be on the standard ports.