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.11k stars 29.79k forks source link

after updating to 0.113 Beckhoff's ADS integration stopped working #38151

Closed alemonta closed 4 years ago

alemonta commented 4 years ago

The problem

I'm using HA to aggregate info from many different platforms, but my home application is based on Beckhoff PLCs. since last update (0.113), ads variables are not working anymore: I get all the variables read from PLC as unknown or false o 0. Checking the log, it seems an issue related to ADS implementation of callback notification with wrong buffer size of the return value (the log is below in the issue report). In order to avoid messy logs and to narrow the most the problem, I reduced the configuration down to the read of just 1 single udint var.

Environment

Problem-relevant configuration.yaml


# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
homeassistant:
 whitelist_external_dirs:
    - /config/tmp
#enable REST-API
api:

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

# TwinCAT Setup:
ads:
  device: '192.0.0.162.1.1'
  port: 851
  ip_address: '192.0.0.162'

sensor:
- platform: ads
  adsvar: PRG_MAIN.MAIN.secondiUp
  unit_of_measurement: sec
  adstype: uint
  name: Secondi Up

Traceback/Error logs

2020-07-24 10:29:54 ERROR (Dummy-11) [root] Uncaught exception
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 237, in 'calling callback function'
  File "/usr/local/lib/python3.8/site-packages/pyads/pyads_ex.py", line 849, in wrapper
    return callback(notification, data)
  File "/usr/src/homeassistant/homeassistant/components/ads/__init__.py", line 250, in _device_notification_callback
    value = struct.unpack("
struct.error: unpack requires a buffer of 2 bytes

Additional information

punzenbergerpeter commented 4 years ago

Hi, maybe the same problem as #38150 (temporary solution described there)

alemonta commented 4 years ago

Hi, maybe the same problem as #38150

Yes, most probably... I found an old opened issue (still present) related to the callback error opened in May: [(https://github.com/home-assistant/core/issues/35945)]

I was writing my issue just a few minutes after you added yours: when I checked if other were having troubles with ADS integration and 0.113, it seemed I was the only one! ;) A.

punzenbergerpeter commented 4 years ago

I also found this issue, but unfortunately I could not make a mental connection between these issues...

I have made a quickfix locally by editing manifest.json to use pyads 3.0.7 .. .otherwise the "woman acceptance factor" would go below 0 ;)

P.

alemonta commented 4 years ago

I also found this issue, but unfortunately I could not make a mental connection between these issues...

I have made a quickfix locally by editing manifest.json to use pyads 3.0.7 .. .otherwise the "woman acceptance factor" would go below 0 ;)

P.

unfortunately my knowledge about the system is VERY LOW, expecially when it comes to Python... :( A.

MartinHjelmare commented 4 years ago

Please keep the issue on topic and mind our Code of Conduct. We don't accept language that may be interpreted non inclusive by parts of our community.

https://github.com/home-assistant/core/blob/dev/CODE_OF_CONDUCT.md

Thanks for your understanding.

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

ads documentation ads source (message by IssueLinks)