alexdelprete / ha-abb-powerone-pvi-sunspec

HA Custom Component to integrate data from ABB/Power-One/FIMER PV Inverters that support SunSpec Modbus (Sunspec M1, M101, M103, M160), natively or through the VSN300 wifi logger card.
MIT License
24 stars 5 forks source link

Unable to import component: No module named 'pymodbus.client.sync' after upgrade to 2022.10.3 and/or OS 9.2 #31

Closed Claudio1L closed 2 years ago

Claudio1L commented 2 years ago

recently I started to see error msgs after the reboot. Usually after one or two try the error disapper and working fine. Today I'm not able to make it works. Looks like a module is missing. Could be one of recent updates?

2022-10-14 08:22:57.839 ERROR (MainThread) [homeassistant.setup] Setup failed for custom integration abb_powerone_pvi_sunspec: Unable to import component: No module named 'pymodbus.client.sync'

Claudio1L commented 2 years ago

full log here:

2022-10-14 10:02:44.745 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing component custom_components.abb_powerone_pvi_sunspec Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/loader.py", line 703, 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 "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/config/custom_components/abb_powerone_pvi_sunspec/init.py", line 9, in from pymodbus.client.sync import ModbusTcpClient File "/usr/local/lib/python3.10/site-packages/pymodbus/client/sync.py", line 166, in class ModbusTcpClient(BaseModbusClient): File "/usr/local/lib/python3.10/site-packages/pymodbus/client/sync.py", line 170, in ModbusTcpClient def init(self, host='127.0.0.1', port=Defaults.Port, AttributeError: type object 'Defaults' has no attribute 'Port' 2022-10-14 10:02:44.749 ERROR (MainThread) [homeassistant.setup] Setup failed for custom integration abb_powerone_pvi_sunspec: Unable to import component: Exception importing custom_components.abb_powerone_pvi_sunspec

Claudio1L commented 2 years ago

looks like python disappeared? immagine

Claudio1L commented 2 years ago

reverted back to a snapshot with OS 9.0 and it worked.

It is something related to OS 9.2

Claudio1L commented 2 years ago

Same issue after reboot with 9.0 Also.

seems related to 3.0.0 pymodbus recently updated https://github.com/home-assistant/operating-system/issues/2188

alexdelprete commented 2 years ago

seems related to 3.0.0 pymodbus recently updated

The component uses a pinned version of pymodbus, so the upgrade of pymodbus should not have effect.

{
  "domain": "abb_powerone_pvi_sunspec",
  "name": "ABB Power-One PVI SunSpec",
  "documentation": "https://github.com/alexdelprete/ha-abb-powerone-pvi-sunspec",
  "issue_tracker": "https://github.com/alexdelprete/ha-abb-powerone-pvi-sunspec/issues",
  "requirements": ["pymodbus==1.5.2"],
  "dependencies": [],
  "codeowners": ["@alexdelprete"],
  "iot_class": "local_polling",
  "config_flow": true,
  "version": "1.0"
}

I'm on HA Core 2022.10.3 and don't have this issue when restarting.

Claudio1L commented 2 years ago

Any advice on how to proceed ?

Have same issue in two integrations using same component. The second one is:

https://github.com/wills106/homeassistant-solax-modbus/issues/154 https://github.com/wills106/homeassistant-solax-modbus/issues/154

Thanks Claudio

On 14 Oct 2022, at 22:47, Alessandro Del Prete @.***> wrote:

seems related to 3.0.0 pymodbus recently updated

The component uses a pinned version of pymodbus, so the upgrade of pymodbus should not have effect.

{ "domain": "abb_powerone_pvi_sunspec", "name": "ABB Power-One PVI SunSpec", "documentation": "https://github.com/alexdelprete/ha-abb-powerone-pvi-sunspec", "issue_tracker": "https://github.com/alexdelprete/ha-abb-powerone-pvi-sunspec/issues", "requirements": ["pymodbus==1.5.2"], "dependencies": [], "codeowners": @.***"], "iot_class": "local_polling", "config_flow": true, "version": "1.0" } — Reply to this email directly, view it on GitHub https://github.com/alexdelprete/ha-abb-powerone-pvi-sunspec/issues/31#issuecomment-1279450002, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXK6MPQAXQZMBKYTI7C2QCDWDHBGTANCNFSM6AAAAAARE5ZI3I. You are receiving this because you authored the thread.

alexdelprete commented 2 years ago

Maybe the problem is this: the solax integration doesn't use a pinned version of pymodbus, so this could probably install pymodbus 3.0, that is not compatible with my integration, and I think that is not compatible also with solax integration because 3.0 is a breaking change release.

Test this: uninstall both integrations and restart. then reinstall mine (ABB) and restart, check if it works. If it does, then the problem is the conflict on the pymodbus version requirement of the two integrations.

Claudio1L commented 2 years ago

Don't understand why but it was a conflict with the Bluetooth usb key I recently added. Removing the key and the bluetooth integration is working consistently fine. At the moment I can live without it. My apologise for the confusion

Claudio1L commented 2 years ago

after update to 2.1.0 issue appeared again on bot integration. I'm lost, I had to rollback to the previous snapshot. Before rolling back, I tried to remove everything form integration page and redownloading from hacs, ABB integration (2.1.0) was working fine, Solax integration refused to install for missing pymodbus.client.sync. I'll reopen the bug on Solax beacause it seems it have issue with pymodbus 3.0.0.

alexdelprete commented 2 years ago

You have to tell other devs to update their components to latest pymodbus 3.0. That's what I did.

Claudio1L commented 2 years ago

Confirmed. They just released a beta to address this issue and seems working fine. Thank you for the support