Google Nest Device Access Console now available

Hi Dave,
I have used Safari browser and after I changed it to Google Chrome, I have successfully completed that step.
Unfortunately, I am blocked at then next step (5.2) “1. Request access and refresh tokens.”.

My URL was : Google
But when I am trying to get the refresh token I am receiving this error:

curl -L -X POST ‘https://www.googleapis.com/oauth2/v4/token?client_id=4xxxxxxxx272-lkul9kahipg4app4smrku2ritr8c16tl.apps.googleusercontent.com&client_secret=lxxxxxxxxew_uFP-gau60SU8&code=4/0AY0e-xxxxx-TxxxxxxxxyhegmMhaBNR4BER7KAbsxB4kuYRfyUNXVlAqIwiXOyysEC1Zw&grant_type=authorization_code&redirect_uri=https://www.google.com

{
“error”: “invalid_grant”,
“error_description”: “Bad Request”

Thank you very much for your support.Really appreciate.

–update:

This error occurs when the authorisation code expired. Generate the new code and it will work.

Hi Catalin,

Which terminal are you using to run the Curl command? Is this on a linux client, windows, mac.

The most foolproof way to do this is to use the Google Cloud Platform dashboard terminal for your cloud project. When you hit the link I provided here, the dashboard will be displayed for your project. You should look for a terminal icon in the upper right of the page Banner bar and click on that to start a terminal session. Hint: I referred to this in Step 6.1.3 if you want to see a screen shot of what I am referring to. It may take a few seconds for the terminal to open at the bottom of the screen. Try executing your curl commands in this terminal and see if that works better…

If your still getting an error back, doublecheck the curl command for correct format and possibly a carriage return where it should not be…

1 Like

Has anyone been able to change the temperature on their thermostat using the thermostatTargetTemperature channel in OpenHAB? My setup is reading the temperature correctly, but if I change it in OH it just reverts back to whatever is on the Nest after the refreshInterval.

Hello again Dave,

As I said before, I am new into this world, so I think I need more advices from you.
After I gathered all the info from google, I have created the cfg file and I have put it into the directory
/var/lib/docker/overlay2/e7779c0bcbbb6575d0790576e0ff572943a14455bdf59caa8629eec66a1e2428/merged/openhab/conf/services

After that I moved the org.openhab.binding.nestdeviceaccess-3.0.0-SNAPSHOT.jar into the location
/var/lib/docker/overlay2/e7779c0bcbbb6575d0790576e0ff572943a14455bdf59caa8629eec66a1e2428/merged/openhab/addons

I have installed the “Nest Bindings”, but nothing happened for me. I restarted the server but the magic is still missing. What I have missed?

I know it could be a “noob” question but I am still working to understand how openhab is working.

Thank you!

Hi Catalin,

Assuming your running the latest version openHAB3 in your docker container - my understanding is that the developers of this binding are still working on moving it to openHAB3. I haven’t moved mine from v2.5 yet. I can see that a few folks in this discussion have had luck getting the v2.5 snapshot working in v3 so you may want to have a look at their comments. You may want to try the @BHigg v 2.5 binding on your installation as I know it works with the parameters in the config file.

1 Like

Thanks for the step-by-step guide. Finally got it connected ^^
Does anyone has a home setup example to use the binding? (things/items/rules?)

See here: openhab-addons/bundles/org.openhab.binding.nestdeviceaccess at 2.5.x · bhigg-code/openhab-addons · GitHub

Basically, you need to add the Things through PaperUI (if anyone knows how to add the Things through config files, please let me know because I think that would fix the internet-disconnect issue).

Items are added as usual, with examples and explanations of the various channels at the link.

How do I re-add the device? I’ve removed the things in PaperUI, but they don’t show back up in my inbox!?

I don’t remember exactly but I think you’ve to remove thing, restart OH and then re-add the thing

Hope this help you

Assuming your using v2.5, you can try a manual add. Go to inbox and hit the plus (+) and select the nest binding to kick off a discovery.

No luck. I’m wondering if my token has expired?

Hard to tell whats going on. No guarantees here, but the typical reset everything steps might be worth trying. I had reinstalled my system and binding using the old config settings that I had gotten weeks ago and I did not have to get a new token.

The reset I referred to is done at a command line:

After verifying that there are no nest things in Paper UI…

  1. Stop openHab (on Linux use systemctl stop openhab2.service)
  2. Clear the cache (openhab-cli clean-cache answer Y to confirm)
  3. Start opoenHab (on Linux use systemctl start openhab2.service)

Hope that helps…

@BHigg - awesome work. Got it set up and working.

@wborn - would it be possible to re-port the latest version to OH3? It works but some of the updates including the addition of the HVAC status channel (whether the heating is on or not) was added after the port to OH3 was completed so are unavailable in OH3.

Hello! Yes the JAR of the port is very old now. Meanwhile I did add that channel to my branch but haven’t posted an updated JAR that has that code. I plan to do some final testing and add some docs soon.

There have been lots of other changes including adding an account thing where all OAuth2 config is stored so it can now all be configured using the UI. Maybe I now also need to backport it to OH 3.0 since the branch is based on OH 3.1. :upside_down_face:

8 Likes

Your work on this is binding is very much appreciated @wborn!! I have been using the v2.5 binding (with pub/sub OAuth2) and have noticed an issue that I suspect should be tested for. My comments are related to that version below and assume this is the base for what your working on…

I have 5 nest cams of various models and two nest thermostats. I have found that this binding seems to have a limit of 5 devices - as soon as I add the 6th or seventh device, they show on-line but are never updated. The access tokens are not renewed on those devices. While there is a limit stated for the nest device access project - its related to 5 structures. I only have one structure - so I assume that is not causing the problem - and have searched and not found any issues related to this. Perhaps the volume of messages coming from the subscription overwhelms the binding, not really able to pin down what is causing this.

There is also an issue with discovery where there are times when my thermostat is discovered both as a doorbell and a thermostat.

And another thing I would hope could be fixed is merely aesthetic - nest cams are lumped under doorbells. They shouldn’t have a chime channel and the Doorbell/Camera name channel is not updated with the devices value.

While I am not great at Java programing, I am very motivated to see this binding get added to OH3 and would be happy to help document this binding if that is something you could use help with. And always willing to do some testing once you have your changes implemented.

Hello everyone! I have been having a small issue with Google Nest device access and I’m curious if anyone else has encountered the same thing. Over the last few months, I have noticed that once every week, my refresh and authorization tokens stop working, requiring me to generate new access and refresh tokens (steps 2 and 3 here). After doing some digging, I found some reference to the reason why in some of Google’s documentation here:

“A Google Cloud Platform project with OAuth consent screen configured for an external user type and a publishing status of “Testing” is issued a refresh token expiring in 7 days”.

I see on the Google Cloud Platform APIs & Services page - OAuth consent screen section (see screenshot) that there is a link to advance the publishing status from “testing”, however when I attempt to do that I see a popup window which states that “You’ve configured your app in a way that requires verification” and I am faced with a relatively daunting list of requirements I would have to fulfill in order to make this change, including “an official link to your app’s privacy policy” and “a YouTube video showing how you plan to use the Google user data you get from scopes”:

Does anyone know what I may have done wrong? Surely I do not actually have to provide such things to google in order to change my publishing status from “testing” to “production”… I did set all this up before the step by step guide by @dschoepel was available, so maybe I made an error somewhere. Any assistance or insight into why this might be the case would be greatly appreciated :+1:

@Marcusfacius I don’t think you need to take the steps your trying unless your developing a commercial application (e.g. an IOS or Android App) that would be used to access Nest devices. This is why Google is asking for all the details around your request.

Your test environment should be fine if you are the only one that is using it to access information from your devices. There are limits on how many users and how many structures can be accessed from your project, but for an individual, you should be fine.

As for your tokens, they expire after 1 hour. The binding should be refreshing the token for each of the devices (things) you have discovered. You can see these details on each of the nest devices you have configured using the paper UI. In the left side bar click on Configuration, then Things. Find one of your nest devices , click on it to see the Channels. Right below where it shows the Status, you can click on Show Properties. This will reveal the device properties the binding is maintaining for that specific thing. You can see the tokens, expiration date and time, etc. This should at least give you an idea if these are being updated.

I have only see the problem you describe when I have more than 5 nest devices configured as I mentioned in an earlier post. An hour after the nest thing was added, the token would not be refreshed.

You might also search through your logs to see if there are any errors or warnings posted for the devices that are not being updated…

Hope that helps…

I’m seeing the same issue as Marcusfacius - the hourly renewal works fine, but after 7 days it stops.

My test system has been up for last the 11 days, and still working. Looking at the pub/sub config, there is a setting that talks about a 7 day limit on message retention. Could be pointing to a symptom of some other problem with the binding possibly not pulling messages from the queue.

Screenshot 2021-04-08 073028

You could try increasing the logging level for the binding to see more of the messages and perhaps reveal greater detail around why this is not working. One warning, setting the Debug mode on for the binding creates a massive flood of messages in the log so you may not want to leave it on for very long…

I also experience the same behavior as @dsmuttley and @Marcusfacius. I don’t believe it’s related to refresh token as it successfully refreshes for 7 days. After 7 days, it appears Google removes my “partner connection” from my Google account. I don’t receive notification from Google to the primary account/email address. Ironically, my wife’s Google account is also tied to my Nest and she receives an email notice stating that @gmail.com has removed a Google-approved partner from your home. When checking partner status (partnerconnections), the openhab service/partner I setup is indeed removed. I then went through steps of re-adding and it is removed after 1 week. This occurred every time (multiple times). I was unable to find any Google documentation stating test services were limited to 7 days but see that @Marcusfacius found some reference.

Interesting that not everyone experiences this 7 day behavior. I’m not using pub/sub. Wonder if somehow using pub/sub stops Google from removing the partner from account?