Closed jazzgil closed 2 years ago
Yes, the '\' is the problem. We use path.join() to build URLs, although path.join() is only for file system paths. On Windows it uses backslashes, which will not work for URLs. I'll see, if I can fix it this evening.
Thanks to @ckhmer1. Should be fixed in 0.1.9.
I guess I'm the first to try the library on Windows? wow - I didn't know Windows was that unpopular for Node-Red ;)
Thanks for your efforts! I'll try it right away
SUCCESS! :))
Now trying to figure out why the app rejects the connection after a successful login. Getting "Could not reach [test] devName. Please try again".
Client ID and Secret are alphanumeric. Any quick ideas to direct my investigation? No error is thrown to the log on Node-red side.
HttpAuth:httpAuthRegister(GET /oauth)
GET /oauth?response_type=code&client_id=NodeRedSmarthome&redirect_uri=https://oauth-redirect.googleusercontent.com/r/myhome&state=ABdO3MW... 200 0.669 ms - 7914
HttpAuth:httpAuthRegister(POST /oauth): body = {"username":"","password":"","client_id":"NodeRedSmarthome","redirect_uri":"https://oauth-redirect.googleusercontent.com/r/myhome","state":"ABdO3MW...","response_type":"","id_token":"eyJhbGci..."}
HttpAuth:httpAuthRegister(POST /oauth): Google login
HttpAuth:httpAuthRegister(POST /oauth): email (myemail) valid: true
HttpAuth:handleUserAuth(): login successful
HttpAuth:handleUserAuth(): authCode successful; authCode = HrDNbG...
POST /oauth 302 305.108 ms - 1536
Looks like the process stops in the beginning of the step: "Google calls our service to exchange the auth code into an access token."
Do I need any specific nodes set up other than just a Management node at this point?
My Action Console - Account linking settings. Anything missing?
And Action...:
try adding a new node, not only the management one.
Added. Even got this on the log:
Devices:SetState(): state = {"online":true,"on":true,"brightness":50,"color":{"name":"","temperatureK":3000}}
Device:SetState(): key = "online"
Device:SetState(): key = "on"
Device:SetState(): key = "brightness"
Device:SetState(): key = "color"
HttpActions:reportState(): deviceId = 8aedd4d1.866dd8
HttpActions:reportState(): states = {"online":true,"on":true,"brightness":50,"color":{"name":"","temperatureK":3000}}
But still, device refusing to be added. Even tried to remove the project and redefine it. No dice. Still investigating...
Could you please add more log rows? I need to understand the result of the report state.
Also, could you please restart node red and post the complete log starting from the restart?
Sure. I've further set node-red to debug: output.log
Thanks for your help
It seems that you have problem with mqtt, are you able to remove all the nide using it (mqtt) and try it again?
Are you referring to the exception there? It's related to bad login credentials for Tesla. I'll disable it and try again.
Or is there another issue with mqtt I'm missing? Also, bare in mind anything past line 115 is me pressing Ctrl-C.... :)
One place in the setup which may be the problem is steps 3 and 4 under "Integrating Google Sign-In":
Never deciphered what those mean. I don't have "Configure consent screen" in Credentials.
Hi, I'm sorry but I'm a bit confused about the status.
Are you able to link the Google home app with Node-RED? Could you please describe exactly all the steps, where it starts to not work and include the complete log?
Thanks
Status is till the same. "Could not reach..." - unable to link home app. Failure point is shown here
The problem seems to happen at the point when the user filled out the login form, we generated an auth code and redirected the user back to Google. Now Google should call /token
to exchange the auth code into tokens. But Google does not call, there are no further request in the log.
So either Google is requesting the wrong URL, the HTTP request doesn't get through or some other setting is blocking Google from calling your service and it's incorrectly reported as "can't reach"
So my advices would be:
invalid client id or secret
. Any other response (DNS error, timeout, error 500, Cannot POST /token
, etc.) indicates there's something wrong with your setup.Test
, click the Settings
button, disable On device testing
. Then click button Start Testing
.Never deciphered what those mean. I don't have "Configure consent screen" in Credentials.
Damn. Google seems to regularly move around those options. I should probably recreate my project once again and update the Readme. In the meantime, I'd recommend disabling "Use Google login" and use username/password.
Thanks @Caprico85. reqbin.com POST returns 400 exactly as you expected. All other tests you listed result the same: "can't reach". The last thing shown in the log is that "POST /oauth 302".
I've run out of ideas. Google's log doesn't show anything, otherwise it could have helped pinpoint the problem. :(
For comparison, these are the settings in my Management node. Although I don't think you have something totally wrong there.
I just noticed something interesting.
Your Actions Console looked like this:
Mine looks like this:
Something is strange in your Actions Console. Did you create your project of type "Smart Home"?
@Caprico85, I've since redid my Action definition on Google, and now my Develop page options look the same as yours. Still no go.
@ckhmer1, what do you mean by interactive check? Where do I use/see it? Thanks!
Enable the log in the Google configuration node and open again the check link
"Google configuration node" - are you referring to this:
Enabled... I don't see any new log entries, other than what I've listed above.
Did you open again the check link https://example.com:3001/check ?
@jazzgil ActivePresenter looks promising. Thank you! Already working on the first video.
Hi,
It seems that I have the same issue as @jazzgil and I'm not able to reach google smarthomeserver.
I followed the guideline carefully and with some minor deviations as follows:
Go to the Actions console.
Click New project.
Enter a name for your project (Project Name: "A name")
Choose a language for your action (you can change later): Dutch
Choose your country or region: Netherlands
Click Create Project
What kind of Action do you want to build? Choose Smart Home
Click Start Building
Under Quick Setup, click Name your Smart Home action. Enter the name for your Action (Name). This is the name of the smart home Action that you can connect to from the Google Home app.
Click Save
Click Actions in the left menu.
In the Fulfillment URL field, enter a URL for the backend server that will provide fulfillment for the smart home intents and then click Save. https://example.nl:3001/smarthome
All other fields empty or untouched. Log level: Error
Click Save
Still on the development tab click Account
Client ID and secret: Credentials, with which Google will authenticate against your app. Use a password generator tool to generate two strings of reasonable length and complexity. Copy both strings, you'll need them later.
Authorization URL: https://example.nl:3001/oauth
Token URL: https://example.nl:3001/token
All other fields are empty
Click Save 21 On tab Test, click Reset Test
Goto Home Graph API
In the header bar select your project from the project chooser
Enable the [HomeGraph API].
Go to Google Cloud Console API & Services page
Again, select your project in the header bar
Select + Create Credentials and create a Service account key
Enter a name for your service account (A name) and click Create and Continue
Click Done
Your new service account is listed on the Credentials page. Click on it
In the page Service account details, click on Keys
Click on Add Key to create a new key of type JSON
Download the JSON Web Token keyfile (jwt Key) and copy it to your Node-RED server, in a location where the Node-RED service can read it. Copied it to /home/pi/.node-red
I'm using Node RED version 2.1.3, Node version 14.18.1 and Google Smarthome version 0.1.13.
Filled in carefully the Configuration Node. Both the Configuration Node and a Light Node for testing show "Ready"
However trying with ReqBin and the URL https://example.nl:3001/check shows: 404 (Not Found) If I browse from the internal network to the same URL, I see: Cannot GET /check
Checking with nmap show that port 3001 has been opened, so I assume that the "webserver" is running. And pressing "Deploy" in Node Red show an error message for the Configuration node: "HttpActions:reportState(): no user logged!"
Does anybody has an idea, what could be wrong. I have already tried to setup this project 2 times, the only thing I see is two times the same project in the Google Home app. Any hint is appreciated.
Thanks in advance
Regards
What do the server settings in your config look like? They should look like this:
Port must be 3001, otherwise it would obviously be https://example.nl:12345/check. Path must be empty, otherwise it would be https://example.nl:3001/your_path/check. "Use http Node-RED root path" must be disabled. Otherwise the endpoint would be somewhere below Node-REDs httpAdminRoot path (e.g. if Node-RED listens on https://example.nl:1880/node-red, it would be https://example.nl:1880/node-red/check).
Hello @Caprico85,
Thank you, thank you. That was the issue.
My settings in the Configuration Node, were as follows:
I had my path set in the path setting, instead of leaving it empty. I had not expected, that a path, like https://example.nl:3001/check would not work.
But okay, you solved it for me.
I have one question left.
As I tried to create two similar projects in Google Actions, because the first one did not work (same issue), I have now two [test] ProjectName services in the Google Home app. One of them I was able to link, the other one (of course), not. Do you know, how I can remove (delete) this useless service. Or will it disappear after a certain time?
Thanks in advance
You can delete your projects in Google Actions.
It should be deleted 30 days later ... but days seem to be longer at Google. Still waiting for some of my projects to disappear.
@Caprico85
Thanks for your quick response. That is the way I deleted the old project. So it is simple, I have to wait 30+ days?
Thank you for your support.
It took over 2 months for Google to delete my old project...
Is this problem still present?
Hello @ckhmer1,
For me is this issue solved. But the old project still exists in Google Home, but this is a Google issue. So for me this issue can be closed.
Regards
Still waiting for my old projects to disappear. Seems they never really get deleted.
Thanks for this library. I'm still trying to make it work for me.. :)
I'm unable to pass the check test. Noticed in Node-red's log the following:
Notice the '\'. I guess this makes /check and /oauth operations fail with "Cannot GET"...
Windows 10.0.19042 64bit Node.js v16.9.1 Node-RED v2.0.6 node-red-contrib-google-smarthome v0.1.8
Any idea why this happens? Thanks for your help!