Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to install the integration (outdated push_receiver library?) #345

Closed
matthijs opened this issue Aug 13, 2022 · 11 comments
Closed

Fails to install the integration (outdated push_receiver library?) #345

matthijs opened this issue Aug 13, 2022 · 11 comments

Comments

@matthijs
Copy link

Please check Services, Known Bug / Issues and Troubleshooting over here first: https://github.com/fuatakgun/kia_uvo/blob/master/README.md
Region and Brand of car
Region: EU
Car: Hyundai Kona

Describe the bug
Fails to setup the integration

Debug logs if an error occurred

Outlined here: https://github.com/fuatakgun/kia_uvo/blob/master/README.m

2022-08-13 21:47:18.271 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing platform custom_components.kia_uvo.config_flow
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/loader.py", line 657, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/loader.py", line 674, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/homeassistant/.homeassistant/custom_components/kia_uvo/__init__.py", line 25, in <module>
    from .utils import DEFAULT_DISTANCE_UNIT_ARRAY, get_default_distance_unit
  File "/home/homeassistant/.homeassistant/custom_components/kia_uvo/utils.py", line 13, in <module>
    from .KiaUvoApiEU import KiaUvoApiEU
  File "/home/homeassistant/.homeassistant/custom_components/kia_uvo/KiaUvoApiEU.py", line 11, in <module>
    import push_receiver
  File "/srv/homeassistant/lib/python3.9/site-packages/push_receiver/__init__.py", line 1, in <module>
    from .push_receiver import *
  File "/srv/homeassistant/lib/python3.9/site-packages/push_receiver/push_receiver.py", line 11, in <module>
    from .mcs_pb2 import *
  File "/srv/homeassistant/lib/python3.9/site-packages/push_receiver/mcs_pb2.py", line 33, in <module>
    _descriptor.EnumValueDescriptor(
  File "/srv/homeassistant/lib/python3.9/site-packages/google/protobuf/descriptor.py", line 755, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
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
2022-08-13 21:47:18.313 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading configuration flow for integration kia_uvo: Exception importing custom_components.kia_uvo.config_flow

To Reproduce
Steps to reproduce the behavior:

  1. Install the most recent version of home assistant
  2. Enable hacs
  3. Go to: Community -> Integrations
  4. Search the integration and install / download it.
  5. Go to: Configuration -> 'Devices & Services'
  6. Click on 'Add integration', locate the integration and install
  7. See error in the home-assistant.log

Expected behavior
Integration installed.

Additional context
It looks like an error in the push_receiver python library. This library seems to be outdated (its archived on github.com) so I guess it is not maintained anymore.

I've looked around for a replacement of this library but I could not find one (yet).

@fuatakgun
Copy link
Member

This is not good at all, and i am out for vacation for a week. Do you think you can raise a pr for this?

@matthijs
Copy link
Author

For now I've fixed the issue by using the _pb2.py files from this repository: https://github.com/olijeffers0n/push_receiver/tree/master/push_receiver

Now it works fine, but that's obviously not a good solution.

I can create a PR for this, but I am a bit worried about the way to go here:

  1. Look for an alternative push_receiver library (this would be my first look anyway, I really dont like to duplicate code)
  2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python as suggested in the error message (communication will be slower)
  3. Drop the import on push_receiver and integrate the push_receiver code from the repository linked above.
  4. Implement a push_receiver library?

@fuatakgun
Copy link
Member

We might not need this dependency anymore, i remember of switching into -1 as GUID rather than its response. Maybe we can just remove the dependency?

@fuatakgun
Copy link
Member

Or you on EU or some other region, because this is actually used for EU login sequence.

https://github.com/fuatakgun/kia_uvo/blob/42e80de4a9f94e1290942c8a9145e99410892c88/custom_components/kia_uvo/KiaUvoApiEU.py#L161

You have definitely experience on solving issues :-) so, if you are on EU, you can remove the dependency and see if it would work.

If you are not from EU, please skip it, i will try to spend some time in upcoming days.

@matthijs
Copy link
Author

I am from the Netherlands (EU). I'll try removing the dependency. Lets see if that works out correctly.

@matthijs
Copy link
Author

Ok, I've now disabled get_device_id function on line 120 and set the device_id to None. I'll wait a few hours to see if it has any negative side effects.

@matthijs
Copy link
Author

Too bad, that didn't work. After trying to set up the integration it failed with 'invalid device id' when fetching the vehicle.

@cdnninja
Copy link
Collaborator

Is this ongoing? Odd we haven't seen others report it.

@filipzlamala
Copy link

I have exactly the same issue as @matthijs. I am from the Slovakia (EU).

Home Aassistant version:

Home Assistant 2022.10.3
Frontend 20221010.0 - latest

Home Assistant is running on Xubuntu 22.04, Jammy Jellyfish. Tomorrow I can share more detailed information about my system and versions if it helps :).

This error originated from a custom integration.

Logger: homeassistant.loader
Source: custom_components/kia_uvo/KiaUvoApiEU.py:11
Integration: Kia Uvo / Hyundai Bluelink (documentation, issues)
First occurred: 09:57:33 (1 occurrences)
Last logged: 09:57:33

Unexpected exception importing platform custom_components.kia_uvo.config_flow
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.10/site-packages/homeassistant/loader.py", line 722, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/srv/homeassistant/lib/python3.10/site-packages/homeassistant/loader.py", line 739, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  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 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  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 "/home/homeassistant/.homeassistant/custom_components/kia_uvo/__init__.py", line 25, in <module>
    from .utils import DEFAULT_DISTANCE_UNIT_ARRAY, get_default_distance_unit
  File "/home/homeassistant/.homeassistant/custom_components/kia_uvo/utils.py", line 13, in <module>
    from .KiaUvoApiEU import KiaUvoApiEU
  File "/home/homeassistant/.homeassistant/custom_components/kia_uvo/KiaUvoApiEU.py", line 11, in <module>
    import push_receiver
  File "/srv/homeassistant/lib/python3.10/site-packages/push_receiver/__init__.py", line 1, in <module>
    from .push_receiver import *
  File "/srv/homeassistant/lib/python3.10/site-packages/push_receiver/push_receiver.py", line 11, in <module>
    from .mcs_pb2 import *
  File "/srv/homeassistant/lib/python3.10/site-packages/push_receiver/mcs_pb2.py", line 33, in <module>
    _descriptor.EnumValueDescriptor(
  File "/srv/homeassistant/lib/python3.10/site-packages/google/protobuf/descriptor.py", line 755, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
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

@cdnninja
Copy link
Collaborator

cdnninja commented Nov 2, 2022

I don't believe this is required in the alpha version 2.0. Could you enable beta versions in HACS and download the 2.X stream to try?

@filipzlamala
Copy link

Oh, my bad, I had 1.x version. Now it's working like a charm. Thank you :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants