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

[Bug]: No module named 'pymodbus.message' #873

Closed
5 tasks done
screamer3003 opened this issue Jan 3, 2025 · 63 comments
Closed
5 tasks done

[Bug]: No module named 'pymodbus.message' #873

screamer3003 opened this issue Jan 3, 2025 · 63 comments
Labels
bug Something isn't working

Comments

@screamer3003
Copy link

screamer3003 commented Jan 3, 2025

Describe the issue

After the Update to 2025.1.0 I Get this error

Logger: homeassistant.setup
Quelle: setup.py:334
Erstmals aufgetreten: 21:28:29 (1 Vorkommnisse)
Zuletzt protokolliert: 21:28:29

Setup failed for custom integration 'huawei_solar': Unable to import component: No module named 'pymodbus.message'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 334, in _async_setup_component
component = await integration.async_get_component()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1035, in async_get_component
self._component_future.result()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1015, in async_get_component
comp = await self.hass.async_add_import_executor_job(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
self._get_component, True
^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/loader.py", line 1075, in _get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.13/importlib/init.py", line 88, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 1026, in exec_module
File "", line 488, in _call_with_frames_removed
File "/config/custom_components/huawei_solar/init.py", line 9, in
from huawei_solar import (
...<9 lines>...
)
File "/usr/local/lib/python3.13/site-packages/huawei_solar/init.py", line 4, in
from .bridge import (
...<6 lines>...
)
File "/usr/local/lib/python3.13/site-packages/huawei_solar/bridge.py", line 34, in
from .huawei_solar import (
...<5 lines>...
)
File "/usr/local/lib/python3.13/site-packages/huawei_solar/huawei_solar.py", line 19, in
from pymodbus.message.rtu import MessageRTU
ModuleNotFoundError: No module named 'pymodbus.message'

Describe your Huawei Solar Setup

Inverter Type:
Inverter Firmware version:
sDongle present: Yes / No
sDongle Type: sDongleA-05 (WiFi / Ethernet) / SDongleA-03 (4G)
sDongle Connectivitiy: WiFi / Ethernet / 4G
sDongle Firmware:
Power meter present: three phase / single phase / no
Optimizers Present: Yes / No
Battery: LUNA2000-SO xxkWh / LUNA2000-S1 xxkWh (Released 2024) / LG RESU xxkWh / None
Battery Firmware version:
Huawei Solar integration version:

How do you connect to the inverter?

Via the SDongle, wired connection

Upload your Diagnostics File

Drag & Drop your Diagnostics File here.

Upload your relevant debug logs

Logger: homeassistant.setup
Quelle: setup.py:334
Erstmals aufgetreten: 21:28:29 (1 Vorkommnisse)
Zuletzt protokolliert: 21:28:29

Setup failed for custom integration 'huawei_solar': Unable to import component: No module named 'pymodbus.message'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 334, in _async_setup_component
    component = await integration.async_get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1035, in async_get_component
    self._component_future.result()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1015, in async_get_component
    comp = await self.hass.async_add_import_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        self._get_component, True
        ^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1075, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.13/importlib/__init__.py", line 88, 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 1026, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/huawei_solar/__init__.py", line 9, in <module>
    from huawei_solar import (
    ...<9 lines>...
    )
  File "/usr/local/lib/python3.13/site-packages/huawei_solar/__init__.py", line 4, in <module>
    from .bridge import (
    ...<6 lines>...
    )
  File "/usr/local/lib/python3.13/site-packages/huawei_solar/bridge.py", line 34, in <module>
    from .huawei_solar import (
    ...<5 lines>...
    )
  File "/usr/local/lib/python3.13/site-packages/huawei_solar/huawei_solar.py", line 19, in <module>
    from pymodbus.message.rtu import MessageRTU
ModuleNotFoundError: No module named 'pymodbus.message'

Please confirm the following:

  • I'm running the latest release of Home Assistant.
  • I'm running the latest release of this integration.
  • I did not find an existing issue describing this problem.
  • I did upload the diagnostics-file that I could retrieve from the 'Devices & Services Page'
  • I did upload the relevant debug logs (via 'Enable Debug Logging'-feature or by manually configuring HA logging)
@screamer3003 screamer3003 added the bug Something isn't working label Jan 3, 2025
@wlcrs
Copy link
Owner

wlcrs commented Jan 3, 2025

Warning

Users that use the native modbus-integration alongside this integration should not upgrade to Home Assistant 2025.1, as it contains an upgrade to an incompatible version 3.7.4 of the pyModbus library. Significant work has already been done to upgrade this integration to support v3.8.0 of this library. We expect this to release alongside Home Assistant 2025.2, which is expected to also upgrade to that latest pyModbus version. This will solve the compatibility issue.

@wlcrs wlcrs pinned this issue Jan 3, 2025
@wlcrs wlcrs changed the title [Bug]: Setup failed for custom integration 'huawei_solar': Unable to import component: No module named 'pymodbus.message' [Bug]: HA 2025.01: Setup failed for custom integration 'huawei_solar': Unable to import component: No module named 'pymodbus.message' Jan 4, 2025
@Criaga
Copy link

Criaga commented Jan 4, 2025

@wlcrs
Hi, sorry but I'm not very expert. So you don't have to update to the new version 2025.1?

@xm4rcell0x
Copy link

Second this bug.
Hard to revert to 2024.12.5 and is working well.

@jwcappeln
Copy link

Yes, i downgrade core as well without restore a backup.
ha core update --version 2024.12.5

@jomach
Copy link

jomach commented Jan 4, 2025

same here. I just rollback the upgrade without any issues

@ablyes
Copy link

ablyes commented Jan 4, 2025

Same problem for me.
I have modbus for my hitachi heat pump and this plugin for the huawei converter.
Is it possible to have a quick fix ?

@jomach
Copy link

jomach commented Jan 4, 2025

@ablyes downgrade with the command: "ha core update --version 2024.12.5"

@ablyes
Copy link

ablyes commented Jan 4, 2025

I don’t have any backup.
Is this command working without ? With any type of installation ? I have a virtual machine under a synology.

image

@ablyes
Copy link

ablyes commented Jan 4, 2025

Your command worked.
Reading this command makes me understand that it doesn't rely on any backup. Just reach the asked version and install it.
Thank you so much. I have my HA in a good state.
I'll wait for an update of the HACS.

@luzik
Copy link

luzik commented Jan 5, 2025

Sorry for hate but this is the only integration I ever used that ask me for a downgrade. HA 2025.1 is also related to security updates. Now I can't downgrade because of others updated integration that requires now HA 2025.1
You ask me to check all installed integration README before HA upgrade? or only huawei_solar ? That's stupid!

@Aljosha89
Copy link

Sorry for hate but this is the only integration I ever used that ask me for a downgrade. HA 2025.1 is also related to security updates. Now I can't downgrade because of others updated integration that requires now HA 2025.1 You ask me to check all installed integration README before HA upgrade? or only huawei_solar ? That's stupid!

wlcrs is making huge effort to support this integration, your comment is untimely. If you do not like how the integration is handled you should not use it.

@mariusnauj
Copy link

@wlcrs if it works with 2025.01 version of HA if I am using network type integration via inverter wi-fi?

@luzik
Copy link

luzik commented Jan 5, 2025

Don't get me wrong, I love this integration, just wanted to show that some things are important for some people.
This is how I'm using it
tablet – Home Assistant

@netmb
Copy link

netmb commented Jan 5, 2025

Did you pay a penny for the software? Probably not. Accordingly, you have no claims whatsoever against the author. If the software is so important to you, program it yourself. Some people's sense of entitlement really pisses me off. Remember: the author created this in his free time, so we don't have to stress him out. If you can do better: Let's go.

@mariusnauj
Copy link

mariusnauj commented Jan 5, 2025

Hello,

Maybe somebody who tryied can answer:

if it works with 2025.01 version of HA if I am using network type integration via inverter wi-fi?

@luzik
Copy link

luzik commented Jan 5, 2025

Did you pay a penny for the software? Probably not. Accordingly, you have no claims whatsoever against the author. If the software is so important to you, program it yourself. Some people's sense of entitlement really pisses me off. Remember: the author created this in his free time, so we don't have to stress him out. If you can do better: Let's go.

So I’ve got an idea to contribute a bit.
@wlcrs, if you upgrade any branch to include the already updated huawei-solar-lib, which supports the new pymodbus, just add the requirement "homeassistant": "2025.2.0b0" in hacs.json. I’ll update my HA to the 2025.2 beta dev version and test the integration with my setup as much as my hardware allows.

@luzik
Copy link

luzik commented Jan 5, 2025

Helio,

Maybe somebody who tryied can answer:

if it works with 2025.01 version of HA if I am using network type integration via inverter wi-fi?

I believe that it does not work

@mimusato
Copy link

mimusato commented Jan 5, 2025

Hello,

Maybe somebody who tryied can answer:

if it works with 2025.01 version of HA if I am using network type integration via inverter wi-fi?

For me it fails with:

Error setting up entry SUN2000-4KTL-L1 for huawei_solar
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 640, in __async_setup_with_context
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/huawei_solar/init.py", line 207, in async_setup_entry
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2278, in async_forward_entry_setups
await integration.async_get_platforms(platforms)
File "/usr/src/homeassistant/homeassistant/loader.py", line 1185, in async_get_platforms
import_future.result()
~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1185, in async_get_platforms
import_future.result()
~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1185, in async_get_platforms
import_future.result()
~~~~~~~~~~~~~~~~~~~~^^
[Previous line repeated 1 more time]
File "/usr/src/homeassistant/homeassistant/loader.py", line 1173, in async_get_platforms
platforms.update(self._load_platforms(platform_names))
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1098, in _load_platforms
platform_name: self._load_platform(platform_name)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1272, in _load_platform
cache[full_name] = self._import_platform(platform_name)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1304, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.13/importlib/init.py", line 88, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 1026, in exec_module
File "", line 488, in _call_with_frames_removed
File "/config/custom_components/huawei_solar/sensor.py", line 16, in
from homeassistant.const import (
...<8 lines>...
)
ImportError: cannot import name 'ENERGY_KILO_WATT_HOUR' from 'homeassistant.const' (/usr/src/homeassistant/homeassistant/const.py)


Note: a similar error has been fixed in another repo - https://github.com/tggm/rointe-hacs/pull/15/files

@mimusato
Copy link

mimusato commented Jan 5, 2025

Never mind, I was running an old version. After upgrading to 1.4.1 it seems to work well.

@mariusnauj
Copy link

Never mind, I was running an old version. After upgrading to 1.4.1 it seems to work well.

What version of HA, and what type of integration?

@mimusato
Copy link

mimusato commented Jan 5, 2025

#What version of HA, and what type of integration?#

HA version 2025.1.0. Using integration via inverter wi-fi.

@0x442E472E
Copy link

0x442E472E commented Jan 5, 2025

huawei_solar 1.5.0b1 seems to work great for me with HA 2025.1.0! Thank you, @wlcrs :)

Edit: Ok, sadly it doesn't. This integration works now, but my own modbus sensors do not.

@Criaga
Copy link

Criaga commented Jan 5, 2025

Good evening, sorry but you have to be patient 😅
I read that it works for some and for others it doesn't.
I'm connected via the Dongle's IP and I would like to know if I can update to version 2025.1
Thk

@Barbarul
Copy link

Barbarul commented Jan 5, 2025

Yes, i downgrade core as well without restore a backup. ha core update --version 2024.12.5

Rolled back with your command, and not it works fine. I will skip this core version.

@ThomDietrich
Copy link

Thanks for all your work on this component! 🎉

To contribute and for potential troubleshooting. I am on HA 2025.01 and using the latest 1.5.0b2, this is the error I am faced with:

Setup failed for custom integration 'huawei_solar': Unable to import component: No module named 'pymodbus.pdu.register_message'

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 334, in _async_setup_component
    component = await integration.async_get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1035, in async_get_component
    self._component_future.result()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1015, in async_get_component
    comp = await self.hass.async_add_import_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        self._get_component, True
        ^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1075, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.13/importlib/__init__.py", line 88, 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 1026, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/huawei_solar/__init__.py", line 21, in <module>
    from huawei_solar import (
    ...<9 lines>...
    )
  File "/usr/local/lib/python3.13/site-packages/huawei_solar/__init__.py", line 4, in <module>
    from .bridge import (
    ...<6 lines>...
    )
  File "/usr/local/lib/python3.13/site-packages/huawei_solar/bridge.py", line 34, in <module>
    from .huawei_solar import (
    ...<5 lines>...
    )
  File "/usr/local/lib/python3.13/site-packages/huawei_solar/huawei_solar.py", line 20, in <module>
    from pymodbus.pdu.register_message import (
    ...<2 lines>...
    )
