Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Orestes Carracedo_Google Assistant's Smart Home...

Codemotion
September 24, 2019

Orestes Carracedo_Google Assistant's Smart Home API in practice_Codemotion Madrid 2019

So you've put together a couple of IoT projects, and it'd be pretty cool if you were able to control them with your voice, right? In this deep dive we'll go through all the pieces you'll need to integrate your nifty gadgets with the Google Assistant. We'll showcase a neat demo project: a cute Lego house controlled with your voice or via the Google Home app. We'll start with a light intro to modern IoT prototyping, a simple component architecture for the system, and an we'll take an in-depth look at the Smart Home API integration from Actions on Google

About:
Orestes Carracedo, Co-founder, Software Engineer, Lighthorse Consulting

Full-Stack Developer. Co-funder Lighthorse, Navigo. Consultant, speaker, mentor and community lead. Co-organiser GDG Vigo and the VigoTech.org Community Cluster.

Codemotion

September 24, 2019
Tweet

More Decks by Codemotion

Other Decks in Technology

Transcript

  1. @OrestesCA #CodemotionMadrid19 • Easy to test in isolation • Easy

    to test without Internet curl -X POST http://192.168.43.231/state \ -H 'Content-Type: application/json' \ -d '{ "on": true }' IoT device API Client HTTP
  2. @OrestesCA #CodemotionMadrid19 • • • • • • • •

    • • turn the temperature up set the light color red
  3. @OrestesCA #CodemotionMadrid19 { "devices": [ { "id": "light-one", "type": "action.devices.types.LIGHT",

    "traits": [ "action.devices.traits.OnOff", "action.devices.traits.Brightness", "action.devices.traits.ColorSetting" ], "name": { "name": "RGB LED one", "nicknames": [ "RGB LED one" ] }, "attributes": { "colorModel": "rgb", "commandOnlyColorSetting": true }, ...
  4. @OrestesCA #CodemotionMadrid19 … "intent": "action.devices.EXECUTE", "payload": { "commands": [ {

    "devices": [ { "customData": {}, "id": "light-one" } ], "execution": [ { "command": "action.devices.commands.BrightnessAbsolute", "params": { "brightness": 97 } } ]
  5. @OrestesCA #CodemotionMadrid19 body: { "inputs": [ { "intent": "action.devices.QUERY", "payload":

    { "devices": [ { "id": "light-one" } ] } } ], "requestId": "10851261056524166135" }
  6. @OrestesCA #CodemotionMadrid19 response: { "requestId": "10851261056524166135", "payload": { "agentUserId": "user-123",

    "devices": { "light-one": { "online": true, "on": true, "brightness": 80, "color": { "name": "apricot", "spectrumRGB": 16502449 } } } } }
  7. @OrestesCA #CodemotionMadrid19 API Key curl -X POST \ -H "Content-Type:

    application/json" \ -d "{agent_user_id: \"user-123\"}" \ "https://homegraph.googleapis.com/v1/devices:requestS ync?key=AIzaSyD8CdkTXJhUSQzOeGBf8NxDqFFQq_w6rfE"