0

My goal is to get the "Turn on the light" message when I say that to my Google Home. To do that, I visited their documentation page, which listed this sample code. I downloaded it and run it locally. Even thought I ran it locally, by default it was available publicly at "https://something.ngrok.io".

I opened the page and added a new light (I chose monochrome, because it looked simpler than RGB light) like this. enter image description here

Then, I created a project "Fake Light" at Actions on Google. enter image description here

Now, I see that app when I click "Add devices" on the Google Home app like below. If I click it, it shows the OAuth page, but when I tried to log in, it says, "Couldn't update settings please check your connection".

enter image description here

The NPM console log is like the following (I censored out some parts):

login successful  rick
authCode successful  5*************************
GET /oauth?response_type=code&client_id=***********&redirect_uri=https://oauth-redirect.googleusercontent.com/r/******** 302 8.858 ms - 1418
/token query {}
/token body { grant_type: 'authorization_code',
  code: '*****************',
  redirect_uri: 'https://oauth-redirect.googleusercontent.com/r/*****************',
  client_id: 'ZxjqWpsYj3',
  client_secret: 'hIMH3uWlMVrqa7FAbKLBoNUMCyLCtv' }
getClient ZxjqWpsYj3, hIMH3uWlMVrqa7FAbKLBoNUMCyLCtv
return getClient { clientId: 'ZxjqWpsYj3',
  clientSecret: 'hIMH3uWlMVrqa7FAbKLBoNUMCyLCtv' }
client { clientId: 'ZxjqWpsYj3',
  clientSecret: 'hIMH3uWlMVrqa7FAbKLBoNUMCyLCtv' }
handleAuthCode {}
getClient ZxjqWpsYj3, hIMH3uWlMVrqa7FAbKLBoNUMCyLCtv
return getClient { clientId: 'ZxjqWpsYj3',
  clientSecret: 'hIMH3uWlMVrqa7FAbKLBoNUMCyLCtv' }
getAccessToken =  { uid: '1234',
  accessToken: '*****************',
  refreshToken: '*****************',
  userId: '1234' }
return getAccessToken =  { token_type: 'bearer',
  access_token: '*****************',
  refresh_token: '*****************' }
respond success { token_type: 'bearer',
  access_token: '*****************',
  refresh_token: '*****************' }
POST /token 200 6.401 ms - 100
POST / 404 0.401 ms - 140

I used the sample account rick/oldman. The last log did show "404" but I am not sure why this happens.

Damn Vegetables
  • 11,484
  • 13
  • 80
  • 135

1 Answers1

0

The fulfilment address had to contain "/smarthome". I had entered "https://xxxxxxxx.ngrok.io". I changed it to "https://xxxxxxxx.ngrok.io/smarthome" and the error did not happen again.

https://github.com/actions-on-google/smart-home-nodejs/issues/58

Damn Vegetables
  • 11,484
  • 13
  • 80
  • 135