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

A lot of us using HA will upload our configs to GitHub: https://github.com/USA-RedDragon/homeassistant-config and we make sure not to put any identifiable information in the config, and we exclude the secrets.yaml file from being uploaded. You don’t have to use secrets if you don’t share your config, but it’s not a bad idea to do so.

This is great, thanks for your hard work! Should I expect to see anything different using HACS vs. just copying the code to my custom_components dir? My HACS is having issues and not running correctly.

I have 4 cameras, HASS (hassio) sees 4 cameras, but they are all my 4th camera feed. When I look at the states they each have a different access_token, but they all have the same friendly_name of “4 - Backyard”. Any thoughts?

You shouldn’t experience any issues avoiding HACs, in fact that’s how I develop it, but I would definitely recommend using HACs for it’s versioning, and the easy ability to roll back should something go wrong.

As far as the camera stuff goes, I’ll see if I notice any logic issues, especially since 4 cameras have the same friendly name. For those of you having camera issues that I likey can’t fix, I’ll see if the person who added support for the cameras is willing to help

HI Jacob,

Both thermostats show up on home.nest.com but it doesn’t work. If there was an error message of some kind maybe ai could point you in the right direction, but there is nothing at all in the logs…, maybe add a verbose logging option ?

I use google auth. Thanks!

This is the same as me, although I cant see a feed. All the cameras are listed as Hallway, Hallway_1, Hallway_2

I would like to thank you for this. I can confirm that badnest worked with my 5 nest thermostats and mostly worked with my two cameras. The only catch I ran into was it detected one of my cameras twice and ignored the other one. However, when the detected camera is on, I was able to see the live video so that works!

  • {policy_id: “authproxy-oauth-policy”,…}
  1. embed_google_oauth_access_token: true
  2. expire_after: “3600s”
  3. google_oauth_access_token: “xxx…”
  4. policy_id: “authproxy-oauth-policy”
1 Like

Hi, Could you share your config or is it different to what I have posted above? I have a similar issue regarding the detection of the camera but have no live video.

For those of you having issues with HA going out of sync or failing shortly after starting/restarting, I’ve pushed a small fix in version 3.1.2. The changelog is below:

Changes

Bug Fixes

Maintenance

Just released 3.1.3 for a small bugfix with eco mode going on and off in HA UI.

Changes

Bug Fixes

Tom, I am new to hassio, but should you have your platform before the name in the entry above badnest?

camera:
  - platform: generic
    name: Tablet Camera
    still_image_url: http://192.168.0.25:2323/?cmd=getCamshot&password=1234
  - platform: badnest

While it is a bit weird stylistically, that’s still proper YAML. It doesn’t care about the order, just indentation and special characters like - and :

Thanks for this @USA-RedDragon ! I have it semi working in my setup. After initial setup it works for an hour, then it stops working and I keep getting this error;

Update for climate.09ab01ac14190029 fails
1:35 PM custom_components/badnest/api.py (ERROR) - message first occured at 11:17 AM and shows up 755 times

Log Details (ERROR)
Wed Oct 23 2019 13:32:49 GMT+0200 (Central European Summer Time)
Update for climate.09ab01ac14190029 fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 268, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 448, 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/climate.py", line 270, in update
    self.device.update()
  File "/config/custom_components/badnest/api.py", line 152, in update
    self._czfe_url = r.json()["service_urls"]["urls"]["czfe_url"]
KeyError: 'service_urls

Restarting HA makes it work again, until an hour later (I think I read somewhere the interval is 3600 sec)
Anything I can do to stop/fix this? Or anything I do can help you fix this?(even though I’m a complete noob with programming :slight_smile: )

1 Like

I am having the exact same issue. My thermostat is currently set to off.

Thanks everyone !!!

3.1.2 should have fixed this, but I’ll double check tonight

Thanks :slight_smile:

I had the issue on 3.1.2 and on 3.1.3
I rebooted and the issue still persists. Let me know if I can help in any way.

1 Like

Looks like the token has a lifetime of an hour, I’ll work on getting it gracefully handled

1 Like

I’ve just released the proper fix for the thermostat timeout in 3.2.1. Turns out I catch-ed the wrong exception since the Nest API doesn’t return a 403 when the token is expired.

Another major change is for the cameras. I either broke support for it (likely, since I can’t test) or fixed the issues with the identities of multiple cameras were getting muddled. I basically added the same support to it as I did for multiple thermostat support. Please test and let me know.

Changes

Bug Fixes

  • Attempt to make the camera’s use different API instances @USA-RedDragon (#24)
  • API: Handle KeyError to fix the expiration of tokens @USA-RedDragon (#23)

Cameras are definitely better! All four of my cameras are showing live unique feeds now. Only issue is that my entities still show as backyard_1, backyard_2, backyard_3, backyard_4. The attributes each have the correct friendly name, which is great. The entity_picture has camera.backyard_1, 2, 3, 4 etc. for each camera with unique access_tokens that match the friendly names. This is a minor issue for me, I am happy as is. Thank You Jacob!

1 Like