Can Nest tokens be migrated to a new install? [Yes, and here's how!]

I’ve started migrating my Hassio install to a new NUC. I’ve been working through getting my integrations back up and running. I ran into a bit of a wall with Nest (not surprising). I do have a developer account and I was able to recover my access token from my old .storage/config_entries after reading this topic:

I tried copy-pasting the nest json entry:

{
                "connection_class": "cloud_push",
                "data": {
                    "impl_domain": "nest",
                    "tokens": {
                        "access_token": "super long string of jibberish",
                        "expires_in": 315360000
                    }
                },
                "domain": "nest",
                "entry_id": "not sure if doxinging number here",
                "options": {},
                "source": "import",
                "title": "Nest (via configuration.yaml)",
                "version": 1
            },

into the new file and restarting. The hassio homeassistant restart command hung indefinitely. In another terminal I was able to watch the logs and HA actually starts fine and does its thing (I can see roomba polling logs go by). But the front-end doesn’t load. I replaced the original file, restarted, and everything was fine.

Here’s the trick. Go get a coffee. Wait a sec. It seems like after the copy-paste and restart it took ~5 minutes for the front-end to load. The hassio homeassistant restart command never actually exited successfully despite the front-end returning. That happened while I was waiting for a response to my original post.

Not sure why, but it seems like as long as you have access to your old .storage folder you can transfer the Nest to a new HA instance.

6 Likes

Thank you! Moved to a NUC recently and managed to reconnect to Nest using this method

@GleDel glad it helped!

@JudoWill I wonder if this would work when trying to move access to Nest from HomeBridge? I have the access token in the HomeBridge config file. Unfortunately I got an RPI and installed Hassio at the beginning of September so I missed the window to access the Nest dev account to be able to setup a new integration.
I don’t quite understand your comment in the identity_id field?

@Townsmcp.

I don’t see why it wouldn’t work as long as you have all of the relevant info and can get the format right. Since I already had an entry in my config file from the previous install I just copy-pasted over everything. When I was pulling it over there were two long alpha-numeric strings that looked like tokens, passwords, or some type of hash: the entry_id and the access_token. I didn’t want to accidentally release my Google or HA tokens, so I just replaced them in the post.

I don’t know enough of the internals of HomeBridge, or HA, to know whether they’re connecting to Nest in a similar enough way for the tokens to be exchangeable though.

1 Like

I will give it a try and report back :grin:

@JudoWill, just to be clear, you had your Nest config in configuration.yaml and the above JSON text inside the config_entries file located in ./storage ? I assume entity_id pairs up with the Nest entity id defined in configuration.yaml?

@Townsmcp
That one I’m not sure about. The HA docs require you to give the client-ID and secret OAuth tokens as part of the configuration.yaml file. You get these from the Nest Developer Account (which is no longer enrolling new accounts). The entry_id and access_tokens in this .storage/core.config_entries file are entirely different from both of the OAuth tokens. I’m assuming they’re generated during the handshake between HA and Nest/Google that would normally occur through the Nest developer tool.

You might have to dig-around in the HomeBridge internals to find them.

Thank you! @JudoWill

I was able link Nest to a fresh HASS install.

Just say thank you!
I migrated Nest thermostat from RPi to NUC!

@benm, @acme, or anyone else that has gotten this to work. Did you also get the slow loading Lovelace problem? I’ve been getting it intermittently ever since this and I’m wondering if they’re related somehow or if it was a different problem all along. If you did, has it gone away?

JudoWill,

Going through the process of recovering my nest integration with hassio. Ill try the above steps, my SD card had a bit of memory corruption. Fortunately, I was able to recover the supervisor folder from the file system. Fingers crossed in hopes I have all the data needed to restore my nest integration. Ill report back on the performance.

Regards,
Coasterboy76

@JudoWill No issues or slowness here.

JudoWill,

No slowness, however I used the procedure outlined the following post.

Nest to turn off their API

Coasterboy76

Just upgraded to a NUC as well. Sooooo much better than my old raspberry pi. However, having the same issue with Nest. Works fine on my old HA instance, but can’t get it up and running on the one due to Google closing their works with nest program. I tried coping my existing Client ID and Secret key, but it didn’t work. Came across your thread while searching for a solution. How do I access the .storage file to copy the nest json entry? I have the FTP add on installed, but it is not giving me access to the directory. All I see is addons, backup, config, share and ssl.

Figured it out, I had to turn on hidden files…doh. Anyway, copied the nest entry from the core.cofig_entries file of the old HA instance to the new NUC and rebooted. Worked like a charm!

@Townsmcp any luck figuring out what the “entry_id” can be sourced from in HomeBridge?

I gave up in the end and just went with BadNest

I just figured it out! if you login to the nest website its the same string at the end of the URL after home/

Thanks for this thread, just used this to add Nest Protects into a new HA instance for a second home.

Really helpful thanks!