Search code examples
actions-on-googlegoogle-homegoogle-smart-home

How to write a response message when first command succeeded and second command failed on same EXECUTE intent


I cannot understand how to write a response like following situation.

Precondition

  • AC_UNIT supports TEMPERATURE_SETTING traits.
  • AC_UNIT's availableThermostatMode is "off,on,heat,cool"
  • AC_UNIT's current mode is cool.

When I do a "Set the heat to {temperature}", google send like a following message.

How to write a response when ThermostatSetMode command succeeds and ThermostatTemperatureSetPoint failed?

Am I not able to write a response which contains each commands result?

{
  "inputs": [
    {
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "id": "device id"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.ThermostatSetMode",
                "params": {
                  "thermostatMode": "heat"
                }
              },
              {
                "command": "action.devices.commands.ThermostatTemperatureSetpoint",
                "params": {
                  "thermostatTemperatureSetpoint": 32 // this is out of range value.
                }
              }
            ]
          }
        ]
      }
    }
  ],
  "requestId": "requestId"
}

Thanks.


Solution

  • There's not a way to specify the response on a per-command basis, just on the device level. In this case, your best bet would be to return an error in the response with valueOutOfRange which will alert the user.