With Google semi-recently closing down their APIs for Nest products, I was starting to look for a new Thermostat. This was unfortunate since the Nest thermostat is a really nice looking piece of hardware. Fortunately someone did some sleuthing and figured out what the new APIs are and published them in an unofficial HA integration. Given the name, I doubt this will ever become an official integration, and that’s kind of the point since Nest could change their APIs at any point and leave this project defunct.

Side note, I really like the double entendre in the name, which may be unintended, but regardless it covers the fact this integration is a hack but also bad on Google/Nest for taking away one of the main reasons I chose their platform.

Anyway, for now it’s working, but it’s a little harder to set up than a normal integration. This post will cover the 2 steps to getting Badnest setup

  1. Installing and Configuring the Community Store
  2. Installing and
  3. Configuring Badnest

To be honest, this doesn’t really merit a blog post, everything is well documented around all 2 of these tasks, but since this Blog is mostly for me to remember what I did to get my current setup, here we are.

Home Assistant Community Store

Badnest isn’t a default part of HACS, but is packaged so that it can be included as a third party integration. If you already have HACS, skip this section, otherwise read-on.

You know what, there isn’t much of a read on. The install and configuration instructions are well documented here and here respectively. So instead I’ll just do a TL;DR: version of the install instructions in case something changes and I need to know what I did to get this working with Home Assistant version 103.3.

*Note: Just revisited this with a new install (114.4) and the process is the same, though I have made a few tweaks to address some observations in the comments.

Installing HACS

  1. Download HACS latest release
  2. unzip
  3. create a folder in your homeassistant config folder called “custom_components”
  4. drop in the “hacs” folder from step 2 into the folder created above
  5. Restart HA

Configuring HACS

  1. Create a Personal Access Token in GitHub
  2. add HACS from the Configuration/Integration window in HA
  3. Give it your token from above
  4. Wait a few minutes for the installation to complete
    • It took 4 or 5 minutes for installation and another 20 minutes for HACs to finish starting.

Badnest

Installing Badnest

It took me a while to figure out that I needed HACS to install this, mostly because I previously had no idea what HACS was. In retrospect it is written out clearly on this community page but isn’t mentioned at all on the project page on GitHub.

  1. Add the GitHub page as a third party Integration to HACS from the Community/Settings page in HA. Make sure to set the Category as “Integration”
  2. Click the plus icon and search for badnest and click on it
  3. Scroll to the bottom of the pop-up and click “Install this repository in HACS”
  4. Click “Install”
  5. Restart HA

Configuring Badnest

I use Google Auth Login for nest, which is a more convoluted configuration process, but it’s all fairly straight forward. If you don’t use GAL, skip this section.

Getting the token and cookie for Google Auth Login

This is really well documented on the GitHub page, the only trick is if the file you’re told to shows up more than once, always grab the most recent copy (lowest in the list). The following is lifted verbatim from the project page:

  1. Open a Chrome browser tab in Incognito Mode (or clear your cache).
  2. Open Developer Tools (View/Developer/Developer Tools).
  3. Click on ‘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 (beginning with https://accounts.google.com, ending with nest.com). This is your "issue_token" in configuration.yaml.
  8. In the ‘Filter’ box, enter oauth2/iframe
  9. Several network calls will appear in the Dev Tools window. Click on the last iframe call.
  10. In the Headers tab, under Request Headers, copy the entire cookie. When I originally tried this integration, the cookie did begin with “OCAK=” like the official instructiosn say. This time around it started with “__Secure-3PSID=”. I think it’s save to say copy everything that appears after the “cookie:” section. This is your "cookie" in configuration.yaml.

Configuration in HA

without GAL:

badnest:
  email: email@domain.com
  access_token: !secret nest_access_token
  region: us

climate:
  - platform: badnest
    scan_interval: 10

camera:
  - platform: badnest

sensor:
  - platform: badnest

with GAL:

badnest:
  issue_token: "https://accounts.google.com/o/oauth2/iframerpc....."
  cookie: "XXXX=......"
  region: us

climate:
  - platform: badnest
    scan_interval: 10

camera:
  - platform: badnest

sensor:
  - platform: badnest
  • Note the quotation marks around the token and cookie
  • Probably a good idea to keep these in your secrets.yaml file

Summary

That’s it, you can now add a climate card to your lovelace page to view your Nest settings and change them.

The only part that isn’t ideal is that there doesn’t seem to be a way to set whether you’re “Home” or “Away”, but considering this is a hack to get it working at all, I can’t complain. A huge shout out to USA-RedDragon for making this possible again!

15 comments

  1. Lsdigi

    Reply

    Hey!

    Thanks for writing up this article. I’m stuck on the final steps. I installed HACS then installed BADNEST through the store. I added the code with tokens / session in configuration.yaml but thats where instructions finish!

    I’m totally new to HA (running latest version) and this is the first thing I needed adding as nest thermostat / protect are the first devices I wanted adding. Can you help please?

    • Reply

      Hey, sorry for the delay. The only thing to do after adding badnest to your configuration is to restart. Immediately after rebooting HA the thermostat was available to add to one of my lovelace interfaces. If it doesn’t show up, check that Badnest is properly installed in HACS and that your configuration token and cookie are correct. This is probably far to late to help you, but hopefully it helps someone else with a similar issue.

  2. Jeremy

    Reply

    After hours of pain, Badnest is operational! If it helps anyone else, my final fix was NOT to use the email/password in this article, but the user-id / access token from the original instructions on the Badnest Github.

    • Reply

      Yeah, the official page notes that the password no longer works, I’ve updated this post with the example showing the token. Sorry!

    • Reply

      I have no idea, I don’t have a Nest camera but since the example config settings list camera I’m guessing it works in some capacity.

  3. Thibaut Lamadon

    Reply

    When running HA on ubuntu, I don’t have the said “Community/Settings”, I do have HACS installed but it doesn’t have badnest available. Any suggestion on how to proceed? Thanks.

    • Thibaut Lamadon

      Reply

      ok, found it, just clicking on the three dots in upper-right corner in HACS.

  4. Adam

    Reply

    For some reason I can’t seem to get this to work. There is no card nor is there a device or entity even after installing through the third party GitHub. Maybe I’m missing something

  5. Tyler

    Reply

    Nice write up. Can’t wait to get this setup. Currently having issues getting hacs installed.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.