Hyundai-Kia-Connect / kia_uvo

A Home Assistant HACS integration that supports Kia Connect(Uvo) and Hyundai Bluelink. The integration supports the EU, Canada and the USA.
MIT License
413 stars 85 forks source link

Unexpected exception importing component custom_components.kia_uvo #633

Open Ruzo opened 1 year ago

Ruzo commented 1 year ago

The kia_uvo integration shows an error every few HA updates. I wait for the next update and it usually fixes things. I'm reporting this one just in case it can help with other issues.

Home Assistant 2023.4.5 Supervisor 2023.04.0 Operating System 10.0 Frontend 20230411.1 - latest

TUCSON HYBRID by Hyundai Connected via [TUCSON] Firmware: 20210724

Log Details

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: April 18, 2023 at 12:56:51 PM (2 occurrences)
Last logged: 5:21:29 PM

Unexpected exception importing component custom_components.kia_uvo
Unexpected exception importing platform custom_components.kia_uvo.config_flow
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 760, in get_component
    cache[self.domain] = importlib.import_module(self.pkg_path)
  File "/usr/local/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 "/config/custom_components/kia_uvo/__init__.py", line 25, in <module>
    from .utils import DEFAULT_DISTANCE_UNIT_ARRAY, get_default_distance_unit
  File "/config/custom_components/kia_uvo/utils.py", line 13, in <module>
    from .KiaUvoApiEU import KiaUvoApiEU
  File "/config/custom_components/kia_uvo/KiaUvoApiEU.py", line 11, in <module>
    import push_receiver
  File "/usr/local/lib/python3.10/site-packages/push_receiver/__init__.py", line 1, in <module>
    from .push_receiver import *
  File "/usr/local/lib/python3.10/site-packages/push_receiver/push_receiver.py", line 11, in <module>
    from .mcs_pb2 import *
  File "/usr/local/lib/python3.10/site-packages/push_receiver/mcs_pb2.py", line 33, in <module>
    _descriptor.EnumValueDescriptor(
  File "/usr/local/lib/python3.10/site-packages/google/protobuf/descriptor.py", line 796, 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 commented 1 year ago

Version of the integration and region?

phsdt commented 1 year ago

I have the same issue: Error occurred loading flow for integration kia_uvo: Exception importing custom_components.kia_uvo.config_flow 09:13:43 – (FEHLER) config_entries.py - Die Nachricht ist zum ersten Mal am 09:13:06 aufgetreten und erscheint 2 mal Unexpected exception importing component custom_components.kia_uvo 09:13:43 – (FEHLER) kia_uvo (benutzerdefinierte Integration) - Die Nachricht ist zum ersten Mal am 19. April 2023 um 19:46:45 aufgetreten und erscheint 6 mal Home Assistant 2023.4.5 Supervisor 2023.04.0 Operating System 10.0 Frontend 20230411.1 - latest Germany Occured after last update

I don't know the Integration version, but the error also appears when trying to add the integration to HA.

Ruzo commented 1 year ago

Version of the integration and region?

I'm in the USA. Where can I find the version?

EDIT: Actually, it says version 1.7.0 in the manifest.json of the component. I also don't know why the source in the log says custom_components/kia_uvo/KiaUvoApiEU.py when I'm in the US.

cdnninja commented 1 year ago

Update to the latest in HACS and see what happens.

Ruzo commented 1 year ago

Update to the latest in HACS and see what happens.

Alright. I see the version as 2.8.1 on GitHub. This must mean that there has not been any update notification through HACS. Do I need to re-install?

phsdt commented 1 year ago

Update to the latest in HACS and see what happens.

I was able to install a new Hyundai integration and remove the old one.

cdnninja commented 1 year ago

HACS should offer updates. If not you can go into HACS and force it.

Ruzo commented 1 year ago

I could not delete it so I downloaded the integration from HACS again and restarted HA. Now the version in manifest.json does show 2.8.1 but I have 2 devices named TUCSON: One with Manufacturer Hyundai (no entities) and the other with Manufacturer Hyundai USA (has all the sensors).

cdnninja commented 1 year ago

Does the new device appear to work?

Ruzo commented 1 year ago

Yes. It works better than the previous one. I was missing out on a lot without the updates. However, the old one is still there but without any entities. Is there a way to manually remove it without removing both?

cdnninja commented 1 year ago

Yes, I am bit confused how that was created but I am sure we can clean it up. So to confirm it is a second device that shows unavailable on all sensors?

Ruzo commented 1 year ago

No. It just says "This device has no entities" even though my automations were based on this device. I had to change everything to the new device.

cdnninja commented 1 year ago

I'll have to do some research. Manual cleanup is most likely best. Does it let you delete the device?

Ruzo commented 1 year ago

I'll have to do some research. Manual cleanup is most likely best. Does it let you delete the device?

Even though it did not work when there was one device, I still have the option to delete but for both devices together. There are no separate delete options.