Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

Building Smart Home skills for Alexa

292 Aufrufe

Veröffentlicht am

The most common way to start developing for Alexa is with custom skills while not too many of us except for device manufacturers get in touch with Smart Home skills on Alexa. This session introduces and demonstrates the power of Smart Home skills and it takes a look behind the technical scene of what happens in between an “Alexa, turn on the lights” and Alexa´s final “Ok” confirmation. Once you are familiar with the concept of Smart Home skills you will find out that it’s not just for implementing large-scale Smart Home solutions as the Smart Home API is also a great playground for your next Do it Yourself project. At the end of this session you’ve learned about the probably simplest way to build a Smart Home project with Raspberry Pi and AWS IoT – and you will be equipped with essential knowledge on how to build your own voice-controlled “thing”.

Veröffentlicht in: Technologie
  • Als Erste(r) kommentieren

Building Smart Home skills for Alexa

  1. 1. © 2018, Amazon Alexa, All rights reserved. Kay Lerch, EU Head of Solutions Architecture, Alexa Smart Home, Amazon, @kaylerch October 19th, 2018 Building Smart Home Skills for Alexa Alexa Smart Home
  2. 2. Agenda Alexa Skills Kit Alexa Smart Home Skills Alexa Smart Home API Demonstration
  3. 3. Alexa Skills Kit
  4. 4. Alexa Skills Skills represent the interaction capabilities of Alexa Answering questions Providing news and weather information Playing music Playing puzzles or games Control lights and other devices in the home Viewing smart home camera feeds Checking the status of orders ... Plus many others … Visit alexa.amazon.com and review the skills available
  5. 5. Types of Alexa Skills Custom Skills Smart Home Skills Flash Briefing Skills Video Skills List Skills For crafting unique game or app experiences For providing flash briefing content For providing video playback of content For using and maintaining lists For controlling a smart home and devices
  6. 6. Alexa Skills Kit The Alexa Skills Kit (ASK) lets you teach Alexa new skills It contains the documentation, tools, and sample code needed to build Alexa skills Documentation https://developer.amazon.com/docs/ask-overviews/build-skills-with-the-alexa-skills-kit.html Tools ASK CLI https://developer.amazon.com/docs/smapi/quick-start-alexa-skills-kit-command-line-interface.html Sample Code https://github.com/alexa https://github.com/alexa/alexa-smarthome
  7. 7. Alexa Frameworks
  8. 8. Alexa Skills Kit
  9. 9. Alexa Skills Kit: Signal Processing
  10. 10. Alexa Skills Kit: Utterances into Intents Text to Speech SSML, streaming audio
  11. 11. Alexa Smart Home Skills
  12. 12. What can an Alexa Smart Home Skill do? Turn lights on and off Turn a switch on or off Change the brightness of dimmable lights Change the color or color temperature of a tunable light Change the temperature on a thermostat Lock a lock Query a lock to see if it is currently locked Ask for a smart home camera feed Change the volume on a speaker Change the channel of a TV … and many more https://developer.amazon.com/docs/device-apis/list-of-interfaces.html
  13. 13. Alexa Smart Home Skills Alexa Smart Home Skills are a type of skill designed to control home automation devices Smart Home Skills have common invocation commands to control lights, switches, locks, TVs, cameras, fans, thermostats and other devices Smart Home Skills have a section in the Alexa application for configuration, control, and status of devices Customers link their account through the Alexa application with a device cloud and the devices associated with that account Usually have their own device cloud for tracking external user/device mappings https://developer.amazon.com/docs/smarthome/understand-the-smart-home-skill-api.html
  14. 14. Alexa Skills Kit: Smart Home Skills Text to Speech SSML, streaming audio Golden Utterances Directives, Controllers Capabilities, Device State Your Lambda
  15. 15. Alexa Smart Home API
  16. 16. Messages Information exchanged between Alexa and a Skill is done through Messages Directive A type of message from Alexa to a Skill Alexa sends directive messages to a skill on behalf of the customer Event A type of message from a Skill to Alexa A skill responds to directives with event messages
  17. 17. Message Structure A Message is JSON formatted content consisting of a Header, Endpoint, Payload and optional Context sections Header Provides identifying information about the message Endpoint Identifies a directive target and event origin Payload Message content that varies by the type of capability Context Allows state reporting from any event message
  18. 18. Directive { "directive": { "header": {}, "endpoint": {}, "payload": {} } } Message Structure Example Event { "context":{ "properties":[] }, "event":{ "header":{}, "endpoint":{}, "payload":{} } } https://github.com/alexa/alexa-smarthome/tree/master/sample_messages
  19. 19. Alexa Smart Home Skill API Account Linking
  20. 20. Account Linking Account linking "links" a User Smart Home Skill to a device cloud User credentials are provided and authenticated when a smart home skill is enabled Alexa sends the User credentials as a bearer token in the directive scope That token is used to validate the User with your system Device Cloud provider is responsible for securely storing the Access and Refresh Tokens Account linking is required for a smart home skill Account Linking Flow 1. User enables a Smart Home Skill in the Alexa application 2. User authenticates and links their account with a device cloud 3. User then discovers devices associated with that account and device cloud 4. The linked credentials can be used for sending asynchronous messages to Alexa
  21. 21. Smart Home API - Authorization
  22. 22. Smart Home Skill Account Linking Flow 1. User Enable and Account Link my Partner Skill 2. Alexa Redirect the User to the Partner authorization 3. Authorizer Validate the User credentials and return an Access Token to Alexa 4. User Commands: Alexa, turn on Light 5. Alexa Asks Partner to use the provided Access Token to turn on the Light 6. Authorizer Validates the Access Token and turns on the Light
  23. 23. Alexa Smart Home Skill API Device Discovery
  24. 24. Capabilities Capability interfaces describe the functional capabilities of an endpoint The interfaces are composed of functional primitives that allow generic commands to be used for different types of endpoints For a full reference, see the Smart Home Skill API Message Reference https://developer.amazon.com/docs/smarthome/smart-home-skill-api-message-reference.html
  25. 25. Smart Home API - Discovery “discover my smart devices” Capabilities Controllers Directive
  26. 26. Capability Interface Examples Interface Capability Alexa.PowerController Turning on or off Alexa.ChannelController Change, increment, and report the channel Alexa.PercentageController Sets a percentage (Percentage, Intensity, Speed, etc.) Alexa.ColorController Change and report the color (Hue, Saturation, Brightness) Alexa.PlaybackController Control playback (Play, Pause, Rewind, etc.) Alexa.ThermostatController Set a temperature or point or range
  27. 27. Capability Interface Examples Thermostats Home Audio Small Appliances Large Appliances Home Security TV / Video Alexa.InputController Alexa.StepSpeaker Alexa.Speaker Alexa.ChannelController Alexa.PowerController Alexa.ThermostatController Alexa.TemperatureController Alexa.LockController Alexa.PowerController Alexa.TemperatureController Alexa.PowerLevelController Alexa.TemperatureController
  28. 28. Capability Interface Examples: What is Next? Possible Capability Interfaces Alexa.BrightnessController Alexa.CameraStreamController Alexa.ChannelController Alexa.InputController Alexa.PlaybackController Alexa.PowerController Alexa.Speaker Alexa.StepSpeaker Alexa.ThermostatController Super Console 3000 Imagine a prototype device that is packed with all sorts of functionality Display Speakers Camera Thermostat
  29. 29. Alexa Smart Home Skill API Device controls
  30. 30. Smart Home API – Control action “turn on my living room light” Directive Controller Device State
  31. 31. Synchronous/Asynchronous Messaging A directive response event can be either synchronous or asynchronous A synchronous response must be handled in 8 seconds or less An asynchronous response is used for some slower interface operations For example, a DeferredResponse is supported by the LockController interface
  32. 32. Smart Home API – Control action “set living room light to green” Directive Controller Device State
  33. 33. Alexa Smart Home Skill API Device state management
  34. 34. Smart Home API – State updates matter …
  35. 35. Smart Home API – But what if …
  36. 36. Smart Home API – Proactively reporting state Alexa Event Gateway
  37. 37. Smart Home API – Reactively reporting state Alexa Cloud
  38. 38. Smart Home API – Configure state updates Device proactively reports state updates Device responds to state report requests
  39. 39. Reporting State Device State Change Notifications Event messages are used to provide proactive state updates to Alexa Changes in state can be reported during normal responses via the context in a Response Endpoints can be asked by Alexa to report state directly from a ReportState directive State changes can also be reported asynchronously through the Alexa Event Gateway via a ChangeReport For example, if a switch is manually turned off by a user, the device cloud controlling the switch can send a message to Alexa that will update the representation of the device to the user
  40. 40. Smart Home API – End to End
  41. 41. Smart Home Skills vs Custom Skills Smart Home API Common Directives Users have easier, common invocation commands: "Alexa, lock the front door." vs "Alexa, tell {skill} to lock the front door." "Alexa, show me the backyard camera." vs "Alexa, ask {skill} to show me the backyard" Users don't have to remember custom skill invocation names Developers have less control over the user experience but also do not have to craft the interaction model Endpoint directives map to the capability interface defined in the namespace Alexa.PowerController: "Alexa, turn on office light" Alexa.ThermostatController: "Alexa, set thermostat to 20" Alexa.ColorController: "Alexa, set the kitchen light to orange" … https://www.amazon.com/gp/help/customer/display.html/ref=hp_left_v4_sib?ie=UTF8&nodeId=201749260
  42. 42. Demonstration
  43. 43. Resources Smart Home Portal https://alexa.design/smarthome Smart Home Code https://github.com/alexa/alexa-smarthome https://github.com/alexa/alexa-smarthome/wiki Developer Slack Channel https://alexasmarthome.slack.com Invite Link: https://alexa.design/smarthome-invite-slack Legacy Smart Home API V2 Reference https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/archive/shv2- understanding-the-smart-home-skill-api