Week 6 – Alexa Skill – Josh Milkins & Richard Channing

In order to enable more advanced functions and voice commands other than “alexa, turn (on/off) (device_name)” We need to create a custom alexa skill.

This is done by saying a command to alexa which then gets processed by the amazon alexa cloud service through the wifi router. A request is then sent to a heroku app over http (internet), this app then forwards the request from a windows websocket server to a windows socket client on the Node MCU. When the  Node MCU recieves this  request, it will set the requested relay high.

diagram.png

The hardware and circuit diagrams are exactly the same as blog post 5

First I had to setup a heroku app, this gave me a URL that i could paste into the arduino code in order for the app to send requests to the Node MCU.

Picture1.png

Here is the code;

https://create.arduino.cc/editor/JoshMilkins/d2b349d2-9157-470c-a866-3293225cc322/preview

I then needed to build an alexa skill,

first i gave the skill a name and invocation name (lightservice)

The invocation name is what will be said to alexa before asking it a command. For example “alexa, ask lightservice to turn on section one main lights” this is so alexa knows which skill it needs to use to request the command.

Picture6.png

I then need to make an intent which is essentially a command and under the intent i need to type in some sample utterances which is what a person would say to alexa in order to request an action. Mine were “turn on all main lights” and “turn section one main lights on”

Picture7.png

Because there are quite a number of possible commands that could be said to alexa, (6 sections, 2 states & 2 types of light) instead of listing all of these utterances, i can use slots to handle more than one option, they are parameters that get filled in automatically, when a command is given, it will look for the values of the slots and replace the variable words in the utterance’s.

The first slot is the different sections, the options are ‘one’ through to ‘six’  and ‘all’.

The second slot is the state, this is  either ‘on’ or ‘off’.

The third slot is the type of light, this will determine whether it’s a ‘main’ light or ‘wall’ light for that particular section.

By double clicking on a word in the utterance it’ll give you the option to change it to a slot. In this case i changed the word ‘one’ to ‘list_section’ the word ‘main’ to ‘list_type’ and the word ‘on’ to ‘list_state’

Picture2.png

I then need to set an endpoint for the alexa skill. This is HTTPS and uses the heroku URL used in the arduino code.

Picture8.png

The alexa skill is now finished, i just have to save and build it.

The next step is to test the skill using the Alexa skills kit built in alexa simulator. You just type of speak a command through a microphone and it’ll act just as a physical echo would, giving verbal and written feedback as well as the JSON code being input into the echo and output from the echo.

This however is where it failed giving me a ‘I am unable to reach the requested skill’ response and I did not find out how to fix this.

Picture9.png

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s