Upgrade broke Nest Thermostat (Google) integration

Hi, I recently upgraded to 2023-01 from ~2022-09 ish and lost my nest (google integration). I THINK I had already redone the new web auth method … (I would assume the Oct 3 2022 cutoff would have broken things back then if I had not?). Below is the error I get:

Running my HA in a venv on lxc/lxd

Any thoughts?

Logger: homeassistant.loader
Source: components/nest/api.py:12
First occurred: January 4, 2023 at 8:12:18 PM (1 occurrences)
Last logged: January 4, 2023 at 8:12:18 PM

Unexpected exception importing component homeassistant.components.nest
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.10/site-packages/homeassistant/loader.py", line 725, in get_component
    cache[self.domain] = importlib.import_module(self.pkg_path)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/srv/homeassistant/lib/python3.10/site-packages/homeassistant/components/nest/__init__.py", line 62, in <module>
    from . import api, config_flow
  File "/srv/homeassistant/lib/python3.10/site-packages/homeassistant/components/nest/api.py", line 12, in <module>
    from google_nest_sdm.google_nest_subscriber import GoogleNestSubscriber
  File "/srv/homeassistant/lib/python3.10/site-packages/google_nest_sdm/google_nest_subscriber.py", line 14, in <module>
    from google.api_core.exceptions import GoogleAPIError, NotFound, Unauthenticated
  File "/srv/homeassistant/lib/python3.10/site-packages/google/api_core/exceptions.py", line 29, in <module>
    from google.rpc import error_details_pb2
  File "/srv/homeassistant/lib/python3.10/site-packages/google/rpc/error_details_pb2.py", line 52, in <module>
  File "/srv/homeassistant/lib/python3.10/site-packages/google/protobuf/descriptor.py", line 560, in __new__
TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

After a little more digging, I think I am/was using “Works With Nest” … never migrated to google. Perhaps that is the issue? My yaml simply had nest: with client_id and client_Secret.

I am still using an unmigrated “Works With Nest” account successfuly with the latest Home Assistant 2023.1.1, so I don’t think that would be your issue Jack. However I am running the docker container version rather than core venv, so maybe your issue is to do with pip installed versions of google api or protobuf? I can’t help with those specifics since all that is taken care of when you use the docker container version.

Thanks for the Tip! I will dig in and see if I can force an downgrade on the package in the venv. The problem might also be the last straw with cloud based thermostat integration … just a bit challenging finding something that looks good enough for wife approval that also supports simple local wifi controls.

So I forced the lower version of the protobuf. With the venv activated:

 pip3 install protobuf==3.20.1
Collecting protobuf==3.20.1
  Using cached protobuf-3.20.1-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.1 MB)
Installing collected packages: protobuf
  Attempting uninstall: protobuf
    Found existing installation: protobuf 4.21.12
    Uninstalling protobuf-4.21.12:
      Successfully uninstalled protobuf-4.21.12
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
grpcio-status 1.51.1 requires protobuf>=4.21.6, but you have protobuf 3.20.1 which is incompatible.
Successfully installed protobuf-3.20.1

Restarted HA and despite the error … my thermostats are back!

1 Like

Wonderful, glad your thermostats are back. I compared your venv protobuf versions with the hass 2023.1.1 container: the container has the higher version and does not report errors in my setup, so maybe your google api versions needed tweaking instead (not that it matters now that all is working for you!)

Here are excerpts from a pip listing while connected to my 2023.1.1 home assistant container in case that grpcio-status compatibility error turns out to be a problem after all:

google-api-core 2.11.0
google-auth 2.15.0
google-auth-oauthlib 0.8.0
google-cloud-pubsub 2.13.11
google-cloud-texttospeech 2.12.3
google-nest-sdm 2.1.0
googleapis-common-protos 1.57.1
googlemaps 2.5.1

grpc-google-iam-v1 0.12.4
grpcio 1.51.1
grpcio-status 1.51.1

bash-5.1# python --version
Python 3.10.7