Nest Legacy

Nest Legacy Integration for Home Assistant

This is a custom component for Home Assistant to integrate a wide range of Nest devices using an unofficial web API. It serves as an alternative to the official Nest integration, providing support for devices not available through Google’s official Smart Device Management (SDM) API, such as the Nest Protect, Nest x Yale Lock, and Nest Heat Link.

This integration provides real-time updates for most sensors and controls by maintaining a persistent connection to the Nest API.

Why use Nest Legacy?

The official Home Assistant Nest integration uses Google’s Smart Device Management (SDM) API, which has a limited set of supported devices and requires a one-time $5 fee. This Nest Legacy integration uses the same unofficial API that the Nest mobile and web apps use, offering several key advantages.

Comparison with the Official Nest Integration

Feature Nest Legacy (This Integration) Official Nest Integration (SDM API)
API Used Unofficial Nest Web API Official Google SDM API
Cost Free $5 USD one-time fee required by Google
Authentication Access Token (Nest Account) or Cookies (Google Account) OAuth2 with Google Cloud Project
Supported Devices Wider range, including Nest Protect, Nest Temp Sensors, Nest x Yale Locks, and Nest Heat Link. Limited to newer Thermostats, Cameras, and Doorbells.
Stability Relies on an unofficial API that could change or break without notice. Officially supported by Google, more stable long-term.

In short, use this integration if you want to:

  • Integrate Nest Protects, Temperature Sensors, Locks, or Heat Links.
  • Avoid the $5 Google API fee.
  • Access features not exposed by the official API.

Supported Devices

This integration supports a wide variety of Nest devices:

  • Nest Thermostats (1st, 2nd, 3rd gen, Thermostat E, 2020 mirror edition)
  • Nest Protect (1st and 2nd gen, both wired and battery)
  • Nest Temperature Sensors
  • Nest Cameras (Cam Indoor, IQ Indoor, Outdoor, IQ Outdoor)
  • Nest Doorbells (Wired 1st gen)
  • Nest x Yale Locks
  • Nest Heat Link (for UK/EU hot water control)

Features

This integration creates a rich set of entities for your Nest devices.

  • Nest Thermostat:

    • climate entity for full control over temperature and HVAC modes (Heat, Cool, Heat/Cool, Off).
    • fan entity to control the fan independently.
    • number entity to configure the fan timer duration.
    • binary_sensor for occupancy and Eco Mode status.
    • sensor for humidity and backplate temperature.
  • Nest Protect:

    • binary_sensor entities for Smoke, Carbon Monoxide (CO), and Heat alarms.
    • binary_sensor for occupancy (wired models only).
    • binary_sensor entities for diagnostic status (battery health, line power, component tests).
    • sensor entities for battery level and replacement date.
    • switch entities to control Pathlight, Nightly Promise, Heads-Up alerts, and Steam Check.
    • select entity to adjust the Pathlight brightness.
  • Nest Temperature Sensor:

    • sensor for temperature and battery level.
  • Nest Cameras & Doorbells:

    • camera entity with live streaming.
    • switch entities to enable/disable streaming, audio, night vision, and the status LED.
    • switch for Indoor Chime and Visitor Announcements (Doorbells only).
    • event entities that fire for doorbell presses, motion, person, sound, and face detection.
  • Camera Event Media Browser:

    • A media_source is provided, allowing you to browse, view, and download recent camera event clips and thumbnails directly from the Home Assistant Media Browser.
  • Nest x Yale Lock:

    • lock entity to lock and unlock.
    • sensor to show who performed the last lock/unlock action (keypad, manual, remote).
    • binary_sensor for tamper detection.
    • switch to enable/disable auto-relock.
    • number entity to configure the auto-relock duration.
  • Nest Heat Link:

    • water_heater entity for full control over your hot water system, including setting temperature, mode, and activating a boost.
  • Nest Home/Structure:

    • select entity to set the home’s mode (Home, Away, Vacation).

Installation

HACS

  1. Add custom integrations repository: https://github.com/tronikos/nest_legacy
  2. Select “Nest Legacy” in the Integration tab and click download
  3. Restart Home Assistant
  4. Enable the integration

Configuration

After installation, the integration can be configured via the Home Assistant UI.

Open your Home Assistant instance and start setting up a new integration.

You will be asked to select your account type. Follow the instructions below based on your account.

Google Account Configuration

For accounts migrated to Google, or created after August 2019. You will need to retrieve an issue_token and cookies from your browser.

(Instructions adapted from the excellent homebridge-nest project).

  1. Open a Chrome browser tab in Incognito Mode.
  2. Open Developer Tools (View > Developer > Developer Tools, or Ctrl+Shift+I / Cmd+Option+I).
  3. Click on the Network tab. Make sure Preserve Log is checked.
  4. In the ‘Filter’ box, enter issueToken.
  5. Go to home.nest.com, and click Sign in with Google. Log into your account.
  6. One network call (beginning with iframerpc) will appear in the Dev Tools window. Click on it.
  7. In the Headers tab, under General, copy the entire Request URL. This is your Issue token.
  8. Clear the filter box and now enter oauth2/iframe.
  9. Several network calls will appear. Click on the last iframe call.
  10. In the Headers tab, under Request Headers, find the cookie entry. Copy the entire cookie string (it will be very long). This is your Cookies.
  11. Paste these values into the Home Assistant configuration form.
  12. Do not log out of home.nest.com, as this will invalidate your credentials. Just close the browser tab.

Legacy Nest Account Configuration

For older, non-migrated Nest accounts. You will need to obtain an access_token.

  1. Go to https://home.nest.com in your browser and log in.
  2. Once logged in, open a new tab and go to https://home.nest.com/session.
  3. You will see a long string of text. Find "access_token": "..." near the beginning.
  4. Copy the value inside the quotes (it’s a long sequence of letters, numbers and punctuation beginning with b). This is your Access token.
  5. Paste this value into the Home Assistant configuration form.
  6. Do not log out of home.nest.com, as this will invalidate your credentials. Just close the browser tab.

Field Test Environment

If you are part of the Google Field Test program, check the “Use Field Test environment” box during setup.

Credits

This integration would not be possible without the extensive research and work done by these projects:

Disclaimer

This is a personal hobby project and is not affiliated with Google or Nest. It uses an unofficial API that could be changed or discontinued by Google at any time, which may cause this integration to stop working. It is provided “as-is,” with no warranty whatsoever. Use at your own risk.

Note I’ve only tested this with Nest Protect, Nest Camera, Nest Doorbell, and Nest Lock. If you encounter any issues with Nest Thermostat or Nest Heat Link open an issue or even better open a pull request.

3 Likes

Hi Tronikos!

I was exactly looking for this for a while :slight_smile:
I tried to use the Starling Home Hub but with its discontinuation I don’t expect all of the new features that have been recently ported from the Google Home App to appear, notably the Hot Water features.

I tried following the Google Account configuration but I am hitting this issue.

Unknown error during validation
Traceback (most recent call last):
  File "/config/custom_components/nest_legacy/config_flow.py", line 96, in _show_form_and_handle_errors
    info = await self._validate_input(user_input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nest_legacy/config_flow.py", line 50, in _validate_input
    nest_session = await client.async_authenticate_with_google_credentials(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        issue_token, cookies
        ^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/config/custom_components/nest_legacy/pynest/client.py", line 177, in async_authenticate_with_google_credentials
    auth = await self._async_get_access_token_from_cookies(issue_token, cookies)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/nest_legacy/pynest/client.py", line 212, in _async_get_access_token_from_cookies
    return GoogleAuthResponse(**result)
TypeError: GoogleAuthResponse.__init__() got an unexpected keyword argument 'valid'

Did you see that in your testing?

I haven’t migrated my Nest account to Google so that part isn’t tested. But I’m using the exact same code ha-nest-protect has to authenticate Google accounts which is known to be working fine. Try the latest v0.0.2 where I changed the code to handle unexpected fields to see if you will move further. In the future, please report any issues in GitHub, not here.

1 Like

I’m currently using this for my Nest Protects. Did you make any tweaks or improvements in this regard, or is it just allowing for more Nest products with a single integration? Curious if there would be any reason/benefit for me to jump ship.

Damn wanted to try this but I have the 2nd gen, wish Google would provide all these extra options like the switches and face detection entities in the official API smh.

Yes. Other than the support for more Nest products and the support for Nest accounts, it was rewritten to follow HA best practices. For Nest Protect specifically:

  • I think there are a couple of new diagnostic sensors. I added screenshots in the GitHub repository.
  • All entities are now translatable.
  • Retry logic is better. The Nest Protect integration waits 1 or 2 or 5 minutes depending on the encountered exception. My integration waits 0.1 seconds with exponential delay capped at 1 minute.
  • You don’t get a separate “Online”; the entities simply become “unavailable” as per HA standard practice. This also simplifies automations as you don’t need to check a separate entity.
  • You get a sensor/control for the Home Away status.

Can you view the doorbell at http://home.nest.com/ ? If yes, then it should be supported. If it is, let me know to update the REAME.

2 Likes

Google migrated Nest Gen2 here. Few days ago the official integration using SDM API stopped working (I can only view the values, but not change them).

I could not get this working using incognito mode in Firefox, Chromium or Edge. Eventually the Edge in normal mode worked and I got it all set up.

What works. I can change temperature again, mode and Eco and see occupancy, temperature/humidity.

What does not work is Fan control and duration. (That did not work with official integration anyway)

Big success overall. (Until Google pulls the plug on the Gen2 cloud next week).

Does the fan control work at home.nest.com? If yes, could you open a GitHub issue to follow up there?

Managed to do it, not that difficult. I see my Nest Protects now in addition to 2 Nest Tstats, however, the main thing that does not work is hot water control. There is no water_heater entity, and there simply is no hot water control anywhere.

I run Google migrated accounts, European Nest connected via Heat Link. Not sure why I don’t see it. Any tips?

Wait! Could it be because I have Thermostats integrated already via Google integration? The $5 classic one? Does this prevent Legacy from adding thermostats on its own?

Eh, no, I’ve removed Thermostats and official Nest integration, and went through Nest Legacy setup again, and it simply does not see the Thermostats at all. They are not identified during setup (after token/cookie entry), and all it sees are Protects. Sad face.

Yes, I can control it from the app and home.nest.com.

Another issue is that after some time the Legacy Nest looses connection to google/nest (temperature is off and control is not working). Just reloading the integration brings it back.

I enabled debug logging and open issue on GitHub if I find something.

As I said in my first post I haven’t tested this with thermostat, fan, or water heater. I’m actually surprised thermostat works. @TheDaemon @Woodcat64 could you post a screenshot of your thermostat page in the dark default theme with all the entities enabled to include it in the repo?

@Woodcat64 could you open an issue for the fan control? With debug logging enabled could you change the fan from home.nest.com and post the debug logs in the issue? It would also be helpful posting the payload when you control the fan. In your browser open developer tools > network, control the fan and search for put to find the request to *transport.home.nest.com/v5/put. I’m interested in the payload when you turn on/off the fan and adjust the duration.

@TheDaemon no it should’t matter having other integrations. Could you open an issue and attach a manually redacted version of the diagnostics at the config entry level? Similarly to the fan control, it would help posting payloads from the nest web app when controlling the water heater.

@tronikos Not sure what exactly are you asking of me.

Screenshot of thermostat page → screenshot from where? From HA when I have thermostats integrated via official Google integration? I have just deleted that integration to test if Legacy might then see them, I have to re-add them.

Open issue → Where? Your GitHub?

Diagnostics at the config entry level → Where do I get this? At which point you need diagnostics? I assume when I start to add Nest token/cookie, you’d want to see why thermostats are not visible, but please can you give me some more guidance so that I can correctly do this.

Here are the screenshots.


I don’t have network in developer tools. Do you mean “Listen to events”?

https://www.home-assistant.io/docs/tools/dev-tools/

Thanks for the screenshot. I added it to the README.
In your browser go to home.nest.com, open more tools > developer tools > network. Control the fan and in that tool there should be a captured request to v5/put. I’m interested in its payload.

Never mind I got the screenshot I wanted.

Yes open an issue at GitHub · Where software is built

You can get diagnostics from settings > devices & services > Nest Legacy. Then next to the config entry: “Nest (email address)” select the 3 dots > download diagnostics. Make sure you redact any personal information from the file before you attach it the GitHub issue.

Done, opened: Legacy didn't detect my 2 Nest Thermostats at all · Issue #5 · tronikos/nest_legacy · GitHub

Nope the new doorbell cannot be viewed on nest website, it’s Google home app exclusive, I can view it on home.google.com though.

Only devices that are available at the nest website are supported.

1 Like

In your browser go to home.nest.com, open more tools > developer tools > network. Control the fan and in that tool there should be a captured request to v5/put. I’m interested in its payload.

Sorry, I don’t see “more tools” there. Just regular Nest UI.