Closed lutfijw closed 5 months ago
Same issue here
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.
Seems strange as UnitOfFrequency.HERTZ
still exists in HA. Can you revert and post the error logs?
@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'
Thanks, the issue is with the ocpp library latest release see https://github.com/mobilityhouse/ocpp/issues/207 rather than HA 2024.5.3. The fix is still the same :)
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.