0

My Google SmartHome action is giving an error message "[Service] cannot be reached right now" after having executed the command properly. My device is properly switched on / off, but Google ends with that annoying message.

The input I get from Google:


{"inputs":[{"context":{"locale_country":"NL","locale_language":"nl"},"intent":"action.devices.EXECUTE","payload":{"commands":[{"devices":[{"id":"6"}],"execution":[{"command":"action.devices.commands.OnOff","params":{"on":true}}]}]}}],"requestId":"1389468583286354563"}

The response I give back:


{"requestId":"1389468583286354563","payload":{"commands":[{"ids":["6"],"status":"SUCCESS","states":{"on":true,"online":true}}]}}

Function execution took 2287 ms, finished with status code: 200


Next, I already (async) report state:


{"requestId":"1389468583286354563","agentUserId":"f0524769-7ffb-4ae4-8cec-5d67e6f6aa92","payload":{"devices":{"states":{"6":{"on":true,"online":true}}}}}

The report state API gives back that that was successfull.

I have no clue why Google gets back (even though the action is carried out successfully) that they cannot reach our service?

Jaap
  • 11
  • 3
  • Are you able to test if the same command returns a successful voice response in English? That may point to an i18n problem. Also, I see that the function latency is over 2 seconds. Do you see the same voice response if your cloud functions return in under 500ms? – devunwired Sep 23 '19 at 02:41
  • In English, I've got the same issue. The 2 seconds is because there was a renewal of the OAuth token I guess. The second time I execute the command takes considerably less (though still more than 500 msec) - I'm running a Google Firebase function, but it goes to the backend (which is running in another cloud), then to the client device and back - apparently it needs a bit more time for the roundtrip. The request/response will be put in another comment (otherwise this comment is too long). – Jaap Sep 24 '19 at 06:47
  • The English request: `{"inputs":[{"context":{"locale_country":"US","locale_language":"en"},"intent":"action.devices.EXECUTE","payload":{"commands":[{"devices":[{"id":"6"}],"execution":[{"command":"action.devices.commands.OnOff","params":{"on":true}}]}]}}],"requestId":"15729577386919011522"}` And the response: `{"requestId":"15729577386919011522","payload":{"commands":[{"ids":["6"],"status":"SUCCESS","states":{"on":true,"online":true}}]}}` Followed by Google's line: `Function execution took 765 ms, finished with status code: 200` – Jaap Sep 24 '19 at 06:49
  • Thanks for checking. Do you see any errors in your project's StackDriver logs corresponding to these request IDs? https://developers.google.com/actions/smarthome/develop/error-logging – devunwired Sep 25 '19 at 14:34
  • Hi, no, no errors whatsoever in the logs. See the screenshot: https://snipboard.io/s5jxZ0.jpg – Jaap Sep 26 '19 at 11:22
  • Thanks for checking. Just to be absolutely clear (based on your screenshot) you would have to change the resource from "Cloud Function" to "Google Assistant Action" to see any error logs from Google. – devunwired Sep 26 '19 at 15:46
  • @Devunwired thanks for the tip! I actually hadn't realized that the logs were filtered (Oops!). This gave me back that I returned an empty JSON - the return statement was 1 parenthesis too early, causing the async function to return an empty value. Problem solved! – Jaap Sep 27 '19 at 06:49

1 Answers1

1

Thanks to @Devunwired: I overlooked the Google Assistant Action logs. In it, it said the function is returning an empty JSON response. It turned out that the return statement was 1 parenthesis too early, causing the async function to return an empty value.

Jaap
  • 11
  • 3