core icon indicating copy to clipboard operation
core copied to clipboard

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

Open bluenobbe opened this issue 2 years ago • 29 comments

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

bluenobbe avatar Jul 11 '22 07:07 bluenobbe

Same problem here

JVB1983 avatar Jul 11 '22 19:07 JVB1983

Same for me

Thomas-Elenco avatar Jul 11 '22 20:07 Thomas-Elenco

And same here Might be related to issue #74067

Probably caused by the python 3.10 upgrade somehow

Bridelance avatar Jul 12 '22 16:07 Bridelance

I got the same issue

reib3n avatar Jul 13 '22 12:07 reib3n

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

birdie60 avatar Jul 16 '22 19:07 birdie60

Same issue here

Lipnz avatar Aug 01 '22 09:08 Lipnz

Same issue here.... core-2022.7.7

RutkowsR avatar Aug 02 '22 14:08 RutkowsR

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

Thomas-Elenco avatar Aug 03 '22 11:08 Thomas-Elenco

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

Links2004 avatar Aug 03 '22 15:08 Links2004

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

epenet avatar Aug 06 '22 15:08 epenet

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 ;-)

reib3n avatar Aug 07 '22 11:08 reib3n

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

philipperequile avatar Aug 08 '22 14:08 philipperequile

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

reib3n avatar Aug 17 '22 19:08 reib3n

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.

birdie60 avatar Aug 25 '22 08:08 birdie60

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.....

reib3n avatar Aug 25 '22 08:08 reib3n

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.

birdie60 avatar Aug 25 '22 09:08 birdie60

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?

jandeschuttere avatar Aug 25 '22 13:08 jandeschuttere

ads documentation ads source (message by IssueLinks)

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

reib3n avatar Oct 23 '22 18:10 reib3n

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?

jandeschuttere avatar Oct 24 '22 11:10 jandeschuttere

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

philipperequile avatar Oct 24 '22 12:10 philipperequile

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.

zimbrich avatar Oct 27 '22 20:10 zimbrich

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 avatar Oct 28 '22 08:10 alemonta

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.

reib3n avatar Oct 30 '22 19:10 reib3n

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.

LievenDHaese avatar Jan 26 '23 10:01 LievenDHaese

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):

  • connect to RBPi (3 or 4) through SSH as admin (i use powershell for command-line or BitVise if I need a GUI), but also SSH & Web Terminal Add-On works fine (remember to configure it to log-in as Admin!)
  • backup pyads 3.9 folder from this homeassistant's docker image (2022.05) with the first command that @jandeschuttere suggested here: https://github.com/home-assistant/core/issues/74067#issuecomment-1179256015 (of course you have to adapt them a little based on your installation to make it work: for instance, i use:

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

  • update Homeassistant image with the latest one (after restart, ADS will not work);
  • connect again through SSH
  • replace the non-working pyads 3.10 folder content with the content of folder 3.9 you previously backed-up:

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

  • restart HomeAssistant (either trrough ssh or via dashboard
  • DONE.

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.

alemonta avatar Jan 26 '23 11:01 alemonta

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?

zimbrich avatar Mar 07 '23 03:03 zimbrich

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.

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.

birdie60 avatar Jun 05 '23 07:06 birdie60

Here is also the same problem on my RBPI. Regards

briersc avatar Jun 05 '23 19:06 briersc