Showing posts with label amazon alexa. Show all posts
Showing posts with label amazon alexa. Show all posts

Thursday, February 4, 2016

first look at the sdk for amazon alexa

Yesterday was all about the existing capabilities of the Amazon Alexa and I ended with an enthusiastic task of reviewing the sdk (software development kit).



It wasn't half bad - and by the end of the day I had delivered the code to my Alexa and had her asking us all what our favorite color was.

Here's how I accomplished that ...

Here's the getting started guide. I started poking around the information.

First, I signed up to watch the on-demand webinar on the ASK (Alexa Skills Kit). It was about an hour long and well worth it. Each capability is called a skill - and you are really just giving Alexa a new skill.

The information is transmitted via REST so either you have you own secured web service (which I do not) then it's best to use Amazon web service. I was able to sign up and get a whole year of free usage. AWS Lambda made it easy to get up and running even providing some templates (or blueprints) giving you sample code with work with.


It's really just javascript functions that parses json data. You have help methods such as onSessionStarted, onSessionEnded, onIntent and onLaunch.

Next you need an account on the developer portal for Amazon. You can set this up here. This is where you'll define the skill and point it to the REST api (where it sits in the cloud). This is also where the utterances and intents (schemas and possible key phrases) are stored.



So in the sample of favorite color - the color schema is defined with an Intent:
 "intent": "MyColorIsIntent"
"slots": [
        {
          "name": "Color",
          "type": "LIST_OF_COLORS"
        }
      ]

The slot would be defined LIST_OF_COLORS: green, red, blue, orange, gold, silver, yellow, black, white. So, the array of colors is a slot.



And Utterances would be anything the user could say ...

WhatsMyColorIntent what's my favorite color
WhatsMyColorIntent what is my favorite color
WhatsMyColorIntent what's my color
WhatsMyColorIntent what is my color
WhatsMyColorIntent my color
WhatsMyColorIntent my favorite color
WhatsMyColorIntent get my color
WhatsMyColorIntent get my favorite color
WhatsMyColorIntent give me my favorite color
WhatsMyColorIntent give me my color
WhatsMyColorIntent what my color is
WhatsMyColorIntent what my favorite color is

Things I struggled with ...

I was only interested in getting my sample code to test properly. Right now I'm only interested in publishing to my Alexa - and not to the entire Alexa world. That was one thing not immediately apparent to me - how to "test" on my own device. 

Turns out as long as you have the same login on the developer console in Amazon as what you configured your Alexa works - it's magical when you "test". It's one of the steps identified in the Alexa app console (skill information, interaction model, and test).

I also struggled in AWS Lambda was picking the right test event. Initially I just picked the default - of course would fail. So pick the correct Sample Event Template.

Also, make sure you pick US East (N. Virigina) has your region to even see the Lambda functions.

This article was really helpful too. http://tobuildsomething.com/2015/08/14/Amazon-Echo-Alexa-Tutorial-The-Definitive-Guide-to-Coding-an-Alexa-Skill/

My next move ...

Here's what I want to do now. Take my "Mom I'm home" idea and expand it. Currently it's using IFTTT to send me a text when Holly triggers her.

I would like Holly to be able to walk in the door and say "Alexa? Tell Mom I'm home. Alexa would respond with "Will do Holly. How was your day?" Holly would say "Good" or "Bad". Alexa would text me with "Holly is home and had a good (or bad) day.

Never something I would put into the App Services - only used by us. So now I'm looking at integrating with Amazons SNS service which will allow the text messaging.

Wednesday, February 3, 2016

what i got for Christmas - amazon echo

My kids surprised me this year at Christmas. I mean ... really surprised me. I admit, I'm really hard to buy gifts for because I'm at a stage in my life that if I want something - I just buy it. It doesn't leave them much to choose from.

Amazon's picture


They do know me - and they know I'm a maker. I love technology and anything I can make with my hands (software, photography, painting, furniture, sewing). I earn a living with technology - so that's always a good bet.

Burke opened the Christmas gift and it was an Amazon Echo. I admit, I was only mildly enthusiastic about the gift. I had "heard" of the Echo - but really no idea what it was. I figured it was a stand alone "Siri". It looked cool though.

As soon as the holidays died down, I plugged it in and started playing with it. It was super quick to setup - I hardly remember doing it. I did download the app on my Android phone and connected it to the our home WiFi. The effort to set it up was very minimal.

The first thing I wanted to do was change her name. I was not thrilled with the name, but found that I could not rename her. Not really .... I could choose either Amazon or Alexa. So Alexa it is.

After quickly reading about the capability, we started shouting commands at Alexa.
Alexa? What's the news?
Alexa? What's the weather? 
Alexa? What is the square root of thirty seven hundred?
Alexa? What do I do with a dead body? - She responsed "Call the police."
Alexa? Self-destruct. - My son commanded and was instantly dumbfounded as she began to count backwards. He squeaked out - Alexa? Cancel. She responds with OK - just kidding! We all roared with laughter. Amazing! 
A little more reading ...
Alexa? Add ketchup to my shopping list. - We use this all the time now. All items magically appear in the Alexa app on my phone. You can also ask her to recite the shopping list before going to the store.
Alexa? Play Happy birthday to you from Amazon Prime. I do like the choices of music available.
Alexa? Play FM Radio - 107.1 
A Google search later ...

 This article really opened my eyes http://www.wired.com/2015/11/amazon-echo-gift/ and specifcally the mention of IFTTT. Wot is this magic? So I played ...



I immediately found a recipe for finding my phone. Alexa? Trigger find my phone. It rings my phone and leaves me a voice message stating the datetime that Alexa tried to find my phone. I've already had to use this when I dropped my phone in Burke's car and couldn't find it.

Interesting ..... what else can I do?

Every day Holly sends me a text when she's safely at home. She used to call me - but the guys at work would troll in on her phone calls. Holly? Did you let your dog out? How about your homework? So, now it's a simple text.



What if? She just told Alexa to let me know she was home. Using IFTTT, I created a recipe of Amazon Alexa channel, a phrase, and a SMS channel - would text me "Mom I'm home". Now, when she walks in the door, she tells Alexa she's home and Alexa alerts me. Effortlessly.

How about dinner then?

Both Holly and Eileen's room are upstairs out of ear shot. So news of dinner is sent via text or going upstairs to each teenager to alert dinner.



Now Alexa informs the girls that dinner is done. Alexa? Trigger Dinner is ready. Using the the Amazon Alexa channel, a specific phrase, and GroupMe  allows Alexa to send text to more than 1 recipient.

Silly I know - but we now rely on Alexa to communicate important events in our family.

What else?

I started reading about the smart home. Using IFTTT, Alexa could interface with smart house items. Hmmmm..... but what in my house would I really want to make smart. I reviewed all the technology available and really found that I didn't want my front door, thermostat or have a camera presence. I'm not 100% comfortable. I sometimes act as a cyber security specialist within my company - and I'm well aware that everything is hackable.

As I stated before, we were working on the basement and we purchased an electric fireplace. I was thinking though, "How cool would it be to have Alexa turn on and off the fireplace? Without actually going downstairs?" It's cold in the winter - and it gets cold down in the basement. I could command the fireplace to be on and let it warm up before heading down for crafting.

I did my research and went with the Samsung Smart Things line. All in all - it's a tad more in price but the quality is there and so are the highly rated reviews. So I ordered a Samsung Smart Things outlet at roughly $50. After receiving it, I tried to configure it. I truly was thinking that Alexa would work as the smart hub for the outlet - but alas that was not the case.

I needed the Samsung Smart Things hub too. Alexa could only talk to the outlet through the hub. Cost of the hub? An additional $100. So I weighed whether the having the basement toasty warm before heading down was worth $150 and decided it wasn't. So I sent the outlet back. So ended that experiment.

SamSung Smart Thing Outlet


In the weeks since Christmas, Alexa really has become a personality in our house and often when I ponder the uses - I'm drawn to Burke's mom. Burke's mom is in her 80's and alone a good part of the day. With Alexa's human like responses, would Helen like to have one? And what about safety? I often worry about her falling and not able to receive help. Could a voice command send help quickly? How about a command so she can tell her 7 children and (I lost track of the amount) grandchildren? So far, it hasn't been well accepted - so I'm still left pondering.

I'm still discovering Alexa and found out today that a SDK has been released. Guess what I'm researching now?

So far, the best Christmas gift I ever remember them getting me. Can't wait to discover more.