Alexa, I’m cold!aws-de-media.s3. · PDF file AWS Pop-up Loft & Innovation Lab...

Click here to load reader

  • date post

    22-Aug-2020
  • Category

    Documents

  • view

    0
  • download

    0

Embed Size (px)

Transcript of Alexa, I’m cold!aws-de-media.s3. · PDF file AWS Pop-up Loft & Innovation Lab...

  • AWS Pop-up Loft & Innovation Lab München November 14th 2016 Timo Müller (@elmiOne)

    Alexa, I’m cold! Developing a Smart Home Skill for tado°

  • tado°

    Control from anywhere Smart Schedule Location-based heating control

  • Smart Home Skill API

  • Smart Home Skill Setup

    Link Discover Command

  • Linking user accounts

  • “Alexa, discover my devices”

    Alexa Skill Adapter

    λ

    Home

    Image: https://www.amazon.de/Amazon-SK705DI-Echo-Schwarz

  • Basic Commands

    Thermostats Lights

    Image: https://www.flickr.com/photos/ume-y/75917384, CC-SA 2.0 Some rights reserved by ume-y

    https://www.flickr.com/photos/ume-y/75917384 https://creativecommons.org/licenses/by/2.0/ https://www.flickr.com/photos/ume-y/ https://creativecommons.org/licenses/by/2.0/

  • Basic Message Format

    Header

    Payload

    "header": { "messageId": "6d6d6e14-8aee-473e-8c24-0d31ff9c17a2", "name": "SetTargetTemperatureRequest", "namespace": "Alexa.ConnectedHome.Control", "payloadVersion": "2" }

  • Basic Message Format

    Header

    Payload

    "payload": { "accessToken": "", "appliance": { "additionalApplianceDetails": { "customDetail1": "...", ... }, "applianceId": "" }, "targetTemperature": { "value": } }

  • Device Discovery

    "accessToken": ""

    Appliance "Living Room"

    DiscoverAppliancesRequest DiscoverAppliancesResponse

    Appliance "Kitchen"

    Appliance "Bedroom"

    Appliance "Bathroom"

    More Appliances

  • Appliance

    "applianceId": "1", "friendlyName": "Bedroom", "friendlyDescription": "tado° Smart Thermostat",

    "actions": [ "incrementTargetTemperature", "decrementTargetTemperature", "setTargetTemperature" ],

    "isReachable": true, "manufacturerName": "tado", "modelName": "Smart Thermostat", "version": "1",

    "additionalApplianceDetails": { "homeId": "12345", "zoneType": "Heating" }

  • Scenes

    “Alexa, turn on bedtime”

    ● “Fake” appliance that can be turned on or off

    ● Can perform multiple actions ● Defined in the “device cloud”

  • tado° Smart Home Skill

  • Under the hood

    Java 8 Libraries

    ● AWS Lambda Core ● Google Guava ● Google Gson

    API Client

    ● Swagger API Specification ● Generated Retrofit API Client ● Apache Oltu ● Google Gson

    Persistence

    ● Dynamo DB

    Logging

    ● ElasticSearch and Kibana

  • “Alexa, set the temperature to 25 degrees”

    "accessToken": "", "appliance": { "applianceId": "1", "additionalApplianceDetails": { "homeId": "12345", "zoneType": "Heating" } }, "targetTemperature": { "value": 25.0 }

    SetTargetTemperatureRequest

    λ

  • “Alexa, set the temperature to 25 degrees”

    Request

    λ Start manual control

    Retrieve current state

  • “Alexa, set the temperature to 25 degrees”

    Request

    λ"targetTemperature": { "value":25.0 },

    "temperatureMode": {

    "value":"HEAT"

    },

    "previousState": {

    "targetTemperature": { "value":21.0 },

    "mode": { "value":"HEAT" }

    }

    Confirmation

  • Handling a request

    public class AlexaSmartHome implements RequestStreamHandler {

    @Override

    public void handleRequest(InputStream input, OutputStream output, Context context)

    throws IOException {

    final Gson gson = new Gson();

    final BufferedReader reader = new BufferedReader(new InputStreamReader(input));

    CatchAllRequest request = gson.fromJson(reader, CatchAllRequest.class);

    String requestName = request.getHeader().getName();

    RequestHandler handler = getRequestHandler(request, context, requestName);

    String response = handler.handleRequest();

    output.write(response.getBytes("UTF-8"));

    }

    }

  • Error Messages

    User Faults

    The request cannot be fulfilled due to issues with content in the

    request

    Skill Adapter Faults Other Faults

    The request is invalid due to a customer error

    The request is valid but the skill adapter cannot complete the required task because of a

    hardware issue or limitation

  • “Alexa, set the temperature to 80 degrees”

    "accessToken": "", "appliance": { "applianceId": "1", "additionalApplianceDetails": { "homeId": "12345", "zoneType": "Heating" } }, "targetTemperature": { "value": 80.0 }

    "minimumValue": 5.0,

    "maximumValue": 25.0

    SetTargetTemperatureRequest ValueOutOfRangeError

  • Boost Mode Implementing a simple scene

  • Request

    λ

    Timeout

    Response

    Lambda Cold Starts

  • Lambda Cold Starts

    Keeping the Lambda warm

    ● Regular CloudWatch Event ● Regular Discovery Request

    Speeding up the initial launch

    ● Increase available Memory ● Decrease size of JAR

    Image: https://www.flickr.com/photos/woodhead/16208577766/, CC-SA 2.0 Some rights reserved by woodhead

    https://www.flickr.com/photos/woodhead/16208577766/ https://creativecommons.org/licenses/by/2.0/ https://www.flickr.com/photos/woodhead/ https://creativecommons.org/licenses/by/2.0/

  • Lessons learned

    Temperature Unit Error Handling Smart Home Java SDK

  • Smart Home API Wishlist

    “Alexa, what’s the current temperature in the kitchen”

    “Alexa, set the living room to 23.5° for two hours”

    “Alexa, I’m cold”

  • tado° GmbH | Lindwurmstr. 76 | 80337 München

    www.tado.com