Monday, 12 December 2016

Yesterday I built an Amazon Echo 'Skill' for E2B

I was asked by my family what I wanted for Christmas recently. As I was considering buying an Amazon Echo for myself, I suggested that I could order one for them to give to me.

It arrived a few days ago and like a naughty child, I opened my XMas present early and I have since been talking to 'Alexa' - with varying degrees of success (and frustration)!

I saw a video on YouTube about how to create a 'Skill' for the Amazon Echo (equivalent of a mobile phone app) and so yesterday, I decided to have a go.

I won't describe how I did it in detail, because there are many videos and other tutorials around which tell you how to do it.

I decided to try a simple Skill for Easy2Boot: e.g.

"Alexa, ask Easy2Boot Helper how to add ubuntu"

Here is how I got on...

I used this MineCraft github 'recipe' sample to base my Skill on, which contains useful 'quick recipe' instructions.

The instructions said to skip the blueprint, but you have to choose a blank template as there is no 'skip' option. Some of the other instructions seemed to be a bit out of date/different too.

The first pitfall was that you needed to select the correct country and region for the Lambda Services server. The instructions said to select us-east but it did not say which region. I seemed to have selected us-east Ohio, but it didn't work at all - Echo could not find the Skill after I had made it! Then I read that only us-east N. Virginia worked. I had to re-make the whole thing again because you cannot simply change the region (I guess it is built on a different cloud server?).

Anyway, this also didn't work! I read some more and found that another valid supported server was eu-Ireland for the UK (I think that a German server is now working too?). Anyway, after re-uploading the code to the eu-Ireland server, at last my Amazon Echo enabled the Skill and started to work! I guess each server will 'serve' a particular region because it needs to understand the language. This explains why many US Skills don't seem to be available in the UK - they haven't uploaded them to the Amazon UK server yet or changed them for the UK locale.

It is still early days yet, but I can now ask Alexa how to add ubuntu or Hirens to E2B or boot to UEFI, etc. and she will often reply with the correct pre-programmed answer (and often not too!).

In retrospect, I seem to have chosen a difficult subject, because words such as ISO, multiboot, CD, and even Easy2Boot do not get picked up very accurately by Alexa (say 'easy to boot' and she gets it most times!).

Here is a flavour of the minimal javascript code which I am playing with at the moment. If Alexa picks up on any key word ('slot') in the left side, then she will give the response on the right.

module.exports = {
"hirens": "To add a hirens iso file, use a ,dot iso h w file extension, but for full functionality, convert it to a FAT 32, i m g p t n file. ",
  "hirons": "To add a hirens iso file, use a ,dot iso h w file extension, but for full functionality, convert it to a FAT 32, i m g p t n file.",
"windows": "You should add Windows Installer ISO files to the correct sub-folder under the \\ _ISO, \\WINDOWS folder",
"windows installer": "You should add Windows Installer ISO files to the correct sub-folder under the \\ _ISO, \\WINDOWS folder",
"windows installs": "You should add Windows Installer ISO files to the correct sub-folder under the \\ _ISO, \\WINDOWS folder",
"winpe": "You should add Windows p e ISO files to the correct sub-folder under the \\ _ISO, \\WIN p e folder",
"win pe": "You should add Windows p e ISO files to the correct sub-folder under the \\ _ISO, \\WIN p e folder",
"windows iso": "You should add Windows Installer ISO files to the correct sub-folder under the \\ _ISO, \\WINDOWS folder",
"ubuntu": "To add an ubuntu iso, just copy the file to the  \\ _ISO, \\ LINUX  folder.",
"gandalf": "To add a gandalf iso, convert it to an i m g p t n, file and copy it to the \\ _ISO, \\WIN P E  folder. actually any standard menu folder will do.",
"winhelper": "If you are booting from Windows ISO files and your USB drive is a Fixed Disk type, you will need to make a Winhelper USB flash drive or convert each ISO to a FAT 32 i m g p t n file.",
"uefi": "for u e f i booting, you will need to convert each ISO to a FAT 32, i m g p t n file. The payload must contain the correct U E F I boot files",
"efi": "for u e f i booting, you will need to convert each ISO to a FAT 32, i m g p t n file. The payload must contain the correct U E F I boot files"
};

I did find that the particular code I am using always requires lower-case slot values (e.g. gandalf, not Gandalf), and that using the suggested test code such as <say-as interpret-as="spell-out">hello</say-as> does not seem to work when used in .js files (no doubt there is a way to make it work?).

I guess I have some more reading to do!

The web developer interface is still a bit clunky. For instance, you cannot directly edit some of the .js files 'in-line' over the web, you can only edit the index.js code 'in-line'. So you have to keep a local copy of your other javascript files, edit them, convert them to a .zip file and then upload it to the server each time you make a change in the code to any one of them!

Some code you have to cut and paste into the web forms and you cannot simply upload them.

Also, if you added a file which you no longer need, I can't see any way to delete it from the server...

Custom .js files need to be uploaded in .zip form each time.

There are multiple values for the Slot Types in a list (LIST_OF_ITEMS) which need to contain the slot value. This has to be updated whenever a new value is added, as well as using the same value in the .js lookup code file (blue code at top of this page).

Here you can edit the slot values list(s) and specify example utterances that Alexa will accept.

Anyway, it's pretty cool to be able to ask Alexa how to add ubuntu to Easy2Boot and have her tell me the answer!
video


Useful Links

Jordan Leigh YTube video here.
6-part YTube video here.
Alexa Developers site here.
Amazon Web Services here.
Sample Skills are here - reindeer Games is a typical question and answer quiz game (with PDF containing full instructions)
Full example (July 2016 for USA) here

P.S. Please don't ask me to publish the Skill so you can try it. It is only a dev-test example and probably will never get completed!