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

I am using the Nest access token method and when I updated to version 0.0.3 the component is not working

I finally now can see my temperature sensors through my home thanks to this custom component. I’m only using it for this but I’m quite happy!

Moved over to the new repo but still not seeing my second thermostat…I’ve got 3 Protects, 1 Nest Temp Sensor and 1 out 2 TStat’s showing. I’m at a loss not sure what else I can do?

Have you tried this?

Cameras seemed to have stopped working for me now. Been stable for a long time

I’ve just updated to 0.03 and it’s still working for me. Have you tried generating a new cookie, Nest might have an expiry date on them.

Its back now after about 3 days of being AWOL. Several reinstalls of badnest and multiple cache clearing seems to have done the trick.

1 Like

I had Badnest working, then it broke. I have been focused don getting other automations setup hop[ing it would fix itself, but it didn’t. I am using a nest account. When I inspect the session info, I find my user id and two different access tokens:

“access_token”:“b.593853.cNRwOKq3x2Ybuz87pFZciqTVVQT…”
and
“access_token”:“lQkANQEwAQhoTLgj9FGvuyQCBDcDLA…”

Unfortunately, neither seems to work.

Log details:
Logger: homeassistant.setup
Source: custom_components/badnest/api.py:138
First occurred: 12:35:36 PM (1 occurrences)
Last logged: 12:35:36 PM

Error during setup of component badnest
Traceback (most recent call last):
File “/config/custom_components/badnest/api.py”, line 67, in wrapper
func(*args, **kwargs)
File “/config/custom_components/badnest/api.py”, line 204, in _get_devices
self._check_request®
File “/config/custom_components/badnest/api.py”, line 138, in _check_request
raise AuthorizationRequired
custom_components.badnest.api.AuthorizationRequired

During handling of the above exception, another exception occurred:

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 119, in init
self._get_devices()
File “/config/custom_components/badnest/api.py”, line 71, in wrapper
func(*args, **kwargs)
File “/config/custom_components/badnest/api.py”, line 204, in _get_devices
self._check_request®
File “/config/custom_components/badnest/api.py”, line 138, in _check_request
raise AuthorizationRequired
custom_components.badnest.api.AuthorizationRequired
Connection lost. Reconnecting…

I don’t want to convert to a google account yet, but I have a feeling it’s only a matter of time. Any ideas on what I’m doing wrong?

Same here. Was working, updated, rebooted, and then broken. Haven’t tried tackling it yet , but on a reboot I’m getting this message

Invalid config
The following integrations and platforms could not be set up:

badnest
badnest.sensor
badnest.camera
Please check your config.

EDIT: Just pulled my user id and access code again and still broken. I’m using the Nest login not Google.

Support for Nest authentication was removed some time back, it’s Google accounts only for now. I’ve updated the docs to reflect that along with some other tweaks.

1 Like

Hey Matt. I’m afraid your fork doesn’t work for me either. I’m using a Google account, I’ve generated the cookie etc, all seems fine. The customer_component loads fine and no errors in HA seen. I’ve been using the original one from USA-RedDragon just fine, but wanted to upgrade to yours because of the ClimateEntity -> ClimateDevice move.

I did notice the logs show this Warning, guess this is why it wouldn’t update:
WARNING (MainThread) [homeassistant.components.climate] Updating badnest climate took longer than the scheduled update interval 0:00:10
This shows every 10 seconds, so basically it never updates.

I’ve moved back to the original one which instantly started working, hence login/cookie are fine.
Thanks!

I was going to post something saying I couldn’t get it working but then as I had the post ready to go, I realized I had issue-token instead of issue_token. Thank you to everyone for the work on this! One question I do have is, I’m only using these with the Nest Protects (sensor) and these only show as entities with no device associated. Is this normal?

Thank you! This repo GitHub - mattsch/badnest: A bad Nest integration that uses the web api to work after Works with Nest was shut down. worked for me. I followed the instructions for Google Authentication and the rest of the steps plus a HA restart between every step lol … I restarted HA after adding the repo to HACS, then again after adding the config entries.

Could someone list the steps to switch from redDragon to mattsch version? I have my Nest Thermostat working fine on RedDragon so do’t want to stuff I up!

Im pretty sure you just replace the badnest folder in the custom_components folder and restart. Should be gtg.

1 Like

This is what I did:

  1. Uninstall badnest and delete reddragon’s repository from HACS
  2. Restart HA (I know, sounds excessive but you never know lol)
  3. Delete badnest config entries
  4. Restart HA
  5. Delete thermostat entity from HA
  6. Add mattsch repository to HACS https://github.com/mattsch/badnest
  7. Install badnest from HACS
  8. Restart HA
  9. Add back config entries
  10. Restart HA
    That worked for a few minutes. Thermostat and my two cameras showed but then they all started failing. Since I re-used the same token and cookie I decided to get a new one for this new install.
  11. Log out from home.nest.com and get a new token and cookie. Add them to the config.
  12. Restart HA

Now my thermostat and two cameras have worked correctly so far.

Hello,

Followed the instruction and install seem to work fine and my Nest Thermostats (3 of them) show up and controllable.

However, my Nest Protects doesn’t show up and also none of the Nest Thermostats sensors show up…any pointer will be appreciated.

thx

I have version 0.0.4 on HA 0.110.3 and am seeing this in the Logs:

Logger: homeassistant.helpers.entity
Source: custom_components/badnest/api.py:134
First occurred: 4 June 2020, 23:56:00 (20 occurrences)
Last logged: 16:01:19

Update for sensor.hallway_thermostat fails
Update for climate.hallway_thermostat fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 472, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  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/sensor.py", line 84, in update
    self.device.update()
  File "/config/custom_components/badnest/api.py", line 76, in wrapper
    return func(*args, **kwargs)
  File "/config/custom_components/badnest/api.py", line 292, in update
    self._get_names()
  File "/config/custom_components/badnest/api.py", line 76, in wrapper
    return func(*args, **kwargs)
  File "/config/custom_components/badnest/api.py", line 279, in _get_names
    self._check_request(r)
  File "/config/custom_components/badnest/api.py", line 134, in _check_request
    raise AuthorizationRequired
custom_components.badnest.api.AuthorizationRequired

My Lovelace card is working fine for my Nest (can change temp etc) so not understanding why there would be an Authorization issue??

That’s “normal”. There’s a race condition I haven’t had time to dig in to yet, but the traceback can be ignored.

Can anybody confirm the different states of the nest protect smoke and CO detectors? I read earlier in this thread that they are 0 for OK, 2 for warning and 3 for alert, but my current state just shows is “Ok” so I assume this has changed since then?

Nevermind, I found it in the code

    def _map_nest_protect_state(self, value):
        if value == 0:
            return "Ok"
        elif value == 1 or value == 2:
            return "Warning"
        elif value == 3:
            return "Emergency"
        else:
            return "Unknown"