0

I want to know how to give multiple commands in "action.devices.EXECUTE" intent. This is to create an api to control fanspeed through google assistance.

I have tried the below code as request from postman, wanted to know whether this is in proper format.

{
    "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf",
    "inputs": [{
        "intent": "action.devices.EXECUTE",
    "payload": {
    "commands": [{
        "devices": [{
            "id": "5b0ef601a31d587588619851-newton-excited-51a284132eae42ba",
            "customData": {
            "fooValue": 74,
            "barValue": true,
            "bazValue": "lambtwirl"
          }
    }],
 "execution": [{
      "command": "action.devices.commands.OnOff",
      "params": {
        "on": true
      }
    },
    {
      "command": "action.devices.commands.SetFanSpeed",
      "params": {
        "fanSpeed": "s2"
      }
    }]
}]
}
}]
}
}

Here is the code

1 Answers1

0

Within the Google Home ecosystem, Google sends you the execution intent requests based on the user voice commands, and your project responds with an execution response. You can learn more about the process through our docs: https://developers.google.com/assistant/smarthome/reference/intent/execute?hl=en

At the moment Smart Home doesn't allow two commands in a single prompt, For example, you cannot say "Hey Google, turn on my light and change the color". In order to do that you have to execute each command separately.

However, you can proactively change multiple states of a device and let Google know through the report state API. You can learn more at https://developers.google.com/assistant/smarthome/develop/report-state

Anish Yadav
  • 141
  • 4