home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.78k stars 30.04k forks source link

ADS integration since Version 2022.7.1 the ADS interface is not working anymore #74952

Closed bluenobbe closed 3 months ago

bluenobbe commented 2 years ago

The problem

Since Version 2022.7.1 the ADS interface is not working anymore

Unexpected exception importing component homeassistant.components.ads Unexpected exception importing platform homeassistant.components.ads.cover Unexpected exception importing platform homeassistant.components.ads.switch Unexpected exception importing platform homeassistant.components.ads.light Unexpected exception importing platform homeassistant.components.ads.sensor

What version of Home Assistant Core has the issue?

2022.7.1

What was the last working version of Home Assistant Core?

2022.6.7

What type of installation are you running?

Home Assistant Core

Integration causing the issue

ADS Twincat

Link to integration documentation on our website

https://www.home-assistant.io/integrations/ads/

Diagnostics information

Since Version 2022.7.1 the ADS interface is not working anymore:

Logger: homeassistant.loader Source: components/ads/init.py:10 First occurred: 14:44:51 (96 occurrences) Last logged: 14:45:02

Unexpected exception importing component homeassistant.components.ads Unexpected exception importing platform homeassistant.components.ads.cover Unexpected exception importing platform homeassistant.components.ads.switch Unexpected exception importing platform homeassistant.components.ads.light Unexpected exception importing platform homeassistant.components.ads.sensor Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/loader.py”, line 618, in get_platform cache[full_name] = self._import_platform(platform_name) File “/usr/src/homeassistant/homeassistant/loader.py”, line 635, in _import_platform return importlib.import_module(f"{self.pkg_path}.{platform_name}") 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 992, in _find_and_load_unlocked File “”, line 241, in _call_with_frames_removed 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 “/usr/src/homeassistant/homeassistant/components/ads/init.py”, line 10, in import pyads File “/usr/local/lib/python3.10/site-packages/pyads/init.py”, line 12, in from .ads import open_port, close_port, get_local_address, read_state, File “/usr/local/lib/python3.10/site-packages/pyads/ads.py”, line 18, in from .pyads_ex import ( File “/usr/local/lib/python3.10/site-packages/pyads/pyads_ex.py”, line 82, in _adsDLL = ctypes.CDLL(adslib) File “/usr/local/lib/python3.10/ctypes/init.py”, line 374, in init self._handle = _dlopen(self._name, mode) OSError: Error relocating /usr/local/lib/python3.10/site-packages/pyads/adslib.so: unsupported relocation type 7

Example YAML snippet

Anything in the logs that might be useful for us?

Since Version 2022.7.1 the ADS interface is not working anymore:

Logger: homeassistant.loader
Source: components/ads/init.py:10
First occurred: 14:44:51 (96 occurrences)
Last logged: 14:45:02

Unexpected exception importing component homeassistant.components.ads
Unexpected exception importing platform homeassistant.components.ads.cover
Unexpected exception importing platform homeassistant.components.ads.switch
Unexpected exception importing platform homeassistant.components.ads.light
Unexpected exception importing platform homeassistant.components.ads.sensor
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/loader.py”, line 618, in get_platform
cache[full_name] = self._import_platform(platform_name)
File “/usr/src/homeassistant/homeassistant/loader.py”, line 635, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
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 992, in _find_and_load_unlocked
File “”, line 241, in _call_with_frames_removed
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 “/usr/src/homeassistant/homeassistant/components/ads/init.py”, line 10, in
import pyads
File “/usr/local/lib/python3.10/site-packages/pyads/init.py”, line 12, in
from .ads import open_port, close_port, get_local_address, read_state,
File “/usr/local/lib/python3.10/site-packages/pyads/ads.py”, line 18, in
from .pyads_ex import (
File “/usr/local/lib/python3.10/site-packages/pyads/pyads_ex.py”, line 82, in
_adsDLL = ctypes.CDLL(adslib)
File “/usr/local/lib/python3.10/ctypes/init.py”, line 374, in init
self._handle = _dlopen(self._name, mode)
OSError: Error relocating /usr/local/lib/python3.10/site-packages/pyads/adslib.so: unsupported relocation type 7

Additional information

JVB1983 commented 2 years ago

Same problem here

Thomas-Elenco commented 2 years ago

Same for me

Bridelance commented 2 years ago

And same here Might be related to issue #74067

Probably caused by the python 3.10 upgrade somehow

reib3n commented 2 years ago

I got the same issue

birdie60 commented 2 years ago

Want to confirm that this is still an issue with v.2022.7.7 in docker.

Lipnz commented 2 years ago

Same issue here

RutkowsR commented 2 years ago

Same issue here.... core-2022.7.7

Thomas-Elenco commented 2 years ago

@epenet tagging you since you last worked on this integration. Maybe you have an idea how to fix it?

Links2004 commented 2 years ago

may this info helps https://github.com/home-assistant/core/issues/74539#issuecomment-1197721260

epenet commented 2 years ago

I do not use this integration. Please don't ping me

reib3n commented 2 years ago

Hey Guys, the bug still persists in 2022.8.0.

Is anybody working on this? I can not update until this is fixed or a workaround is possible.

This Integration is main part of my setup. By the way, its not only a docker issue. I am using Homeassistant directly on a pi ;-)

philipperequile commented 2 years ago

@C0D3-IT perhaps https://github.com/home-assistant/core/issues/74067#issuecomment-1179256015

reib3n commented 2 years ago

@philipperequile thanks for the hint. I got the workaround working now.

birdie60 commented 2 years ago

Can anyone confirm this is still an issue in 2022.8.6? Prevents me from upgrading. I'm on a pi on docker and using image homeassistant/raspberrypi3-homeassistant:stable.

reib3n commented 2 years ago

Can anyone confirm this is still an issue in 2022.8.6? Prevents me from upgrading. I'm on a pi on docker and using image homeassistant/raspberrypi3-homeassistant:stable.

Yes, I can.....

birdie60 commented 2 years ago

Well, from the workaround you mentioned in #74067, it seems to be easy to fix. Could anyone do the necessary steps in github to bring the pyads lib patch into next HA stable release? I'm no developer.

jandeschuttere commented 2 years ago

I too think it's rather easy however I have not yet identified the building logic that supplies these dependencies for the different architectures. Don't know if someone can give some pointers?

probot-home-assistant[bot] commented 2 years ago

ads documentation ads source (message by IssueLinks)

reib3n commented 1 year ago

@jandeschuttere: How is it going on this? Can I help you with something?

jandeschuttere commented 1 year ago

Thx for following up, I've been skimming through some of the repositories that could be related to building (see as well possible related PR that linked to this) but I haven't actually identified where the py-wheel is being created and where it might use a cached or incorrect arch version. Not sure if you have some notion on where to look?

philipperequile commented 1 year ago

Perhaps @stlehmann can help? I found some other issues with pyads-3.2.2-py3-none-any.whl.

zimbrich commented 1 year ago

Can anyone confirm this is still an issue in 2022.10.5? I'm on a Raspberry Pi 4 . I don't have a lot of Python experience but have been working with ADS for over 17 years. I am happy to help in any way I can. I had this working with a CX1010 up until it was broken in one of the releases earlier this year. I would like to get back to using this but for now, I have it commented out in config yaml.

alemonta commented 1 year ago

Can anyone confirm this is still an issue in 2022.10.5? I'm on a Raspberry Pi 4 . I don't have a lot of Python experience but have been working with ADS for over 17 years. I am happy to help in any way I can. I had this working with a CX1010 up until it was broken in one of the releases earlier this year. I would like to get back to using this but for now, I have it commented out in config yaml.

I confirm, still an issue both for RBPi3 and Pi4. I have a strong experience on Beckhoff Systems and very little on Linux-based platforms, but with the inputs from this thread and a couple of basic tutorials on Docker, I got rid of the issue: every time I update the core I have to fix it again... so since July I made a lot of practice!

reib3n commented 1 year ago

Thx for following up, I've been skimming through some of the repositories that could be related to building (see as well possible related PR that linked to this) but I haven't actually identified where the py-wheel is being created and where it might use a cached or incorrect arch version. Not sure if you have some notion on where to look?

Mmhhh.... not really. I dont have any experience with building logic... If I can help you with anything else, let me know.

LievenDHaese commented 1 year ago

Can anyone confirm this is still an issue in 2022.10.5? I'm on a Raspberry Pi 4 . I don't have a lot of Python experience but have been working with ADS for over 17 years. I am happy to help in any way I can. I had this working with a CX1010 up until it was broken in one of the releases earlier this year. I would like to get back to using this but for now, I have it commented out in config yaml.

I confirm, still an issue both for RBPi3 and Pi4. I have a strong experience on Beckhoff Systems and very little on Linux-based platforms, but with the inputs from this thread and a couple of basic tutorials on Docker, I got rid of the issue: every time I update the core I have to fix it again... so since July I made a lot of practice!

@alemonta, could you clarify what exactly you do to get it working again? I tried lots of things, but can's seem to resolve it.

alemonta commented 1 year ago

I just answered here: https://github.com/home-assistant/core/issues/74067#issuecomment-1404813985

the steps I did (starting from homeassistant 2022.05 where ADS is still perfectly working):

docker cp homeassistant:/usr/local/lib/python3.9/site-packages/pyads /pyads_3.9_backup

cp /pyads_3.9_backup/pyads homeassistant:/usr/local/lib/python3.10/site-packages/

I did the 3.9 backup copy just once, and just perform the second part (update and replace) @ every core update.

hope this helps!

A.

zimbrich commented 1 year ago

This does not seem to work on a Raspberry Pi that is not running Docker. I do not have the python3.9 folder in "usr/local/lib/". But this did work previously (prior to 2022.2.7). Any suggestions?

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

birdie60 commented 1 year ago

Well, on my docker installation on a raspberry pi, this is still an issue. There still is an error in the build process regarding pyads for this docker image. Other than the workaround from @alemonta, which needs to be done every time a new home assistant version is installed, this is still unsolved.

briersc commented 1 year ago

Here is also the same problem on my RBPI. Regards

alemonta commented 1 year ago

problem still present even with the latest core version 2023.06.2 almost a year, now... ☹️

mrpasztoradam commented 1 year ago

The issue still present. Please take a look at it! Thanks!

iDonya commented 1 year ago

The issue still present 2023.8.4

SamuelO488 commented 10 months ago

Any news? does someone know if it works with 2023.11?

windows97 commented 10 months ago

It doesn't work on my side with 2023.11. To me it looks like it's currently stucking here: https://github.com/stlehmann/pyads/pull/363

stlehmann commented 10 months ago

I wrote the integration originally but haven't been into it for a long time, now. It seems the adsllib.so hasn't been built properly hence it can' t be found in the directory. @windows97 did you try the solution proposed in https://github.com/stlehmann/pyads/pull/363?

windows97 commented 10 months ago

@windows97 did you try the solution proposed in stlehmann/pyads#363?

No, I didn't. Just started with HomeAssistant two weeks ago and recognized hat I can't interact with the PLC. ☹️

aichingerk commented 7 months ago

Any news? It doesn't work on my side with Core 2024.2.1 Supervisor 2024.01.1 Operating System 11.5

issue-triage-workflows[bot] commented 4 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

birdie60 commented 4 months ago

Still not fixed, unfortunately.

windows97 commented 4 months ago

Issue still not fixed. Looks like this issue will be fixed, once https://github.com/home-assistant/core/pull/116934 is successfully merged.

alemonta commented 3 months ago

@frenck
Thank you and to all the crew: it works like a charm, now! 🎉🎉🎉