0

I have created a couple of devices using the https://github.com/actions-on-google/smart-home-java sample project. I have also successfully linked my account and see these devices in my Google Home app. I am also able to click on a "On" or "Off" button next to the Lamp device, and I see the value change in Firestore.

However, when I click on the device it says "Not responding" on the top and "Offline" in the middle of the screen. I do not see any errors in the "smart-home-java" server logs.

Has anyone else experienced something similar? How should I approach debugging this?

dvim
  • 2,223
  • 1
  • 17
  • 17
  • In Firestore, is there a state called `online`? – Nick Felker Aug 17 '20 at 16:24
  • If there are any errors with intent requests from your project, they will be present in the project [error logs](https://developers.google.com/assistant/smarthome/develop/monitoring-logging#logging). One hunch to check is to make sure your service account key is correctly set up. Failures to report state can cause the `QUERY` intent to fail. – devunwired Aug 19 '20 at 21:38
  • There is a state `online` and it is set to `true`. The logs of the `smart-home-java` do not have any errors. Requests from Google Assistant are handled with `200` status codes. However in the *Google Assistant Action Project* log resource I see the following in the execution log: `{action: {actionType: "STATE_QUERY"}, device: {deviceType: "SWITCH"}, status: {isSuccess: false, statusType: "DEVICE_OFFLINE"}`. So for some reason it thinks that query request was not successful. – dvim Aug 21 '20 at 04:45

1 Answers1

0

As mentioned briefly in the comments, this is likely because your project is failing to successfully call Report State. The most likely cause of this is that your Home Graph API credentials are missing or incorrect.

In the current sample code, an error in this method call will cause the handler to return deviceOffline from a QUERY. You can also comment out or remove this line to debug the issue.

devunwired
  • 62,780
  • 12
  • 127
  • 139
  • Thanks for the pointer! That allowed me to dig more and I found that there was a problem in the path while loading credentials as a resource. I created a PR with a fix: https://github.com/actions-on-google/smart-home-java/pull/20 – dvim Aug 22 '20 at 14:02
  • With the fix from above, the device in the Google Home would briefly appear as Online but go immediately to Offline. There was another fix needed after which it now works as expected. PR for the second fix: https://github.com/actions-on-google/smart-home-java/pull/21 – dvim Aug 22 '20 at 16:30