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

ok, worked it out =) A bit of a hassle, but at least it works (dont know for how long).
How come it is available on HOOBs but not on HA? Setup for the plugin looks similar to what “bad nest” had when it worked

It does not tell which one is CO and which is another type of detection (fire?)
Interestingly that I have read that Nest protect has all these sensors, yet they are not exposed.
Temperature
Humidity
Motion (120° field of view up to 20 feet)
Ambient light
Accelerometer
Microphone

Could have been a fantastic product for the price if they allowed access to all the data

Look here. It’s way up in the thread.

Should restarting HA be sufficient for badnest to scan for any new thermostats? I am using the old Nest auth (can’t move to Google auth yet due to custom domain email) and I’ve tried to comment/uncomment out Badnest from my config but it still won’t pick up the new thermostat added to the same account…

Rene,
When you are using the HOOBS integration with Nest, are you able to control the humidity level?

Has anyone found a way to control the nest humidity setting through Home Assistant?

I have a HOOBS container setup with Nest integration configured. When I go to add the HomeKit Controller in HA I get an error saying “No unpaired devices could be found”. Any idea on what I could be doing wrong?

I got the Homebridge method working with my VirtualBox HA setup. It’s a little convoluted, but not too terrible.

Use this tutorial to install Portainer and Homebridge:

There is a lot of mention of Raspberry Pi, but if you follow this post it will work on all other systems

Once you have Homebridge setup, you will login into homebridge http://homeassistantIP:8581 with admin / blank password. Create a secure password. Go to plugins, install ‘Homebridge-nest’. The setup for the Nest plugin is pretty much the same as BadNest.

HA will automatically detect Homebridge and the Nest components. On HA’s first detection of Homebridge you will be asked for a pairing pin. Go to Homebridge and look under Config for pin.

that’s it.

just ran across activity on this thread…for anyone still interested i have a copy of the original reddragon badnest repo setup here:

this code has been working flawlessly for me with a nest v2 and v3 thermostat in the same home for the past 2yrs. in fact, my first login token lasted something like 20mo before i had to renew it. it worked on pretty much every ha version up to 2021.3.4 where i had to sit for awhile due to another integration issue, but i recently updated to 2021.11.5 and so far so good.

bear in mind my nest account has never been upgraded to a google login so ymmv.

2 Likes

Since this is the main thread that you encounter when you search nest integrations I will post it here.

The original USA_RedDragon badnest repo is forever gone. People copied and forked it.

I have Nest Protect (no thermostat or bell, unfortunately) and I needed more extensive support for it. I wanted the Nest Protect motion sensor to be included and occupancy, check its health status and replacement date. Basicaly have more data in proper binary sensors with device classes. I also have wired version and want to know when the power goes out to battery backup.

So I added bunch of the Nest Protect features in my fork:

The component works with Google account (I have never had a previous Nest account). Bear in mind, I am not a python programmer so it’s not all efficient probably, but hey it gets the sensors from API. so its a win.
Feel free to copy whatever you need, or can install it via HACS, but I don’t guarantee maintenance and can’t speak about the thermostat or camera.
Hafe fun

3 Likes

Hi,
Did you update to 2022.02?
I’m with the original custom integration and I’m seeing this error with my Nest Thermostat:
ImportError: cannot import name 'ClimateDevice' from 'homeassistant.components.climate' (/usr/src/homeassistant/homeassistant/components/climate/__init__.py)
Any hints?

EDIT:
For the benefit of whomever posteriors that are going to land here, to fix the issue you need to change ClimateDevice with ClimateEntity in the confg\custom_components\badnest\climate.py file (use whatever text editor you like). It will appear twice:

Line 5:

from homeassistant.components.climate import ClimateDevice

Line 81:

class NestClimate(ClimateEntity):

Enjoy!

3 Likes

@OscarHanzely , this looks fantastic! I also only have Nest Protect smoke alarm / CO detectors and just started looking around for a HA integration, so your message is very timely! I was just about to install a different badnest when I ran across this thread and your post.

I have integrated it from HACS, and then rebooted my HA. I have the legacy/original Nest account login still. I added the following code to my configuration.yaml:

