Amazon ALEXA Lists Exercise – Put’em on Paper…

3. Solution Architecture

As you can see, Amazon provides two „built-in“ lists for each customer account, the shopping list and the todo-list. You can instruct the system to put items on these lists by speaking into your echo device or by using the ALEXA App interface. Each of the lists is capable of storing up to 100 items and each item may have a text string value of up to 256 unicode characters.

Funny for the German version: it’s enough to say „ALEXA, setze <item>“, meaning „ALEXA, put <item>“. You don’t need the „on my shopping list“, it’s the default.

3.1 List Management

The Architecture for described functionality is very simple and shown in the following picture:

Important to know is that for now the Echo interface is fairly limited: only adding items to an existing list and a readout of an existing list is supported.

With the ALEXA App, you can additionally modify and delete items on these two lists and create completely different lists as well. Note that we need the App once to grant our printer custom skill the necessary access rights to read and write the lists in our account, more on that later.

3.2 List Printing

Here’s where things get interesting. Obviously, somehow the list entries need to get to our printer. We’re going to use a RasPi as print server containing the USB thermal printer driver and some sort of edge server that proxies ALEXAs print requests from the Internet into our internal print server at home. I’m against exposing a tiny RasPi to the Internet, even with a firewall in between, hence this work-around.

If you don’t care about security, just merge the functionality from Edge server script and RasPi print server into one script.

The process is very simple and straight forward:

  1. User speaks the command to print the list, optionally with a flag to keep it (and not empty after print). This is covered by a simple dialog model of a Custom skill.
  2. The custom skill invokes a Lambda glue code function (GCF).
  3. GCF determines which list is to be printed and looks up any items on it from ALEXA backend.
  4. In case one or more items are found, GCF tries to contact the edge server via https and deliver a) the list name („Shopping List“) and b) the elements („tomatoes“, …) as JSON list to the edge server script. A rudimentary common secret and https are used for security.
  5. Edge server contacts print server with the same arguments („pipe-through“).
  6. Print server does sanity checks, prints the list and returns status to edge server.
  7. Edge server in turn returns status to GCF.
  8. GCF optionally empties printed list.
  9. GCF constructs a suitable ALEXA voice response and returns this to the custom skill.
  10. Custom skill reads voice response through Echo device.

4 Kommentare zu “Amazon ALEXA Lists Exercise – Put’em on Paper…”

1.   Kommentar von Tom
Erstellt am 09. Dezember 2018 um 22:40 Uhr.

Hi,
great post.
Could please tell which thermal printer you have used?
The amazon link isnt‘ working anymore.
Thanks

2.   Kommentar von McSeven
Erstellt am 10. Dezember 2018 um 20:27 Uhr.

hi, Thanks. The one I used isn’t available on Amazon anymore, but any USB receipt printer should work… Just look for what mike24’s ESC/POS library is supporting and buy one of those models… Best, Christoph

3.   Kommentar von Tom
Erstellt am 11. Dezember 2018 um 20:53 Uhr.

Thanks for the reply. This product list on github helps a lot.
One further question: Could you really delete the original shopping list with the skill? In your video you use the original „Einkaufsliste“ so you could also delete this one per API? In your code for the lambda it is „shopping list“ and not the original code snipped?

Danke und Gruß
Tom

4.   Kommentar von McSeven
Erstellt am 12. Dezember 2018 um 20:23 Uhr.

hi, well, the Einkaufsliste is used by the ALEXA language model. it translates into „shopping list“ in the skill. Therefore the difference… Cheers.

Einen Kommentar hinterlassen