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

Google Smart Home action responds "[Service] is not available right now" after the action completed succesfully


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?


Solution

  • 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.