badnest:
  user_id: <my_userid>
  access_token: <my_accesstoken>
  region: us

sensor:
  - platform: badnest

The configuration file checks as OK (so I know I have the integration implemented) and I restarted HA again.

However, I have no devices or entities that show up. Am I missing anything? Is there anything in the logs I can look for? Any other ideas? Could it be the legacy Nest account? Maybe I should upgrade my account to a Google login? I was resisting that as I didn’t think it was a good idea, but…if I can get your integration to work, then that’s all I want.

Thanks,

For the Nest Protects you need to add the following under the binary sensor configuration

binary_sensor:
# Binary sensors for Nest
  - platform: badnest

But you also need to update the file /config/custom_components/badnest/binary_sensor.py

In this file you need to replace all the occurences of the text “BinarySensorDevice” with “BinarySensorEntity”

Interesting, that should not be needed in my branch. The main integration relies only on the badnest configuration.

Are you referring to my repository ? Because it is done wia two imports with preference to BinarySensorEntity already. So there is;t a place to change. Which line No you are referring to ? If that’s the case I can update the repo.

1 Like

I have not touched the authenticaiton mechanism, so that’s harder to figure out for me.

Do you see anything in the logs? I would set the HA logs to warning and restart.

logger:
  default: warning

I have it configured exactly as you have. However I have never had legacy account.
I do not have an entry in binary_sensor.yaml as the sensors are loaded all at the same time. sensor.* and bianry_sensor.*

Mind you I am by no means a python developer and this was first component I refactored in HA so there may be some issue to fix. Logs would definitely be helpful.

1 Like

I’m using the one from https://github.com/sgowal/badnest. The main reason to use a badnest integration, is for my protects, because my thermostat is connected using the regular nest integration and that one doesn’t support the protects (thanks to Google).

Due to the amount of forks I might get a little lost.

Ok I see, well most forks that I encountered were at least a couple of years old and did not support the nest protect. So I created my own and it works fine for me now.

I also wanted the motion detection which none of the other forks including the one you use has supported :frowning:

1 Like

@OscarHanzely Great, thanks. I did set the logger to warning and restarted. I found this in one of the logs (under Configuration->Settings->Logs):

Logger: homeassistant.setup
Source: custom_components/badnest/api.py:81
Integration: badnest (documentation)
First occurred: 11:21:22 PM (1 occurrences)
Last logged: 11:21:22 PM

Error during setup of component badnest
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 229, in _async_setup_component
    result = await task
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/badnest/__init__.py", line 53, in setup
    "api": NestAPI(user_id, access_token, issue_token, cookie, 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'

Maybe this can make some sense to you? As I pasted earlier above in my config, I do have a “user_id” in the badnest: section. Maybe this does indeed have something to do with the legacy Nest login?

Thanks again for your work, and help!

Thank you, I appears the issue was trying to log into old nest account with google credentials. I do not have that type of account so it might have slipped since I have no way to test it. I did some cleanup, in the update, it should be clearly distinguished. You can try it with HACS update.

Wow, thanks for the quick response! I updated the integration through HACS and then restarted HA. Unfortunately, what I see in the logs is the same exact thing…? I’m not sure if there is anything more for me to do, that I may have missed. And unfortunately, I’m not a Python developer, so even though you say you’re a novice, you have expertise beyond me. But I am willing to learn!
I have no idea how where to find this code on my system, or how to debug it, but I will help in any way I can as I do want to learn and also try to get this installed. Probably not relevant to this discussion, so if you want to message me directly I will get to work on figuring this out.

Thanks again for the changes and update.

Are you authenticating with email and password or token ?

There’s clearly something with the old nest platform response upon login. Seems they don’t return the variable in JSON anymore. Unfortunately, I do not have the old account, never had, so it’s kinda tricky. Literally a guessing game. I could check other libraries if any of them was updated recently to accommodate any changes in that matter, but if not, then you would need to figure out what is the response coming from the login.

I use a username and password at home.nest.com. It then sends a verification text with a 6 digit code. Maybe that is what is making it incompatible?
I think I’ll bit the bullet and upgrade my account to Google. Then we should be in the same situation.
Thanks for the help,