0

I've hit a brick wall with my Google Smart Home integration due to an error after my Smart Home SYNC process which only says "Couldn't update the setting. Please check you connection" as follows:

Screen Shot

I've done the Alexa Smart Home integration successfully and have been trying to setup Google Home the same way, using a similar endpoint setup. I'm receiving the request body as follows:

"body": "{\"inputs\":[{\"intent\":\"action.devices.SYNC\"}],\"requestId\":\"4411034480302599483\"}"

And here is my response:

{  
  "requestId":"4411034480302599483",
  "payload":{  
    "agentUserId":"xxxx",
    "devices":[  
      {  
        "id":"1234",
        "type":"action.devices.types.SWITCH",
        "traits":[  
          "action.devices.traits.OnOff"
        ],
        "name":{  
          "defaultNames":[  
            "Projector Light"
          ],
          "name":"ProjectorLight",
          "nicknames":[  
            "Projector Light"
          ]
        },
        "willReportState":false,
        "deviceInfo":{  
          "manufacturer":"TalentPace",
          "model":"442",
          "hwVersion":"3.2",
          "swVersion":"11.4"
        },
        "customData":{  
          "fooValue":0,
          "barValue":false,
          "bazValue":"DV19000275"
        }
      }
    ]
  }
}

I've run my response through the JSON validator and it shows the "no errors found" message.

The StackDriver logs show a BACKEND_FAILURE error:

Screen Shot

I've looked around on the web and this issue seems common. People have been suggesting trying this on new devices. I've tried that as well with no luck.

My endpoint is running on dot net core 2.0 and I'm returning the above JSON by converting a model binded object using NewtonJSON as follows:

return JsonConvert.SerializeObject(body);

The same setup worked fine for Alexa. At this point I'm not even sure if the issue is with my code or on Google's end. Any help would be much appreciated.

  • Can you see if the error happens during the sync, or at oauth? – Nick Felker Nov 26 '18 at 16:20
  • Thanks for your reply. Based on the StackDriver logs, the OAuth is cleared successfully. I'm getting the error on the SMART_HOME_SYNC action, which is triggered automatically right after OAuth. – Adithya Sivanandan Nov 26 '18 at 18:28
  • How does that Json convert method work? Are you sending the right headers back like the content type? – Nick Felker Nov 26 '18 at 19:20
  • @NickFelker The Json convert method converts the whole response body into a plain string. That's what I was returning. Is that not the correct return format? I've also tried the following with no luck, it returns a normal httpresponse message. Should this have any extra header specification? HttpResponseMessage httpResponseMessage = new HttpResponseMessage(); httpResponseMessage.StatusCode = System.Net.HttpStatusCode.OK; httpResponseMessage.Content = new StringContent(JsonConvert.SerializeObject(body), Encoding.UTF8, "application/json"); – Adithya Sivanandan Nov 27 '18 at 03:01
  • Can you send it back as normal JSON, not as a string? – Nick Felker Nov 27 '18 at 04:30
  • @NickFelker Not sure I understand correctly, there is no JSON datatype in C#, only string. Converting an object to string is how we generally pass JSON data in C#. Please refer below: https://stackoverflow.com/questions/16441880/how-to-return-json-object – Adithya Sivanandan Nov 27 '18 at 04:59
  • Okay, then you should try to set the content heading to `application/json` so that the data type is known. – Nick Felker Nov 29 '18 at 19:35
  • @NickFelker I've tried pretty much all response formats I can think of with no luck, with the latest being this: return new StringContent(JsonConvert.SerializeObject(response), Encoding.UTF8, "application/json"); At this point, I think it would be easier to do this in another programming language. Which one would you recommend? – Adithya Sivanandan Dec 02 '18 at 15:18
  • We've got the most support in [Node.js](https://github.com/actions-on-google/smart-home-nodejs). I don't fully understand why it's behaving strangely, but there's probably some data format differences. – Nick Felker Dec 03 '18 at 17:58

0 Answers0