Close

Native Alexa Skill complete, files on GitHub. Should I have used IFTTT?

A project log for Particle Photon Wi-Fi and Cap-Touch Light Switch

"switchMo" Project will include Schematic, PCB Files, Firmware, 3D Printable Enclosure, Android App, iPhone App, Alexa Skill, Documentation

joe-menardJoe Menard 06/15/2017 at 22:110 Comments

Since I am using the Particle Photon, one of the freebie possibilities for connections is to use the integration between Alexa, IFTTT and Particle to simply create an IFTTT recipe and be done with it. But I wanted to know how to write a native Alexa Skill so did it that way. All the files (Lambda function, intentsSchema, sample utterances, and slots) are up on GitHub. Below is a short demo of the working Alexa Skill:

So, what did it take to create a native Alexa skill, using JavaScript, to communicate with the Photon on the Wall Switch? Was there a benefit?

To learn enough to do the Skill, it took about 15 hours of noodling around watching YouTube videos, perusing Amazon instructional pages (there are lots), and getting familiar with both the Amazon Developer Alexa Skills creation site and the Amazon Lambda function sites. On the developer site, you create a JSON model of user interaction with Alexa. And on Lambda, running in Amazon’s cloud, you create a function to do the work based on what Alexa asks for. Many of you with more software experience probably would take less time than I. I chose to use JavaScript but you could use Python of Java if so inclined.

I am not an experienced programmer, and know JavaScript at a level between beginner and intermediate from previously developing a web page. In another 15-20 hours or so (again, if you know JavaScript and doing POSTs and GETs in JavaScript, it might take you far less) I got things coded, debugged, and added a minor enhancement (added gate control capability), and most importantly, working.

Was it worth it? Instead of saying “Alexa Trigger blah blah blah …” as you would with IFTTT, I say “Alexa ask Ranch to turn on the garage lights” (Ranch is what we call our house even though it isn’t one). No biggie there. But the native skill has a “help” system making it easy for guests to use. In the future, I will likely have a much easier time customizing it (“Alexa, ask Ranch to turn on all exterior lights now and turn them off at midnight” would just be another function in Lambda). And because a GET can also be used, status can be gathered and potentially recorded. If in the future I choose to switch to a non-IFTTT-integrated device, or even away from a Particle Photon, I already have a great start. So I am glad I did this.

That said … if you are just looking for a wam-bam quick solution, Alexa/IFTTT/Particle may be the way to go.

The code for the working skill, and intents JSON, sample utterances, and slots can be seen on GitHub.

Once last thing … this is my first experience with an Echo. She is great a lot of the time but sometimes seems hard of hearing – the alexa.amazon.com site allows you to see what Alexa heard and either my voice is too raspy, she needs training, or I need to pick very different location names. One can get tired of hearing “I do not know that switch location”.

Discussions