ModuleNotFoundError: No module named 'pymodbus.pdu.register_message'

@mariusnauj
Copy link

After upgrading HA to 2025.1.1 integration not working:

Setup failed for custom integration 'huawei_solar': Unable to import component: cannot import name 'ModbusRequest' from 'pymodbus.pdu' (/usr/local/lib/python3.13/site-packages/pymodbus/pdu/init.py)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 1015, in async_get_component
comp = await self.hass.async_add_import_executor_job(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
self._get_component, True
^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/loader.py", line 1075, in _get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.13/importlib/init.py", line 88, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 1026, in exec_module
File "", line 488, in _call_with_frames_removed
File "/config/custom_components/huawei_solar/init.py", line 20, in
from huawei_solar import (
...<4 lines>...
)
File "/usr/local/lib/python3.13/site-packages/huawei_solar/init.py", line 3, in
from .bridge import HuaweiSolarBridge
File "/usr/local/lib/python3.13/site-packages/huawei_solar/bridge.py", line 28, in
from .huawei_solar import (
...<5 lines>...
)
File "/usr/local/lib/python3.13/site-packages/huawei_solar/huawei_solar.py", line 17, in
from pymodbus.message.rtu import MessageRTU
File "/usr/local/lib/python3.13/site-packages/pymodbus/message/init.py", line 7, in
from pymodbus.message.message import Message, MessageType
File "/usr/local/lib/python3.13/site-packages/pymodbus/message/message.py", line 15, in
from pymodbus.message.rtu import MessageRTU
File "/usr/local/lib/python3.13/site-packages/pymodbus/message/rtu.py", line 12, in
from pymodbus.factory import ClientDecoder
File "/usr/local/lib/python3.13/site-packages/pymodbus/factory.py", line 15, in
from pymodbus import bit_read_message as bit_r_msg
File "/usr/local/lib/python3.13/site-packages/pymodbus/bit_read_message.py", line 15, in
from pymodbus.pdu import ModbusRequest, ModbusResponse
ImportError: cannot import name 'ModbusRequest' from 'pymodbus.pdu' (/usr/local/lib/python3.13/site-packages/pymodbus/pdu/init.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 334, in _async_setup_component
component = await integration.async_get_component()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1035, in async_get_component
self._component_future.result()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1027, in async_get_component
comp = self._get_component()
File "/usr/src/homeassistant/homeassistant/loader.py", line 1075, in _get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.13/importlib/init.py", line 88, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 1026, in exec_module
File "", line 488, in _call_with_frames_removed
File "/config/custom_components/huawei_solar/init.py", line 20, in
from huawei_solar import (
...<4 lines>...
)
File "/usr/local/lib/python3.13/site-packages/huawei_solar/init.py", line 3, in
from .bridge import HuaweiSolarBridge
File "/usr/local/lib/python3.13/site-packages/huawei_solar/bridge.py", line 28, in
from .huawei_solar import (
...<5 lines>...
)
File "/usr/local/lib/python3.13/site-packages/huawei_solar/huawei_solar.py", line 17, in
from pymodbus.message.rtu import MessageRTU
File "/usr/local/lib/python3.13/site-packages/pymodbus/message/init.py", line 7, in
from pymodbus.message.message import Message, MessageType
File "/usr/local/lib/python3.13/site-packages/pymodbus/message/message.py", line 15, in
from pymodbus.message.rtu import MessageRTU
File "/usr/local/lib/python3.13/site-packages/pymodbus/message/rtu.py", line 12, in
from pymodbus.factory import ClientDecoder
File "/usr/local/lib/python3.13/site-packages/pymodbus/factory.py", line 15, in
from pymodbus import bit_read_message as bit_r_msg
File "/usr/local/lib/python3.13/site-packages/pymodbus/bit_read_message.py", line 15, in
from pymodbus.pdu import ModbusRequest, ModbusResponse
ImportError: cannot import name 'ModbusRequest' from 'pymodbus.pdu' (/usr/local/lib/python3.13/site-packages/pymodbus/pdu/init.py)

@mariusnauj
Copy link

I am using native pymodbus integration for my Komfovent device. SO after installed 2025.1.1 Huawei integration stop working

@jomach
Copy link

jomach commented Jan 23, 2025

Is someone on ha core actively working on this? Seems to block a lot of people now 2025.1.3 is out now

@wlcrs
Copy link
Owner

wlcrs commented Jan 23, 2025

My PR's that upgrade pyModbus to v3.8.3 and fix some compatibility issues due to pyModbus API changes in the core modbus-integration have been accepted in HA Core yesterday. These code changes will be released with HA 2025.2 . Do not expect to see any fixes in 2025.1.x releases.

This will fix the compatibility issue between this integration (starting from v1.5.0) and the core modbus-integration: both will use the same pyModbus version 3.8.3, fixing the crashes due to an incompatible pyModbus version being present.

Please note that if you are using another custom integration which relies on an incompatible pyModbus version (ie. 3.7.x), then that integration will need to upgrade it's pyModbus dependency to 3.8.3 to restore compatibility with the versions which HA Core and this integration expect.

Side note: my contributions on HA Core have brought me into contact with some core maintainers. I have raised the issue of pyModbus version changes potentially breaking this and other integrations. While there is easy solution to this - it's a limitation of how Python libraries are installed - they are at least aware of the implications. Having a direct line will hopefully allow me to coordinate better to prevent issues like this one.

@Lyngaae
Copy link

Lyngaae commented Jan 23, 2025

My PR's that upgrade pyModbus to v3.8.3 and fix some compatibility issues due to pyModbus API changes in the core modbus-integration have been accepted in HA Core yesterday. These code changes will be released with HA 2025.2 . Do not expect to see any fixes in 2025.1.x releases.

This will fix the compatibility issue between this integration (starting from v1.5.0) and the core modbus-integration: both will use the same pyModbus version 3.8.3, fixing the crashes due to an incompatible pyModbus version being present.

Please note that if you are using another custom integration which relies on an incompatible pyModbus version (ie. 3.7.x), then that integration will need to upgrade it's pyModbus dependency to 3.8.3 to restore compatibility with the versions which HA Core and this integration expect.

Side note: my contributions on HA Core have brought me into contact with some core maintainers. I have raised the issue of pyModbus version changes potentially breaking this and other integrations. While there is easy solution to this - it's a limitation of how Python libraries are installed - they are at least aware of the implications. Having a direct line will hopefully allow me to coordinate better to prevent issues like this one.

@wlcrs Thank you for your work with this issue and this integration. It is much appreciated from my side.

@joergwi123
Copy link

Vielen Dank für deine Arbeit. Dann hoffen wir mal, dass 2025.2 blad kommt.

@ThomDietrich
Copy link

Thanks @wlcrs for going through all this trouble and resolving the issues.

I can confirm that with the latest dev release from today both my huawei_solar as well as yaml defined modbus sensors work as expected again! Thank you!

@iBLtz
Copy link

iBLtz commented Jan 24, 2025

Thank you for the work behind :)

@FistandantilusDD
Copy link

Hi,

after I had installed the latest beta 1.5.02b yesterday the integration was working again. Today I had to do some changes on a standard modbus integration and after reboot I again got the issue that the component could not be loaded. Attaching the log for further details:

`Logger: homeassistant.setup
Quelle: setup.py:334
Erstmals aufgetreten: 15:04:45 (1 Vorkommnisse)
Zuletzt protokolliert: 15:04:45

Setup failed for custom integration 'huawei_solar': Unable to import component: No module named 'pymodbus.pdu.register_message'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 334, in _async_setup_component
component = await integration.async_get_component()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1035, in async_get_component
self._component_future.result()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1015, in async_get_component
comp = await self.hass.async_add_import_executor_job(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
self._get_component, True
^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/loader.py", line 1075, in _get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.13/importlib/init.py", line 88, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1331, in _find_and_load_unlocked
File "", line 935, in _load_unlocked
File "", line 1026, in exec_module
File "", line 488, in _call_with_frames_removed
File "/config/custom_components/huawei_solar/init.py", line 21, in
from huawei_solar import (
...<9 lines>...
)
File "/usr/local/lib/python3.13/site-packages/huawei_solar/init.py", line 4, in
from .bridge import (
...<6 lines>...
)
File "/usr/local/lib/python3.13/site-packages/huawei_solar/bridge.py", line 34, in
from .huawei_solar import (
...<5 lines>...
)
File "/usr/local/lib/python3.13/site-packages/huawei_solar/huawei_solar.py", line 20, in
from pymodbus.pdu.register_message import (
...<2 lines>...
)
ModuleNotFoundError: No module named 'pymodbus.pdu.register_message'`

@Joeknx
Copy link

Joeknx commented Jan 29, 2025

My PR's that upgrade pyModbus to v3.8.3 and fix some compatibility issues due to pyModbus API changes in the core modbus-integration have been accepted in HA Core yesterday. These code changes will be released with HA 2025.2 . Do not expect to see any fixes in 2025.1.x releases.

This will fix the compatibility issue between this integration (starting from v1.5.0) and the core modbus-integration: both will use the same pyModbus version 3.8.3, fixing the crashes due to an incompatible pyModbus version being present.

Please note that if you are using another custom integration which relies on an incompatible pyModbus version (ie. 3.7.x), then that integration will need to upgrade it's pyModbus dependency to 3.8.3 to restore compatibility with the versions which HA Core and this integration expect.

Side note: my contributions on HA Core have brought me into contact with some core maintainers. I have raised the issue of pyModbus version changes potentially breaking this and other integrations. While there is easy solution to this - it's a limitation of how Python libraries are installed - they are at least aware of the implications. Having a direct line will hopefully allow me to coordinate better to prevent issues like this one.

I'm on HA 2025.2.0b0 and 1.5.0b2 but it still does not work.

@ThomDietrich
Copy link

ThomDietrich commented Jan 30, 2025

Just an fyi for everyone who switch to the dev branch. As we are closing in on the 2025.2 stable release, be sure to switch back to the stable branch now.

ha supervisor options --channel stable
ha supervisor reload

@wlcrs wlcrs marked this as a duplicate of #895 Jan 31, 2025
@wlcrs
Copy link
Owner

wlcrs commented Jan 31, 2025

v1.5.0 of this integration has been released. This version depends on pyModbus v3.8, restoring compatibility with the native modbus-integration in HA 2025.2.

I will close this issue once HA 2025.2 is officially released next week.

Important

If you are using another (custom) integration which also relies on pyModbus then the compatibility issues will persist until the other integration is also upgraded to pyModbus v3.8.
Our policy is to keep our pyModbus version compatible with that used by the modbus-integration in HA Core. We expect other (custom) integration maintainers to do the same.

So if your HA installation is still broken after upgrading to HA 2025.2 and v1.5.0 of this integration due to the error Unable to import component: No module named 'pymodbus.<xyz>':

  1. Determine which other (custom) integration uses pyModbus
  2. Contact the maintainers and ask them to upgrade to pyModbus v3.8
  3. Wait for a new release of that integration to restore overall compatibility .

Caution

Note that the compatibility issues with other (custom) integrations can seem to be intermittent, as the pyModbus version will always be determined by the last integration with a pyModbus-dependency to be installed on your HA.
Please refrain from adding comments to this issue / creating new issues with messages like 'it started working again after upgrading to vX.Y.Z', or 'it broke again after upgrading to HA vX.Y' and follow the steps listed above instead.

@mariusrga
Copy link

Is this version supposed to work with HA 2025.1.4 and newer?

@wlcrs wlcrs marked this as a duplicate of #916 Feb 1, 2025
@wlcrs wlcrs marked this as a duplicate of #918 Feb 1, 2025
@vwtuner
Copy link

vwtuner commented Feb 3, 2025

Thank you for the Great work.
With 2025.2.0
Huawei works 👍

@wlcrs wlcrs marked this as a duplicate of #932 Feb 4, 2025
Repository owner deleted a comment from jwcappeln Feb 5, 2025
Repository owner deleted a comment from joergwi123 Feb 5, 2025
Repository owner deleted a comment from Mckill3r Feb 5, 2025
Repository owner deleted a comment from vwtuner Feb 5, 2025
Repository owner deleted a comment from Mckill3r Feb 5, 2025
Repository owner deleted a comment from mete111home Feb 5, 2025
Repository owner deleted a comment from vwtuner Feb 5, 2025
Repository owner deleted a comment from mete111home Feb 5, 2025
Repository owner deleted a comment from MWagnerOE5AOO Feb 5, 2025
Repository owner locked as resolved and limited conversation to collaborators Feb 5, 2025
@wlcrs wlcrs changed the title [Bug]: HA 2025.01: Setup failed for custom integration 'huawei_solar': Unable to import component: No module named 'pymodbus.message' [Bug]: No module named 'pymodbus.message' Feb 6, 2025
@wlcrs wlcrs closed this as completed Feb 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests