actions-on-googlegoogle-homegoogle-smart-home

Issues with Google Assistant's Response to 'Turn On All Devices' When 'FAILED' Status is Sent


I'm encountering an issue with Google Assistant when I request to "turn on all devices." Even when I send a "FAILED" status for some devices, Google Assistant responds with "Ok, turning on x things" without any indication of the failure. Here's the JSON response I'm sending for the action.devices.EXECUTE action:

{
    "requestId": "617XXX27787XXX16813",
    "payload": {
        "devices": {
            "1081614XXX": {
                "on": false,
                "online": true,
                "status": "SUCCESS"
            },
            // ... (other device entries)
            "4153991XXX": {
                "on": false,
                "online": true,
                "status": "FAILED"
            }
        }
    }
}

Here's an overview of how my system works:

  1. I issue a command to Google Assistant to turn devices on/off.
  2. Google Assistant triggers my Lambda function.
  3. My Lambda function processes the request and calls backend APIs. It processes as many requests/devices as possible within 4 seconds. After 4 seconds, it sends a "FAILED" status for any remaining devices and "PENDING" for devices with a 202 HTTP Status Code. This is done to respond to Google Home within the 5-second time limit.

I have several questions:

  1. Does Google Assistant provide a negative response for devices with a "FAILED" status, such as "Unable to turn on/off device"? I'm not receiving such responses.

  2. I tried actuating a single device with a default status of "PENDING" and "FAILED," but I still received the same response ("Ok, turning on the <name of the device>"). Why is this happening?

  3. Is there anything I might be missing in the response I'm sending to Google Assistant?

I'm facing a challenge when I have more than 20 devices to process within the 5-second time limit. Currently, I'm sending "PENDING" for devices with successful actuation but which take time. Is there a better approach to handle this issue without sending "FAILED"?

I appreciate any insights or suggestions to improve this situation. Thank you!


Solution

  • The issue was with the status key itself, it should have been ERROR and not FAILED.

    Here's an example:

    {
        "requestId": "617XXX27787XXX16813",
        "payload": {
            "devices": {
                "1081614XXX": {
                    "on": false,
                    "online": true,
                    "status": "SUCCESS"
                },
                // ... (other device entries)
                "4153991XXX": {
                    "on": false,
                    "online": true,
                    "status": "ERROR",
                    "errorCode": "Timeout"
                }
            }
        }
    }