Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Component error: modbus #115

Closed
fuxe13 opened this issue Aug 31, 2023 · 12 comments
Closed

Component error: modbus #115

fuxe13 opened this issue Aug 31, 2023 · 12 comments

Comments

@fuxe13
Copy link

fuxe13 commented Aug 31, 2023

Component error: modbus - cannot import name 'Defaults' from 'pymodbus.constants' (/usr/local/lib/python3.11/site-packages/pymodbus/constants.py)

finde keinen fehler, bzw komme nicht zu diesem verzeichnis

@pos-ei-don
Copy link

Kommentiere in der configuration.yml die modbus Einträge aus dann geht's wieder. Ist natürlich maximal ein workaround.

@fuxe13
Copy link
Author

fuxe13 commented Sep 1, 2023

Habe ich gemacht, bzw. neue yaml angelegt..dann kam dieser fehler:

Invalid config for [influxdb]: [modbus] is an invalid option for [influxdb]. Check: influxdb->influxdb->modbus. (See /config/configuration.yaml, line 23).

aus der conig ab zeile 23:
influxdb:
username: xxxx
password: xxxx
tags:
source: HA
tags_attributes:
- friendly_name
default_measurement: state
exclude:
entities:
- zone.home
domains:
- persistent_notification
- person
include:
domains:
- sensor
- binary_sensor
- sun
- light
- cover
entities:
- weather.home

@TonyLar
Copy link

TonyLar commented Sep 4, 2023

I got the same problem. Modbus stopped working 2-3 weeks ago. As a workaround I have comment out all modbus code in configuration.yaml to be able to restart Home Assistant. So at the moment modbus is not working for me.

Even only this one line stops Home Assistant from restarting (or loading modbus support)

"...

modbus:

..."

@sfstar
Copy link
Owner

sfstar commented Sep 4, 2023

Please test the beta v0.1.4 release of this interation (this is a copy paste reply which isn't customized for each issue v.0.1.4 is attempting to adres).
Make sure that (in cae this applies to you) the core modbus integration is also fully enabled after bumping to version 0.1.4 and let me know if the issue persists.

@TonyLar
Copy link

TonyLar commented Sep 5, 2023

After installing the Beta and re-enabling "modbus: " the code validation of configuration.yaml goes on forever so its not possible to use modbus yet.
(The Victron integration seems to work ok as it did with v0.1.3)

@sfstar
Copy link
Owner

sfstar commented Sep 5, 2023

Thank you for testing @TonyLar.
To double check, the issue you are experiencing is still the
Component error: modbus - cannot import name 'Defaults' from 'pymodbus.constants' (/usr/local/lib/python3.11/site-packages/pymodbus/constants.py?

If so what version of HA core are you running?
Have you upgrade home assistant core after upgrading this integration? (if so the suggestion at the end might not work for you)
Do you have any other modbus configuration in your instance with the core modbus integration?
Do you have any other custom integrations active that communicate over modbus (if so could you name them?)

What I think might have happened is that with hass-victron v0.1.3 an incompatible pymodbus library was installed that breaks your core modbus integration for the ha core version you are running.
Since HA has had multiple breaking version bumps for some of the pymodbus functionality in the releases since 2023.7 an specific core version could help narrow down the issue.
Having any other modbus components next to this integration and the core modbus integration could result in the suggestion at the end not working since that custom integration could enforce an older version of pymodbus. (in which case that integration should also be patched).

If you are able to access the ha console of your instance via either an attached monitor/keyboard and mouse (or via this addon https://community.home-assistant.io/t/home-assistant-community-add-on-ssh-web-terminal/33820)
Please execute the following command:

ha core rebuild

This will let homeassistant check if there were modifications to it's image after starting up.
If an integration (like the previous version of this integration originally did) installs an differing library than was provided by the base image it will result in the image being redownloaded and restarted.

This will ensure that an different pymodbus version that was installed by (the previous version of) this integration is wiped.
Please let me know if the issue persists after attempting the provided core command.

@TonyLar
Copy link

TonyLar commented Sep 5, 2023

Thanks for your quick response and excellent explanation. Here are the versions I'm running:
Home Assistant 2023.8.4
Supervisor 2023.08.1
Operating System 10.5
Frontend-version: 20230802.1 - latest

I've have two solarpanel installations that I've been monitoring without any problem for about a year. Since the Victron integration only can be configured to communicate with one Cerbo GX I have been using modbus to communicate with my second Cerbo GX. I have no other modbus configurations. I will try the ha core rebuild later today.

@TonyLar
Copy link

TonyLar commented Sep 5, 2023

Now I have executed ha core rebuild but unfortunately the issue persist. The only difference I see between v0.1.3 och v0.1.4 is when I enable "modbus:" in configuration.yaml:
With v0.1.3 I get the error message "Component error: modbus - cannot import name 'Defaults' from 'pymodbus.constants' (/usr/local/lib/python3.11/site-packages/pymodbus/constants.py"

With v.0.1.4 the code validation hangs (goes on forever) so there is no error message.

Maybe the different behavior can be a clue?

@DigitalPals
Copy link

DigitalPals commented Sep 5, 2023

Looking forward to see a fix for this, I have the same issue. I reverted back to Home Assistant 2023.8.1 to fix this issue.

Edit: I think this might be related: home-assistant/core#98692

@TonyLar
Copy link

TonyLar commented Sep 6, 2023

Update: After update and total restart I got both modbus and the Victron integration running again. I'm using v0.1.4 together with:
Home Assistant 2023.8.4
Supervisor 2023.08.3
Operating System 10.5 Frontend-version: 20230802.1 - latest

The validation of configuration.yaml also is ok.

Just been up for a few minutes now but I'll hope it will be stable now :-)

@DigitalPals
Copy link

I can confirm that v0.14 fixed my issues also, running 2023.8.4 without issues. Thanks!

@TonyLar
Copy link

TonyLar commented Sep 6, 2023

Thanks for all support!

@sfstar sfstar closed this as completed Sep 6, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants