I made a crappy Nest Thermostat integration that will work as a stopgap until alternatives come out

I never logged out of the best app.

What about the browser that you used to fetch the cookie from? You don’t use the Nest app for this.

Nothing to do with the browser. I have used this integration since it was released. I understand how to use it. Today after HA restart on update, there were errors in the HA log. Not a browser issue. Fixed with new token and cookie.

I agree. I have spent an hour running through the original instructions and unable to find OCAK. Mine started with SID. Copied it all over and the thermostat is working perfectly again.

It worked for me by using SID and I could get Climate card working but I updated below 5 files today from GitHub repository because these have were updated recently:

__init__.py
api.py
camera.py
climate.py
const.py

but now getting error:

2020-05-09 20:30:07 ERROR (SyncWorker_15) [homeassistant.components.nest] Connection error while access Nest web service: Authorization Failed
2020-05-09 20:30:09 ERROR (MainThread) [homeassistant.setup] Error during setup of component badnest
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 175, in _async_setup_component
    component.setup, hass, processed_config  # type: ignore
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/badnest/__init__.py", line 47, in setup
    region,
  File "/config/custom_components/badnest/api.py", line 76, in __init__
    self.login()
  File "/config/custom_components/badnest/api.py", line 96, in login
    self._login_google(self._issue_token, self._cookie)
  File "/config/custom_components/badnest/api.py", line 107, in _login_google
    access_token = r.json()['access_token']
KeyError: 'access_token'
2020-05-09 20:30:09 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for huesensor which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-05-09 20:30:09 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform badnest.climate: Unable to set up component.
2020-05-09 20:30:14 ERROR (MainThread) [homeassistant.config] Platform error: binary_sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 777, in async_process_component_config
    platform = p_integration.get_platform(domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 279, in get_platform
    f"{self.pkg_path}.{platform_name}"
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked

Nothing working any suggestion about it?

Just FYI anyone experiencing the KeyError: 'where_id' error that’s been mentioned a couple times in this thread there is a fix available here https://github.com/USA-RedDragon/badnest/pull/117

Thank you for your reply. HA instance crashed and now it is not starting, I tried even after removing bad nest configuration. OS up and running and I could backup my all files from config folder except Lovelace config (/home/homeassistant/.homeassistant/.storage).

The problem with new HASSOS is if your HA instance doesn’t start there is no way to connect to OS, SSH doesn’t work anymore from remote machine. Could you please suggest a way to copy .storage file via OS? I can login to PI locally and it brings me to ha> prompt but I have no way to interact OS file system. Snapshot that I have is also more than a month old and is from different version of homeassistant.

same for me!

How did you get it to work :frowning: I really want to get this working but its not in my case

  1. I installed it using HACS and added the repository below as an integration:
    https://github.com/mattsch/badnest
  2. Opened up Chrome, go to the sign in page for Nest Home.
  3. Don’t Log in yet, right click on the page and go to Inspect.
  4. Click the Network Tab
  5. I have not moved to a Google Account yet so these might be slightly different, the documentation on the Github page should describe it. So I clicked on the Sign in with Nest link.
  6. Entered my username and password and clicked sign in and entered my 2FA code.
  7. On the Developer console, I looked for an entry that starts with login?_=XXXXXXXXXXXXX (where the Xs are some numbers, mine was red in the console)
  8. Click on that and then copy and paste the text from the Response tab into your favorite text editor.
  9. Look through that string of text for “userid”. It should be followed by string of 7 numbers. Note that down.
  10. Look through the same string for “access_token”, it should be super long, near the beginning, copy that down as well, mine ends right before the primary phone entry.
  11. Then open up your configuration.yaml file and add the following:
badnest:
  user_id: [enter your user_id from earlier here (no quotes)]
  access_token: [enter your access_token from earlier here (no quotes)]
  region: us

climate:
  - platform: badnest
    scan_interval: 10

sensor:
  - platform: badnest
  1. Save the config file
  2. Restart HA and you should see it in there.
1 Like

Followed the steps now I get this:

Invalid config

The following integrations and platforms could not be set up:

  • badnest
  • badnest.sensor
  • badnest.climate

Please check your config.

I forgot to mention, did you restart HA after installing Badnest from HACS? So the icon in HACS for Badnest should be green.

Screenshot for reference:

When I get this I need to reset my token and cookies.

badnest:

user_id: “https://accounts.google.com/o/oauth2/iframerpc?action=issueToken&response_type=token%20id_token&login_hint=AJDLj…home.nest.com”

access_token: “SSID=AmASbKuA…zaryaIXixw12C3T4Z”

region: us

climate:

  • platform: badnest

    scan_interval: 10

sensor:

  • platform: badnest

that is the config and still get the same error from home assistant

The following integrations and platforms could not be set up:

  • badnest
    Please check your config.

I don’t have the
cookie: "OCAK when i follow the process

I have this :

SID
__Secure-3PSID
HSID
APISID
SAPISID
__Secure-HSID
__Secure-APISID
__Secure-3PAPISID
NID
CONSENT
user_id
GAPS
__Host-GAPS
LSID
__Host-3PLSID
ACCOUNT_CHOOSER
SIDCC

Whitch one I must use ?

Is anyone having success with cameras? I’m in the US, using the legacy Nest auth method and everything works great except that none of my 4 camers are showing up.

I just set it up again and it’s working for my Nest Hello. It’s not real video, just still images updated frequently.

What type of account are you using? Google or Nest?

Nest still…
Until they rip it from my cold dead hands…
Sorry I’m not migrating to test the Google auth. :stuck_out_tongue_winking_eye: