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

ha.UnitOfFrequency.HERTZ error #1161

Closed
lutfijw opened this issue May 15, 2024 · 5 comments · Fixed by #1165
Closed

ha.UnitOfFrequency.HERTZ error #1161

lutfijw opened this issue May 15, 2024 · 5 comments · Fixed by #1165

Comments

@lutfijw
Copy link

lutfijw commented May 15, 2024

after updating to the latest HomeAssistant stable version 2024.5.3, OCPP integration is failing due to unknown unit in const.py file.
I need to delete the ha.UnitOfFrequency.HERTZ due to it caused and error. Seem like Home Assistant is deleting the HERTZ unit.

@leonetnl
Copy link

Same issue here

@lutfijw
Copy link
Author

lutfijw commented May 15, 2024

As interim, you can delete the ha.UnitOfFrequency.HERTZ in const.py file and restart HA. Not sure if it will impact others functionalities but mine worked good. After restart, the integration successfully loaded.

@drc38
Copy link
Collaborator

drc38 commented May 15, 2024

Seems strange as UnitOfFrequency.HERTZ still exists in HA. Can you revert and post the error logs?

@martenjacobs
Copy link

martenjacobs commented May 15, 2024

@drc38 I'm having the same issue. I think this is due to the ocpp package having released 1.0.0, which doesn't have the hertz UoM anymore: https://github.com/mobilityhouse/ocpp/blob/1.0.0/ocpp/v16/enums.py#L713C7-L713C20
The full error (for me at least) is as follows:


Logger: homeassistant.loader
Source: loader.py:1041
First occurred: 21:41:15 (2 occurrences)
Last logged: 21:41:15

Unexpected exception importing component custom_components.ocpp
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1041, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 144, in protected_loop_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/ocpp/__init__.py", line 13, in <module>
    from .api import CentralSystem
  File "/config/custom_components/ocpp/api.py", line 52, in <module>
    from .const import (
  File "/config/custom_components/ocpp/const.py", line 121, in <module>
    UnitOfMeasure.hertz: ha.UnitOfFrequency.HERTZ,
    ^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'UnitOfMeasure' has no attribute 'hertz'

@drc38
Copy link
Collaborator

drc38 commented May 16, 2024

Thanks, the issue is with the ocpp library latest release see mobilityhouse/ocpp#207 rather than HA 2024.5.3. The fix is still the same :)

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

Successfully merging a pull request may close this issue.

4 participants