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

I can’t seem to get my google issue_token and cookie correct.

2020-01-11 07:08:37 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2020-01-11 07:08:37 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for badnest which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2020-01-11 07:08:38 ERROR (MainThread) [homeassistant.setup] Error during setup of component badnest
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/setup.py”, line 176, 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 49, in setup
region,
File “/config/custom_components/badnest/api.py”, line 54, in init
self.login()
File “/config/custom_components/badnest/api.py”, line 72, in login
self._login_google(self._issue_token, self._cookie)
File “/config/custom_components/badnest/api.py”, line 93, in _login_google
access_token = r.json()[‘access_token’]
KeyError: ‘access_token’
2020-01-11 07:08:38 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform badnest.climate: Unable to set up component.

Got it working. Had to switch to google login. Would not work with Nest login.

Thanks @vinodmishra your fix brought my cameras back!

Not working with nest login this is the error:

> Error during setup of component badnest
> Traceback (most recent call last):
>   File "/usr/src/homeassistant/homeassistant/setup.py", line 176, 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 49, in setup
>     region,
>   File "/config/custom_components/badnest/api.py", line 54, in __init__
>     self.login()
>   File "/config/custom_components/badnest/api.py", line 74, in login
>     self._login_nest(self._email, self._password)
>   File "/config/custom_components/badnest/api.py", line 81, in _login_nest
>     self._user_id = r.json()["userid"]
> KeyError: 'userid'

I have disabled f2a and i do not have googlelized my nest account. Do i need to convert it?

Yep, if there won’t be any update which solves the captcha, the only solution for now is migration to Google account.

Uhm… if i migrate account i loose my ifttt integration right?

No idea, i stopped using IFTTT few years ago (especially Nest hadn’t anything special in applets if i remember correctly).
But if you have HA, sky is the limit for control things - there is even IFTTT integration for HA so if you need IFTTT, try Nest -> HA -> IFTTT.

Great, migrating the account making it works. I can find only the entity thermostat and not sensors, i have to manully add it? How? Sorry for the noob question…

Do you have

sensor:
  - platform: badnest

in your configuration.yaml?

Yes this is my config:

badnest:
  issue_token: "https://accounts.google.com/o/oauth2/iframerpc?"
 cookie: "..."
  region: eu

climate:
  - platform: badnest
    scan_interval: 10

sensor:
  - platform: badnest
  

Unfortunately I cannot find it under entities.

Anyone have a solution?

Template them out?

  - platform: badnest
  - platform: template
    sensors:
      hallway_thermometer:
        friendly_name: "Hallway Temperature"
        unit_of_measurement: 'C'
        value_template: "{{ state_attr('climate.yourdevicehere', 'current_temperature') | round(0) }}"
        device_class: "temperature"

I have to put your code under
Sensor:

  • platform: badnest

?

Yes apologies, I missed a line. Here is my config -

climate:
  - platform: badnest
    scan_interval: 10
sensor:
  - platform: badnest
  - platform: template
    sensors:
      hallway_thermometer:
        friendly_name: "Hallway Temperature"
        unit_of_measurement: 'C'
        value_template: "{{ state_attr('climate.yourdevicehere', 'current_temperature') | round(0) }}"
        device_class: "temperature"
  - platform: template
    sensors:
      hallway_thermometer_humidity:
        friendly_name: "Hallway Humidity"
        unit_of_measurement: '%'
        value_template: "{{ state_attr('climate.yourdevicehere', 'current_humidity') | round(0) }}"
        device_class: "humidity"

Ooooh, sorry, i missunderstood your question. I though you meant Protect sensors.

The attributes of the thermostat really must be “templated out”. :grinning: (there is also another way but this one is easier)

now it works :smiley:

I’ve only just started down the HA path in the last week or so with no prior understanding or experience at all. I got this up an running with a little bit of reading/understanding and following directions. I couldn’t get it to work with an old Nest account (no 2FA), but once I switched it to a Google account then all was good.

The thing I like the most though is that I can now tell Siri to set the Nest to a certain temperature as I have HA sending everything over to HomeKit and it all works without a hitch.

Thanks for all the hard work!

Have you fixed this problem with your hello cam? I’ve the same issue

Hi. No, I haven’t solved this one yet! Working on it. Hope I get some answers :wink: