0

I have the following problem. When I turn on/off my bulb in Google Home app it sends me EXECUTE request and then QUERY request for state check. That behaviour is okay, but the problem is that Actions on Google project can't parse my QUERY response.

For clarification: I don't have problems with C# JSON parsing and any of similar topics. I have problem with that the Actions on Google can't understand my QUERY response. I reponse in correct format according to Google's docs but in the web console I see that error occurs and I don't know what is wrong.

It shows following error in the Google Cloud Console:

{
  "insertId": "166g06lg15lgekt",
  "jsonPayload": {
      "executionLog": {
          "executionResults": [
              {
                "actionResults": [
                    {
                        "action": {
                            "actionType": "STATE_QUERY"
                        },
                        "device": {
                            "deviceType": "OUTLET"
                        },
                        "status": {
                            "externalDebugString": "JSON payload not an object.",
                            "isSuccess": false,
                            "statusType": "PARTNER_RESPONSE_INVALID_PAYLOAD"
                        }
                    }
                ],
                "executionType": "PARTNER_CLOUD",
                "latencyMsec": "191",
                "requestId": "4734217757620110233"
            }
        ]
    },
    "locale": "en-US"
},
"logName": "projects/smartlightproject-f47f4/logs/assistant_smarthome%2Fassistant_smarthome_logs",
"receiveTimestamp": "2022-07-13T13:23:04.088211105Z",
"resource": {
    "labels": {
        "project_id": "smartlightproject-f47f4"
    },
    "type": "assistant_action_project"
},
"severity": "ERROR",
"timestamp": "2022-07-13T13:23:04.088211105Z"
}

QUERY request which I receive is

{
    "inputs": [
        {
            "intent": "action.devices.QUERY",
            "payload": {
                "devices": [
                    {
                        "customData": {
                            "barValue": true,
                            "bazValue": "foo",
                            "fooValue": 74
                        },
                        "id": "123"
                    }
                ]
            }
        }
    ],
    "requestId": "5460596871498683621"
}

And my response to that QUERY request is

{
    "requestId": "5460596871498683621",
    "payload": {
        "devices": {
            "123": {
                "on": true,
                "online": true
            }
        }
    }
}

I think that everything is as Google wants to in documentation but I can't find the solution nor cause of that issue. I appreciate your help, really. If it matters I write my local fulfillment in ASP.NET. That's how I send the QUERY response

var queryObj = JsonConvert.DeserializeObject<dynamic>("{\"requestId\":\"" + requestId + "\",\"payload\":{\"devices\":{\"123\":{\"on\":true,\"online\":true}}}}");
_logger.LogInformation("Odpowiedź na żądanie QUERY." + originalRequest + "\n\n" + JsonConvert.SerializeObject((object)queryObj));
return Ok((object)queryObj);
  • Does this answer your question? [Deserialize Json Object with C#](https://stackoverflow.com/questions/70042170/deserialize-json-object-with-c-sharp) – Mernayi Jul 14 '22 at 08:04
  • No, this topic is completely different. I edit question to better describe problem I have to deal with. – Marcin Krzysiak Jul 14 '22 at 08:08

0 Answers0